What you should know before writing code?
If you’re looking for getting started with writing code but you know absolutely nothing about it. This post is for you.
I’d give you an overall idea of the minimum stuff you should know before writing a line of code.
First at all, any device (computer, smart phone/watch, etc) works with electricity where 1 represents presence of energy and 0 the absence.
Since those are the only two numbers a device understand, it’s called Binary system (1 or 0). In the other hand we (humans) use the Decimal System where the number go from through (0-9). Also in order to communicate we use idioms like English / Spanish / etc. But any device use something called “Machine Language”.
For example, when you click like in this post, that’s converted into a set of machine instructions (impossible for a human to write/understand) that are executed by the devices and the result is persisted. I know, you might be scratching your head, but bare with me and let’s answer the following question:
How do we write websites like Google / Facebook or applications for your phone if it’s impossible to write machine language code?
Some clever people create high level programming languages and those languages have characteristics like:
Are human readable
Easy to understand
The language knows how to convert the human readable instructions we write into machine code that any device can execute and produce a result.
Can follow one or multiple programming paradigms (Here we talk more about paradigms)
If you still don’t have an idea of what those programming languages are? Imagine them like learning a new idiom, if you learn Spanish, English or something else, you learn the alphabet, start creating words and eventually full sentences that another person can understand.
A programming language is the same story, you learn to write sentences (instructions) to communicate with a device.
Now let’s do something exciting!, we are going to get our hands dirty and write our first line of code 🔥
Visit this link
In the JS tab, write or paste this code:
alert("Hello World")
Did you see the following alert?
CONGRATS 🎉🎉🎉! You just wrote your first line of code instructing the browser to display an alert saying “Hello World” exciting, right? now lets break the code down
We wrote a line of code in the programming language named Javascript.
The language has a keyword "alert" that instructs the browser to open a modal.
"alert" is a function that shows whatever message you pass in, like "Hello World".
For now let’s move on and dive into file extensions, when you save an image or an audio (the old days) or write a word document, excel file, etc. have you notice the file extension that’s added to the file?
If you haven’t, don’t worry. Each one of those files have an extension like png
or mp3
or docx
, we use them to represent what kind of file they are and how to process them.
The same happens with programming languages where each file have its own extension that let you identify the language it was written with. For example
If you want to write a website, Javascript, CSS, HTML are the technologies you’d need to use in order to create it and their file extensions are .js .css .html
respectively.
If you want to build a mobile app, you might use Swift (.swift)
for Apple devices or Java (.java)
Since the list of programming languages is huge, you are not going to learn all of them. My goal is to help you learn to write code and solve problems independently of the programming language, so if the market change you’d be able to adjust and be attractive.
In the following article we are going to know more about programming languages and what paradigms are!.