In the previous post, we discussed what computer programming is and how a computer understands code. In this post, we are going to learn how we write codes.
It is not like we can simply type words into text documents and automatically assume that the computer can translate them into machine code, read it and carry out a task like opening up a browser or running software.
To properly send instructions to the computer we need programming languages. But we also can’t type in a certain language and expect the computer to understand. So how are we supposed to write code then?
Well, the answer is with an IDE, which stands for Integrated Development Environment allows the facilitation of code by a computer.
IDEs are used to write code.
An IDE provides a graphic interface on your computer in which the programmer can easily write, run, and debug the code without having to worry about problems with the compilation or interpretation of the program.
An IDE is like any other program on your computer such as a game, a browser, or even the file explorer, except we’ll be using it to write code. IDEs are able to turn your code into machine code and run it through the computer to produce results.
IDE Example: NetBeans, IntelliJ, Visual Studios.
Advantages of Using an IDE.
In addition to providing a place for programmers to develop their code, IDE’s provide some extremely useful tools for programmers to ease the job of writing code, such as built-in error checking, auto-fill in for frequently used words or phrases, and project hierarchy which will help you organize and manipulate the files within your project.
“Back in olden days, before IDE’s, code used to be written on punch cards and then fed into computers which would take hours and causes a lot of pain.”
IDEs are extremely powerful and will be used in almost 100% of your programming projects. So, through these IDE we are finally able to write and compile code smoothly without worrying about the computer not being able to understand it.
How To Write code in IDE?
Each language has its own set of rules you must follow within an IDE. This is where a programming language syntax comes into play.
Syntax: Rules you must have followed if you want your program to run correctly.
Learning a computer language is very similar to learning a real language. It also has a set of rules you must follow when writing code in that language, similar to grammar in real-life languages.
Breaking programming rules will result in an error.
For example:
- In Java, we must specify which type of variable we are defining and we also have to add a semicolon at the end of the line.
- In python, we just type what we want to create, we don’t even need to define that we are trying to create a variable, and just have we just have to type what we want to create.
- In JavaScript, we specify we are making a variable but don’t define what type of variable we want to make.
All these languages require that you follow this syntax because computers are extremely dumb, if you forgot one semicolon or misplace a character, the entire program will not run and send you back a syntax error.
The IDE will tell you where in your code the error is and it also won’t let you run your program until the error has been fixed.
So, it is always recommended that you learn the rules and syntax of a language before beginning to write complex programs in that language.
(getButton) #text=(Visual Studio Code Setup) #icon=(link) #color=(#2339bd)
No comments:
Post a Comment