There was a time when there were no prints, only the portraits made by some geniuses with mere strokes of their fragile paintbrush. The time went on, and in came digital media accelerating both the speed and quality of prints not to forget the decreasing prices. Crumbling under the plethora of digital prints, handmade portraits went rare. But to date, the best of the hand made portraits are still PRICELESS because the have the thing which digital prints lack, CREATIVITY.
The saga of software development is not much different. Once an art of carefully placing your blocks of code and precisely drawing the relationship between them, it has now become a digital print with well-defined pixels and coloring rules governed by tools and frameworks which are flooding the scenario day by day.
The majority of the artists (Software Developers/students) are not even aware of what works under the hoods of their frameworks, they just follow the rule book ( docs). Modern software development is not driven by design patterns, algorithms, code structure, etc. The most important decision in today’s software development process is choosing the right tool. I might sound so, but I am not against the usage of any tools or frameworks, they indeed the life of a developer easy. My only concern is people using them without knowing what actually is working behind the scenes.
This is a series kept very simple and minimalistic to understand the basics of Software Development. To know about the concepts our favourite frameworks deal with without letting us know. This series is not about cutting edge technology but the basics of tools we are already using.
Often Confused Tech Terms
Terms like language, framework, libraries, load balancer, API gateway, etc have very weak and feeble boundaries. Not only newbies but also men with experience tend to use them interchangeably, this post is an attempt to mark a solid demarcation among them and make their definition clyster clear.
I will start with an example here, suppose you want to cook a spicy curry for lunch. You have all the raw ingredients in your kitchen. You mix them in a specific proportion (with great precision) to get a perfect blend of spice. It is to be noted the precision decides how good the curry was.
Now imagine doing this every day. Imagine a cook in some restaurant who is expected to cook his famous spicy curry every day, and with almost similar taste. Getting all the raw spices, taking them in exactly the same proportion is both tedious and prone to errors. As a solution comes a packet of garam masala which in itself is a mixture of all the spices in the right proportion. The life of a cook is much easier now, he just has to take the garam masala packet and stop worrying about all the individual separate spices.
The raw spices here map to a programming language and the garam masala packet is the framework.
A framework is a collection of programs that do something useful and which you can use to develop your own applications. A framework guides you on how to do something (like a predefined way of doing things). It’s kind of the skeleton of an application that you take advantage of to build your own stuff.
So a framework defines some rules, you follow those rules and try to develop your own applications. A framework also hides from you the obvious repetitive jobs which you have to do while creating any application.
Python is a programming language. In order to write rest services in Python any application has to follow certain tasks like defining an opening a connection on a specific port, allocating threads to the request received on that port, checking the HTTP method used in the incoming request, mapping the request to specific handler, initiating and maintaining connection with database and many others.
Django is a framework which all these tasks automatically for you, it has some rules, like where to define the port you want to use, where to define the database you want to use, but once done, it takes care of all these tasks itself and scaffolds a minimal project structure for you, leaving you with the implementation of logic of you application.
A library is a set of reusable codes previously written by someone else which you can use without having to rewrite it again. A beautiful example here can be of the time library. You don’t have to every time write the logic of getting the timestamp and manually do all the maths to convert into proper format (DD MM YYYY or YYYY MM DD). What you have to do is import the library and use the function to achieve what you want.
A difference between library and framework is, the framework calls your code, while you call the library.
You map the incoming requests on your server to the handler functions, and the framework calls it when that certain request is received.
You call the library from handler functions to reuse some specific logic.
A server is anything that can serve the requests coming from the client. Let us visit a travel agent, he is a server who takes your requests, delegates them to responsible agencies and comes back to you with a response.
In the tech world, a server is a machine with a program running that expects requests via a certain port, in a predefined format and serves back the response.
So a hardware machine running software written using a framework, which in turn utilizes some libraries, to accept requests and give responses is a server.
Let us go back to the travel agent example given in the Server section. Suppose an agent is getting a lot of requests from different people which finally results in decreasing the effectiveness of responses. The travel company comes up with the idea of recruiting 4 more travel agents to serve the growing number of requests. But now a problem arises which request is to delegate to which agent, here comes in the load balancer, a request comes to him, he finds the agent in the best possible state to serve the request and delegate the request to it, making the whole flow simple.
In the tech domain, a company often keeps multiple servers to serve the requests and hide them behind a load balancer which maps the requests to the server in the best possible state to answer the request.
An API gateway is a common entry point to various microservices provided by your application. Suppose you are at an airport, it has a common entry point but inside it separates the passengers going from Air India flight from Indigo flight and delegates the passenger to correct flight. It also can act as a point of authentication and authorization (checking the boarding pass) making sure the current and valid request (passenger) ends to the desired handler (flight).
A protocol is a set of rules of formatting, sending and receiving data over the internet. If communication over the internet has a language then a protocol is its grammar, in a more strict sense.
The sender and receiver both have to follow the protocol to attain proper communication.
I hope that the reader can now demarcate the terms from each other and has a conceptual understanding of what each of them means. Feel free to comment on your views or point out my mistakes in the comments. In the next part of this series, we will be discussing APIs and how they shape modern-day web development.