How learn to programming - Developer Diary #8

in #technology6 years ago

Hello Everyone

In these times where technology companies are the ones that dominate the world economy, the idea of ​learning to build technological tools to enter this world arises, today I have the pleasure of explaining the basics to begin learning in programming, I will tell you in addition tricks that I have been learning and I would like to have known them when I started in my software engineering career.

*Computer and a desktop* [Create by Free-Photos] [Link of image https://cdn.pixabay.com/photo/2016/03/09/09/17/computer-1245714_640.jpg] (link here) [License CC (by) Pixabay] (link to lincese here)

What is the Data and what do they do for us?

The data is the basic expression of information, imagine the hypothetical case we want to describe a cell phone, so we will gather all the possible information to be as accurate as possible, the most basic would be to start with the brand, the model, the color, number of cameras ... etc. The data, in this case, would be:

Brand = OPPO

Model = 2019

Color = Blue

and the information would be, The cell phone is a blue OPPO brand and it is model 2019, that is, the data collection is the conformation of information.

In the programming the data is used exactly for the same, to create information with which we can create a process, in this to use the data in a didactic way and so that its operation can be understood, we will create a program that gives us twice as much of the number we write, then, How does the data work in programming? In programming the data have characteristics, the first is that they are not called data, they are called variables, the second and most important, the variables are divided into types of variables Depending on what you want to keep in them, the most used types of variables are the following:

  • byte (only numbers between -128 an 127)
  • short (only numbers between -32768 an 32767)
  • int (only numbers between -2147483648 an 2147483647)
  • float (only numbers between -3.4E+38 an 3.4E+38)
  • double (only numbers between -1.7E+308 an 1.7E+308)
  • String (unicode characters)

To save some data in a variable, we must declare the data type of the variables, the name of the variable (the name of the variables must start in lowercase and must not contain spaces, it is recommended to use the system "hump of camel" example: typeColor, all the declarations of variables are terminated with a;) and the data, for our example we will create 3 variables:

int number;

int nextNumber;

String outText;

The first variable will keep the number that we will write, the second variable will be responsible for saving the value of the number we write and multiply it by 2, in order to obtain the next number that we write and finally the third variable will be responsible for saving a predetermined text of exit, this would be our code:

package mainPackage;

public class MainClass {

public static void main(String[] args) {

int number = 0;

int nextNumber = 0;

String outText = "The new number is: ";

     }

}

How to obtain the value we write?

As the example we are doing is in Java, I will explain how it works in that language, when it comes to values ​​by console, we must import a class called Scanner, import means to call a tool already made, to do a predetermined task, in this case, read the keys that we press on our keyboard. The code would be the following:

package mainPackage;

import java.util.*;

public class MainClass {

public static void main(String[] args) {

int number = 0;

int nextNumber = 0;

String outText = "The new number is: ";

System.out.println("Write a number");

Scanner inKeyboard = new Scanner (System.in); 

number = inKeyboard.nextInt();

}

}

As java is an object-oriented programming language, that is, each tool is individualized and then they come together in an orderly fashion to create a process. In this case, we must create an object, which is responsible for being id corresponding to the Scanner tool, this object will be called "inKeyboard".

Now we just have to show the user what to do, we must print the indications on screen, for them we will tell the system to print an output on the console, after this we will do the calculation, all the programming languages ​​will support the 4 fundamental operations with their respective sign:

plus is +

minus is -

multiply is *

divide is /

So to get double the number we enter, we just need to enter: for this to be done. Then we will print the result on the screen, for this, as we already have a variable with the default output text and the mathematical operation done, we only have to print these two variables. The result will be the following:

package mainPackage;

import java.util.*;

public class MainClass {

public static void main(String[] args) {

int number = 0;

int nextNumber = 0;

String outText = "The new number is: ";

System.out.println("Write a number");

Scanner inKeyboard = new Scanner (System.in); 

number = inKeyboard.nextInt();

nextNumber = number * 2;

System.out.println(outText + nextNumber);

}

}

//in this case i use + in System.out.println to concatenate the variables

Loops?

Loops are processes that are repeated up to a given limit, you can also do infinite if you want, the loops help us to facilitate and cut the extension of our code, makes the code becomes shorter, the different loops that exist are : for, while and do while

Arrays?

Arrays are a type of data thought in one-dimensional and two-dimensional theoretical fields, the one-dimensional ones are used when you want to avoid the excessive use of variables, for example, if you have to keep several names at the same time, it is best not to create many variables, on the other hand, you must create a one-dimensional array and save the number of names that are necessary, in programming you start counting from 0 (cero).


Two-dimensional arrays are useful in matrix calculations.

What language is better to start programming?

The truth is not that there is one programming language better than another to start, but if there are languages ​​that are simpler and are very useful, my recommended ones are JavaScript, Java, C++, Php, C#, I think that if you start with any of them, it will be easier to understand the other programming languages ​​that exist, remember that programming is not about a language, it is about having logic when thinking.

How to learn easier?

The easiest way to learn is to practice if practiced every day you will learn easier and faster.

Does a good programmer know many programming languages?

No, a good programmer is one who knows how to think and adapts to needs.

I know that it is very little what I have just shown, but I think it is the most basic thing you can know if you want to start programming, remember that the programming was born writing 1 and 0.

Sort:  

Congratulations @mikewrite! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published more than 10 posts. Your next target is to reach 20 posts.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Support SteemitBoard's project! Vote for its witness and get one more award!