Tuesday, November 25, 2008

Order Management System

Our company Mohit ltd. has 2 products namely Neem soap and Neem oil. We have a sales force of around 200 people that collect order from 1050 stores distributed all over West Bengal. The central depot for both the above mentioned products is in Sumali. We need a system where in:

- The salesperson can use a PDA an log on to the web with a unique ID and password and inform the central depot about the requirement of that particular product.

- After getting an intimidation the system should check the inventory level of the product required.

- If there is sufficient inventory to satisfy the demand, an order should be accepted and the same should be deducted from the existing stock level. This way we know the actual stock of that product lying with us.

- In case, there is insufficient stock to fill the demand,the salesperson should be informed and the order should not taken.

Monday, November 17, 2008

Oops i didnt did it............

I was talking to a friend of mine who has just completed his graduation in chemistry and explaining to him about OOP. We were seating at McDonalds.
Me: I am hoping that with enough exposure to OOP I should be able to explain it to you.

Nikhil: Just hang on for a sec. Let me order for a burger.
Me: OOP is to understanding the right way to look at and organize your code in your project and it will help you to understand what object oriented programming is. For example, in the real world when you go into a kitchen you can see an oven and a stove. Both of these things or objects are nouns. A stove can heat and an oven can cook. These behaviours or functions are verbs. They do something. A stove can have a characteristic like a cooking temperature. This characteristic or property is an adjective.
Nikhil: Is it some kind of household work or what?
Me: In the programming world, these “things” that can have methods or properties are called “objects”. You get to name them when you write code. You can also create your own object with your functions and your properties added to it. Object oriented programming is the term given to this approach of organizing or as they say, “encapsulating” your functions and properties and data into a “object” variable. Doing this makes it reusable, generic and helps organize your code among many other benefits.
Nikhil: Can you explain it with an example?
Let’s say for example, you decided to apply object oriented principles to it you wrap up all your stove code into a stove object and all your refrigerator code into a refrigerator object. Then in their place you would create new instances or clones if you will of the stove and refrigerator object as you need it. What you are doing is making abstract, blank, customizable “object” variables with the functions and properties you want built in. Then you can use this object in other programs. You do not have to write a stove object again.
Nikhil: How is it applicable in real life scenario?
In practical application, you would create a oven “class” which is a way to define and organize all the methods and properties for use in your oven “object”. You define it in an external file and copy all your oven functions and oven data properties into it. When you want to use it you import it at the top of the file and then create a “my Oven” variable and then “instantiate” or make an empty clone of it using “new Oven ()”. IE, var my Oven = new Oven ();
Where you had a cook function you now have a cook method. A method is a function that is part of an object. For example, myOven.cook () would be a method of the Oven object.
When you find yourself repeating the same code and functions over and over again you will recognize this is an area where you can apply OOP and break down and organize your code into reusable pieces.
Nikhil: That’s it. Is it this simple? Though trying it in practical can address my concern better.
Me: Not today brother. It’s time to have a pie out with some burger.