Friday 31 August 2012

What is Association,Composition and Aggregation?


 Association,Aggregation and Composition is a core concepts of oop about the relationship of different classes with slightly difference in each other.

Association: The two Classes has a relationship with each other but each class has its own life cycle and not rely on each other
for example class “A” may has multiple or single object of class “B” and Class “B” may also has multiple or single objects of class “A”.
 
Example: student has one or different departments and one department have one or more students and not depend on each other.
 

Aggregation: Aggregation is a special type of Association means each entity has its own life cycle but one of them rely on other
means class “A” has only single object of class “B” at a time but class “B” has multiple or single objects of class ”A”.
 
Example: Employee has only one company at a time and company may have one or multiple employees but both has different life cycle.
 

Composition: Composition is a special type of Aggregation means one entity of them rely on other i.e.  class “A” has only single object
of class “B” at a time but class “B” has multiple or single objects of class “A”
but when one entity destroy other also must destroy means one life cycle is depend on other.
 
Example: Room has only one house but house may have one or multiple rooms
but room has no existent without house so room life cycle depends on house.

 
Happy Coding :)




Thursday 30 August 2012

Purpose and use of pointer in toolbox


Today I am writing a blog about the use of pointer in tool box in visual studio
Most of the people has misconception about the pointer that it is a control like others
although pointer is not a control but it is actually use for deselect the control you
previously selected from the tool box :)



Question is why it need?

Pointer has logic in desktop application because when you select any control from tool box
the framework make reference of that control and when you click on form that control is
drop on desktop form until you deselect it by clicking on pointer in tool box.
But pointer is illogical in web application because it has not make reference by clicking a control.

You’ve probably noticed how the pointer control is sticky at the top of each tab group.
This is because whenever a control is selected in the Toolbox, the mouse pointer automatically becomes a "drag" for that control,
meaning that you just have to put your mouse pointer onto the form and click, and the control is dropped.
 You don’t have to hold down any keys to do the actual drag.
But you may not actually way to do a drop at this time.
So you can put the focus on the Pointer control to ensure that you don’t accidentally do a drop.

Summary :
On a click of an item in Tool Box it gets selected.
To deselect that item the pointer can be clicked. It’s not a separate control.

Happy Coding :)