User talk:Muthujothi

Thinking in Objects

Though some books takes a specific domain like financial or medical domain to explain object concepts the best way to learn it is learn from the roots from which the object concept arose. Those roots are nothing but how this world is.

Just read through the following passages: Passage 1: 1. English is a type of a language. Tamil is a kind of language. 2. All languages contain alphabets. 3. Alphabets of a language combine together to form words. 4. All languages are used for communication.

Passage 2: 1. A shopping complex can have cinema theatres. 2. Each cinema theatre casts some movies. 3. All movies run for a specified time. 4. Tickets are issued to the people who like to watch movies.

If we observe the above two passages they are the most common things we face in our daily life. What is that some thing which triggers some thing in you when you read through these passages?

The answer is Associations. An Association between some things which we see. An Association between something which we use in our daily life. An association between something’s which I use to write this mail. An Association between something that help us in coming to this office.

What is that something? Those something’s for which we try to define associations becomes the Entities in that domain.

Domain Models: Identifications of the entities and the type of associations between the identified entities are the first and the major tasks in building a good object oriented system.

How to build a Domain Model? The simple answer is to talk with the domain expert. Say for example if the PVR theatre owner comes to me and requests me to build Theatre Management Software for him, being a OO guy I will first build the domain model. How will I try to build a domain model? Just read through the following conversation:

PVR Owner: Hi, good morning. I need to computerize my PVR theatres. Could you please help me? Me: Yes, of course. But I need to understand some your domain. Can I go ahead with some questions? PVR Owner: Yes, of course. Me: Thank you. First of all, I would like to know how many theatres will be there in a complex.

PVR Owner: There is no restriction sir. But I can buy space for any number of theatres in a complex provided the owner of the complex agrees. Do you know I am ready to buy a complex and build theatres in that entire complex. But I may not have theatre at all in some complexes.

Me: Oaky, in the sense that One complex can have 0 or n number of theatres right? Oaky could you please tell me about the movies you cast In your theatres?

PVR Owner: One same movie can run in one or many of the theatre. But there is a specific time until which a movie runs. In that time no other movie can run in the same theatre. Each show cast of a movie will accommodate a certain number of people that depends on the number of seats present in the theatre hall.

Me: Oaky I will just summarize what you said. One Complex can have n number of theatres. One theatre can cast n number of shows. One Showcast has a specific time period. One movie can be watched by n number of people. ……………The conversation continues.

Inference from this conversation: When we identify any two entities in a domain obviously there is a type of relationship existing between them. Some books say that the nouns of a system might become the entities of a domain. But this is not a good way to start. Because we will see even the verbs also will get modeled beautifully as entities in the Behavioral modeling of a domain. In object terms the entities in a domain are termed as the abstractions of a domain. A good object oriented system encapsulates all the domain abstractions properly.

Abstraction and Encapsulation: When you see these words believe me they are two eyes of a good object oriented design. For understanding this, think like this: In a complex system which is built of subsystems, the functioning of one subsystem should not depend on the interior working of another subsystem. To say with an example, the respiratory system and the circulatory system form the subsystems of a living being. The respiratory system which requires blood for its functioning does not depend on how the heart works and generates pure blood right?. It just needs pure blood. So here the entire circulatory system which contains four chambers, pulmonary arteries, arteries, pulmonary veins and veins and the articulation and transfer of blood is completely hidden from the respiratory system. In other words the entire circulatory system is abstracted and its working is encapsulated from the respiratory system and vice versa. We can still dig into this abstraction and encapsulation in other mail.

Importance of Domain Models: You could ask me? Why the hell I need to have a domain model. All I need is just a program which will solve my client’s problem right? We need a clear domain model because we trying to solve a problem that is existing in that domain. We are building a domain model to make the design of the system flexible so that it is able to accommodate changes when the client requirements change. For a Obsessive Programmer, the entities in the domain model, the so called abstractions of a domain model might become the CLASSES when you write the code to solve the problem.

Role of UML: UML helps in defining the associations between identified entities of a domain. It helps is a graphical display of the defined associations. What all I had told in the passage 1, passage 2 and in the conversation can be neatly represented in a graphical way in UML. UML defines just the syntax for drawing an object model of an domain. So what is important here is the model of the domain in which we are going to solve the problem and not the tool which we use to describe the domain. UML is just a tool which helps in bringing more clarity to the domain model which we trying to explain. Above all, the very clear form and pioneer way of communication for the human beings is the diagrams starting form the Stone Age.

Some scenarios to trigger object thinking in you: To get used to think in terms of objects just take a leap from the above mentioned scenarios and try to build as many as you can.

1.	Chinese food is a kind of a food. Indian food is a kind of a food. 2.	North Indian and South Indian are the types if Indian foods. 3.	All foods are made of many ingredients. 4.	Veg ingredients and non-veg ingredients are the two types of ingredients. 5.	Living beings eats food. 6.	Man is a type of a living being. …..Carry on.

1.	A database can store information. 2.	A database contains tables. 3.	Tables Contains Columns. 4.	Any number of triggers can act upon a table. 5.	SQL is a database. Oracle is a database. MySQL is a database. …………carry on.

1.	Letter, Emails, Phones are various kinds of communication devices. 2.	Mobile and landline are types of Phones. 3.	All communication items have a destination to communicate. 4.	Address is type of a destination, Email address is a type of a destination, Phone number is a type of destination. 5.	A communication item can have n number of paths to reach the destination. 6.	Wired medium, Wireless medium, cables, post masters, courier agents, poora(pigeon) are the types of communication medium.

So all we need to think in terms of objects is “OBSERVATION”. Keen observation of the things and the association ship between the things in that domain. --Muthujothi 20:43, 3 August 2006 (UTC)Muthu Chithambara Jothi.