Posted by: ahmedashfaque | April 23, 2018

Why object oriented programming seems difficult?


Most people will agree that object oriented programming seem difficult as compared to functional programming.  Let us understand why this is so.

In functional programming, you create a function when it is required and do all the required computation through this function. For example, suppose you are creating a web page where a customer is buying a product from the online store. In this case, you will create a function on the same web page which is used for creating customer orders (which will provide the functionality so that the customer will be able to successfully create an order to buy a product from the online store). In functional programming, software source code is almost always is written at a place where it is needed. Only some utility functions are written and stored and is called when it is needed. For example, you can create a security module and call it whenever security checking is needed (for example to ensure only a verified person has access to secured portions of a software product).

In object oriented programming, you create classes and write all the functions inside those classes. The functions thus are not written where they are actually used. So in most cases, functions are called when they are needed. For example, if the online store was being built using object oriented programming (e.g. compiled Java classes) then things would be done differently. Instead of writing the software source code for creating orders for the online store; the source code will be written inside Java classes and not directly on the web pages. These Java classes will then be called from the web pages to provide the required functionality.

Writing code directly at the place where they are needed is very straight forward. So programming job is simpler. But when code is written at some place and then used at some other place makes programming more difficult.

This is the reason, object oriented programming seem more difficult than functional programming.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

Categories

%d bloggers like this: