Hey readers, today I will be writing a post in developer series. I will be writing about types of programming and approach we need to adapt to program something. Reading this you will know how the code is written, collected and managed for large projects.
There are different approaches based on different factors.
So let’s start
Procedural Vs Object-Oriented Approach
Procedural approach – is based on writing code based on a specific order, called procedure. This style of coding is so we need to write step by step of what may happen. Let the example of a student. We first define variables like student_name & roll_no for a student. We first declare these, then create a function, then another function and step by step. It is old approach started from the beginning of programming.
We need to have a list of instructions that we need to execute step by step. It is good for small one time projects where we have everything in clear. like in banking management system we will create users, then create accounts, then cost handling and more in steps followed by another.
Object-Oriented Approach – In this approach, we just follow real-world model and map to programming by object and classes. The object can be called as anything that has properties and behavior. Like Apple is a fruit and red color. One more, for student roll no and school are properties and study is the behavior. This way makes programming easy as we completely depend on the real-life model and can easily convert it to program. we use objects by grouping them in classes. Classes are a collection of objects of the same type. For example, a school class may have students as well teachers as objects.
In this, we do not need to have complete detail at the start , but we can include it in different phases of development. Let the example of a bank management system, we create an object as a customer that has an account with details like name, mobile, phone and behavior as creating an account, withdraw cash, deposit cash as behaviors. This makes changes easier and can be changed according to time with changes happening in real world.
Top Down and Bottom Up approach
The Top Down Approach – Also known as the stepwise design is essentially the breaking down of a system to gain insight into its compositional sub-systems in a reverse engineering fashion. In a top-down approach, an overview of the system is formulated, specifying, but not detailing, any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. Top-down approach starts with the big picture. It breaks down from there into smaller segments. Basic is just take a model and work on it, then fix smaller and smaller changes to make it perfect. Top-down approach be like, during the creation of home we first create a building by joining pillars and walls, then we apply cementing, then coloring, then doors. Similarly, we first work on creating a big thing, then go for smaller changes for completion.
A bottom-up approach – is the piecing together of systems to give rise to more complex systems, thus making the original systems sub-systems of the emergent system. Bottom-up processing is a type of information processing based on incoming data from the environment to form a perception. In a bottom-up approach, the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then, in turn, are linked, sometimes in many levels, until a complete top-level system is formed. This strategy often resembles a “seed” model, by which the beginnings are small but eventually grow in complexity and completeness. This model is good when we have small systems, then combine to make them into a big one system. Like a car, we make tires, body, doors, wheels and combine them to form a single working car. Similarly, we can use this approach when we have several small related systems for making a single system.
Event Driven Approach
In an event-driven application, there is generally a main loop that listens for events and then triggers a callback function when one of those events is detected. In embedded systems the same may be achieved using hardware interrupts instead of a constantly running main loop. Some examples are like traffic light system, electronic parking systems, that do something based on an event.
Distributed Programming Approach
Distributed programming – is based on networking where we need to connect different places using a network and server. A simple example is a bank system where there is a central system containing all branches information, and regional systems containing their bank’s information. This Approach is based on creating distributed systems. The distributed systems are that system where different systems are connected using network devices. In real time, we have large scale information that can not be collected at a single place so it is better to distribute and process differently. So this approach is for such systems.
Basically, we follow Object-oriented Approach more nowadays for simple projects. For cloud and Information Services we use distributed programming. And in systems like traffic system, emergency systems we use Event-driven approach.
That is all for now, we will post more in developer category. Stay connected for more updates coming. Feel free to like, comment and share your views in comments below. Share with your friends, family, and relatives to spread the information.