Posted by: ahmedashfaque | January 31, 2017

Objects in programming part 2


In Part 1 of this series, we saw that all the information about life should be attributed to real life entities. If wrong information is attributed to an entity then there will be problems. Now we will discuss further as to how object oriented programming solves this problem.

In the old days of Database management Systems (DBMS), there used to be simple interface through which data can be entered and then will be saved in the database. Once the data used to get permanently saved then it was used to generate management reports.

These kinds of computer systems used to be simple in nature. They are even used today. Here the programming used to do 2 things. First, it would help in doing computation on the input data to store data permanently in the database. Second, Some programs used to be written which could generate management reports. Programming involved for these kinds of systems thus were simple. In those days, object oriented programming was not used much. Simple procedural programming languages could do all this stuff.

Now a days, computer programs are not that simple. Users not only provide input; they want to interact with the computer system more. For example, a virtual shopping cart on an online web store can do a lot of things. You can select some items from various web pages to keep them in your shopping cart. You can also remove them from the shopping cart. You can keep browsing the web store for prolonged periods of time. During this entire time, the information about the things which are inside a shopping cart is temporary in nature. So you can not store information about a shopping cart permanently until the a user wants to check out. Only after check out and payment, you can generate permanent data. At this point you can store the purchase data in a database permanently. But before that, all the information is stored temporarily. At the same time, there can be thousands of users visiting the same web store and each user will have its own shopping cart. What if information about a specific shopping cart gets wrong? It can happen if information about a shopping cart is attributed to some wrong shopping cart.

Programming involved in this kind of scenario needs different kind of handling compared to the situation we discussed about a typical DBMS system. Object oriented programming comes handy in these situations. In object oriented programming, each shopping cart becomes an object. All information about a shopping cart is always attributed correctly to the right shopping cart.

We will learn about wonders of object oriented programming further; in our next post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: