Programmers write code that is executed by computers.I offered an answer but I actually raised more questions.
What is code?
Code is a language that is understood both by computers and humans. For example, if you are German and your friend is from the Philippines you will probably communicate with each other using English. In the same way code is used by humans to communicate with the computers.
What can you do with code?
Think of code as a material that can take any shape the programmer wants it to take. If you saw The Matrix movie (1999) remember how inside the matrix everything was made out of green code. Similarly, online everything is made out of code. In the real world if you want a chair a carpenter will make one out of wood. If you want a virtual chair a programmer will make you one out of code. Whatever functionality you desire to see or interact with on a laptop or smartphone a programmer can create it using different pieces of code that work together to create the final product.
How to build a house with code
As I said earlier, you can build anything with code. The more complex the request, the more complex the code structure will be. If you want to create a social media platform like Facebook, that is going to take a lot of time. I’m going to continue to use the example of a house to explain how programmers use code to create complex websites and programs. A piece of code is a brick. By layering many pieces of code onto one another you can create a house. The 3 main layers of a program (house) are basement, walls and roof, aesthetics.
1. Aesthetics – Front End
If Facebook is a house then what you see daily on your screen represents the exterior and interior of a house (Front End). As a user, you can observe the pretty paint layer. But that layer only represents 5% of the thickness of a wall.
The Front End (FE) has to display all the information that you want. It is also responsible for enabling you to interact with the program. For example, if you want to enter the house (login) you have to use they key to the house (password) to enter through the front door. The Front End is made of two main elements:
- What you see as a user – paint, doors, windows, etc
- Logic that dictates the behaviour of FE elements – how the door opens
2. Walls and roof – Back End
As a normal user, you never see this part. Think of it as the inside of the walls, there lies the brain of the app. Whatever action you make on the Front End it will be transmitted to the Back End for interpretation.
For example, let’s say that your Facebook profile picture represents a painting on the wall of the house. When you create your profile picture you tell one of your house servants that you require a painting of yourself on the wall. The servant takes the original painting and carries it to the basement for storage (Data Base). After the painting is stored the servant makes a copy of the painting and displays it on the wall as you requested. That is your new profile picture.
Most of the logic is executed by the servant (what goes where) and everything of value is stored in the basement (Data Base – DB).
3. The basement – DataBase
When you turn off your computer or smartphone the information that you have on an app must be saved somewhere so that it won’t get lost. All of this data is saved inside of a database. Think of a database as a really well organized basement where everything is labeled and where you store most of your stuff. If you want to find your high school photo album you simply go to the basement and retrieve it from where you put it years ago for safe keeping.
Similar to a house, if there are issues with the main structure of the program the paint will crack, the doors won’t open properly and everything might crash suddenly.
A computer programmer usually writes little pieces of code (bricks) that will be used either for the basement (Data Base) the walls (Back End) or the Aesthetics(Front End) of the program.
As you can imagine building a house on your own can be done but it takes a lot of time. That is why most of the time programmers work in teams. Similar to a construction crew the team first starts by creating a solid foundation, a solid structure and then paint everything nice (what you see on the screen). How much time it will take the team to develop the software depends on the experience of the programmers, the size of the project (cabin vs Taj Mahal) and the requests of the client.