Your Last Procedural Programming

Procedural or Structured Programming in the context of Object Oriented Programming ( referred to as OOP here onwards ) refers to programming without the use of objects. Right now, there are only very few programming languages that only follow structural programming.

When we wrote our first program, the first line started with

[java title=”” gutter=”true” highlight=”5″]
public Class HelloWorld

This means that we are already doing Object Oriented Programming ? Technically yes, but not fully yet. In order to understand the benefits of Object Oriented programming, you will have to understand Procedural or Structural programming first.

Business Case : A bank has 2 types of Accounts – Savings Account, checking Account. The differences between the two are identified below.

  • Savings Account can have accumulated interest whereas a checking account cannot.
  • Savings Account does NOT need a minimum balance whereas a current account needs a minimum balance.
  • Savings Account don’t have over-draft protection whereas current account has.

Interest is calculated as a percentage of the balance. For savings account the percentage is 5% and for checking account the percentage interest is 6%.

Let’s first model this case in Java without using objects – In fact it is very difficult and ugly to do the same in Java since Java does not have the concept of Struct ( as in C language ) to represent a structured set of data – say account. Instead, every data set can be represented in java as a class.


Leave a Reply

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

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