Posted by: ahmedashfaque | September 15, 2015

object oriented thinking


For object oriented design, you need to think in terms of objects. When you create a class which is the template for your objects, you need to think as to how objects will behave and interact with each other. For example suppose you have created a user class and an account class for a software application for online access for a bank account. The user class contains a method authenticate. This method is used to authenticate a user so that the user can do any transaction in the system.

How the authenticate method works? Let us discuss.

When the user tries to enter in the system providing a username and a password then the system will use this input to find out if these values for username and password exist in the database. If it does then the system will allow the user to enter in the system. Otherwise the system will not allow the user to enter in the system.

Now the question is: How the account object comes in this picture? The most important aspect about banking systems for bank account holders is that when the user logs in the system, the user can only see and do transactions which are related to his/her own account with the bank. The user can not see or do any transactions which are related to accounts of other users. This means that the bank account is directly linked to the user information (username and password) of the user. So when a user successfully logs in the system, the user only sees information related to his/her account and not information related to accounts of other users.

From the above discussion it is clear that when the user object provides the user interface to enter username and password to the user, the account object is used to provide the information about the bank account of the user. At runtime, the user object links with the account object after successful login in the system.

When you design your objects, you need to have a clear thinking about how objects are going to behave in the system.

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: