Saturday, June 16, 2012

dependency vs association


Dependency is normally created when you receive a reference to a class as part of a particular operation / method.
Dependency indicates that you may invoke one of the APIs of the received class reference and any modification to that class may break your class as well.
Dependency is represented by a dashed arrow starting from the dependent class to its dependency.
Multiplicity normally doesn’t make sense on a Dependency.

http://nirajrules.wordpress.com/2011/07/15/association-vs-dependency-vs-aggregation-vs-composition/

One class depends on another if the latter is a parameter variable or local variable of a method of the former.
This is different from an association, where an attribute of the former is an instance of the latter.

http://en.wikipedia.org/wiki/Class_diagram#Analysis_stereotypes

Dependency


Dependency is a weaker form of relationship which indicates that one class depends on another because it uses it at some point of time

One class depends on another if the latter is a parameter variable or local variable of a method of the former.

This is different from an association, where an attribute of the former is an instance of the latter.

http://en.wikipedia.org/wiki/Class_diagram#Analysis_stereotypes



  • Dependency relationships


a dependency is displayed in the diagram editor as a dashed line with an open arrow that points from the client model element to the supplier model element.

a dependency relationship is a relationship in which changes to one model element (the supplier) impact another model element (the client). You can use dependency relationships in class diagrams, component diagrams, deployment diagrams, and use case diagrams.


Example
In an e-commerce application, a Cart class depends on a Product class because the Cart class uses the Product class as a parameter for an add operation. In a class diagram, a dependency relationship points from the Cart class to the Product class. The Cart class is, therefore, the client model element, and the Product class is the supplier model element. This relationship indicates that a change to the Product class might require a change to the Cart class

http://publib.boulder.ibm.com/infocenter/rsdvhelp/v6r0m1/index.jsp?topic=%2Fcom.ibm.xtools.modeler.doc%2Ftopics%2Fcdepend.html

bi-directional association

For instance, a flight class is associated with a plane class bi-directionally

Realization


In java when one class implements and interface it is called realization, the class realizes the interface.

In UML modeling, a realization relationship is a relationship between two model elements, in which one model element (the client) realizes (implements or executes) the behavior that the other model element (the supplier) specifies

a realization is displayed in the diagram editor as a dashed line with an unfilled arrowhead that points from the client (realizes the behavior) to the supplier (specifies the behavior).
http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/com.ibm.xtools.modeler.doc/topics/creal.html

Generalization


The generalization relationship is also known as the inheritance or "is a" relationship.
When one class inherits or extends another class, it is called Generalization.

composition vs aggregation


  • composition vs aggregation

Composition is more restrictive.
When there is a composition between two objects, the composed object cannot exist without the other object.

This restriction is not there in aggregation.

A Library contains students and books.
Relationship between library and student is aggregation.
Relationship between library and book is composition.
A student can exist without a library and therefore it is aggregation
A book cannot exist without a library and therefore its a composition.

http://javapapers.com/oops/association-aggregation-composition-abstraction-generalization-realization-dependency/


  • composition vs aggregation
composition is stronger than aggregation relation
in composition a part only belongs to a whole
if you destroy a building you destroy a room as well

in aggregation relation this is different because if you destroy a band musician can continue to exist




  • What is the difference between aggregation and composition?


Aggregation 
Aggregation is an association in which one class
belongs to a collection. This is a part of a whole
relationship where a part can exist without a whole.
For example a line item is a whole and product is a
part. If a line item is deleted then corresponding
product need not be deleted. So aggregation has a
weaker relationship.

Composition
Composition is an association in which one class belongs to a
collection. This is a part of a whole relationship where a part
cannot exist without a whole. If a whole is deleted then all parts are
deleted. For example An order is a whole and line items are parts.
If an order is deleted then all corresponding line items for that
order should be deleted. So composition has a stronger
relationship.


Composition


Composition is a stronger variant of the "owns a" or association relationship
composition is more specific than aggregation.
It is represented with a solid diamond shape.
Composition has a strong life cycle dependency between instances of the container class and instances of the contained class(es)
If the container is destroyed, normally every instance that it contains is destroyed as well

Aggregation


Aggregation is a variant of the "has a" or association relationship;
aggregation is more specific than association.
It is an association that represents a part-whole relationship which means that one object contains another object.
Aggregation can occur when a class is a collection or container of other classes,
but where the contained classes do not have a strong life cycle dependency on the container--essentially

Stereotypes


stereotypes are used to show how this element of a class is specialized

4.03_Stereotypes
http://www.youtube.com/watch?v=g7O6R8loCss&feature=relmfu


Visibility


  • Visibility
To specify the visibility of a class member (i.e., any attribute or method)

All the Visibility of a Class Members Are:
+         Public 
-         Private 
#         Protected 
~         Package
/         Derived
underline Static


4.02_Attributes & Operations
http://www.youtube.com/watch?v=Brjle3R_iXA&feature=relmfu


reflexive (recursive) association



a class can be associated with itself

Association


When two objects are associated, one object will be having a variable that points to the other object


 Association is a relationship type between classes
"has a " relationship
manager has an employee or an employee has a manager
manager manages an employee or an employee works for a manager


There are four different types of association

  1.  bi-directional
  2.  uni-directional
  3.  Aggregation (includes Composition aggregation) 
  4.  Reflexive( Recursive)



4.04_Associations & Multiplicity
http://www.youtube.com/watch?v=eDO-okP-kaU&feature=relmfu
http://en.wikipedia.org/wiki/Class_diagram#Analysis_stereotypes


object oriented software system


  • object oriented software system
usecase view(requirements of system)
design view
process view
implementation view
deployment view





UML


  • UML,unified modelling language
visualizing,constructing and documenting all parts of system

UML Views of the World


  • UML Views of the World


  1. Use Case Model
  2. Static Models
  3. Interaction Models



  • Use Case Model


  1. use case diagram
  2. use cases



  • Use Case Diagram

initial system model
provides a graphical representation of services the system will provide
inception phase

actor:person,system etc
use case:a function of value for the actor
communication:link between actor and use case


  • Use Cases

represent function as experienced by the actor
eloboration phase



  • Static Models: show the structure of the system

  1. Class
  2. Object
  3. Package
  4. Component
  5. Deployment



  • Class Diagram

shows relationship between classes
elaboration phase


  • Object Diagram

used to give an example of how a system will look like under specific circumstances


  • Package Diagram

depicts the dependencies between the packages that make up a model.


  • Component Diagram

depicts how components are wired together to form larger components and or software systems.


  • Deployment Diagram

models the physical deployment of artifacts on nodes.




  • Interaction Models :shows the interaction of the system


  1. Sequence
  2. Communication
  3. Activity
  4. State Machine



  • Sequence Diagram

kind of interaction diagram that shows how processes operate with one another and in what order
represents sequence of events
show messages passing between objects


  • Communication(Collaboration) diagram

relationships between classes


  • Activity Diagram

flowchart with object notation
represents task activity


  • State Machine Diagram

shows how activities change the state of an object




Reference:
http://en.wikipedia.org/wiki/Deployment_diagram

RUP


  • RUP presents Software Architecture 4+1 views
logical view
implementation view
use-case view
process view
deployment view



  • RUP ,rational unified process (software development process)
inception
elaboration
construction
transition



Reference:
http://www.jkang.com/0602-574/ooad/sld001.htm

uml interview questions-1



  • Define UML?

Unified Modeling Language, a standard language for designing and documenting a system in an object-oriented manner
It has nine diagrams which can be used in design document to express design of software architecture.


  • Can you explain use case diagrams?

Use case diagram answers what system does from the user point of view.
Use case answer ‘What will the system do?


Scenario: A scenario is a sequence of events which happen when a user interacts with the system.
Actor: Actor is the who of the system, in other words the end user.
Use Case: Use case is task or the goal performed by the end user


  • Can you explain class diagrams?

Class is basically a prototype which helps us create objects.


  • Multiplicity?

Multiplicity can be termed as classes having multiple associations or one class can be linked to instances of many other classes.

  • Can you explain object diagrams in UML?

Classes come to live only when objects are created from them. Object diagram gives a pictorial representation of class diagram at any point of time.


  • Can you explain sequence diagrams?

Sequence diagram shows interaction between objects over a specific period time

http://www.codeproject.com/Articles/28445/UML-Interview-Questions-Part-1#Canyouexplainusecasediagrams







  • What are the different views that are considered when building an object-oriented software system?

Normally there are 5 views.

Use Case view - This view exposes the requirements of a system.
Design View - Capturing the vocabulary.
Process View - modeling the distribution of the systems processes and threads.
Implementation view - addressing the physical implementation of the system.
Deployment view - focus on the modeling the components required for deploying the system




  • What are the different views that are commonly used when developing Software in Java?

A) 1) Use Case View - Describes the system from the User's point of view, Describes the various functionalities expected from the system to be developed and how user is going to interact with those features.
2) Class Diagram - Shows graphically the relationships between classes and packages.
3) Sequence Diagram - Shows the sequence of method calls and interactions between classes.
4) Component Diagram - Shows the components within the system and the interaction between components.

http://www.javajotter.net/uml/interview_questions/umlinterviewquestions.php


  • What are diagrams? 

Diagrams are graphical representation of a set of elements


  • How are the diagrams divided? 

The nine diagrams are divided into static diagrams and dynamic diagrams.

Static Diagrams (Also called Structural Diagram):
Class diagram, Object diagram, Component Diagram, Deployment diagram.

Dynamic Diagrams (Also called Behavioral Diagrams):
Use Case Diagram, Sequence Diagram, Collaboration Diagram, Activity diagram, Statechart diagram.



  • What are the major three types of modeling used? 

Major three types of modeling are structural, behavioral, and architectural.



  • the different kinds of modeling diagrams used?


Use case diagram
Class Diagram
Object Diagram
Sequence Diagram
statechart Diagram
Collaboration Diagram
Activity Diagram
Component diagram
Deployment Diagram




  • What is SDLC? 

SDLC is Software Development Life Cycle.
SDLC of a system included processes that are Use case driven, Architecture centric and Iterative and Incremental.
This Life cycle is divided into phases.
Phase is a time span between two milestones.
The milestones are Inception, Elaboration, Construction, and Transition.
Process Workflows that evolve through these phase are Business Modeling, Requirement gathering, Analysis and Design, Implementation, Testing, Deployment.
Supporting Workflows are Configuration and change management, Project management


  • What are Relationships? 


There are different kinds of relationships:
Dependencies
Generalization
Association


Dependencies are relations ships between two entities that that a change in specification of one thing may affect another thing
Most commonly it is used to show that one class uses another class as an argument in the signature of the operation

Generalization is relationships specified in the class subclass scenario, it is shown when one entity inherits from other.

Associations are structural relationships that are: a room has walls, Person works for a company
Aggregation is a type of association where there is a has a relation ship,
That is a room has walls, if there are two classes room and walls then the relation ship is called a association and further defined as an aggregation.



http://www.techinterviews.com/uml-interview-questions-and-answers



  • What is Association?


Association is a relationship between two classes.
In this relationship the object of one instance perform an action on behalf of the other class.
The typical behaviour can be invoking the method of other class and using the member of the other class.

public class MyMainClass{

public void init(){

new OtherClass.init();
}

}




  • What is Aggregation?

Aggregation has a relationship between two classes.
In this relationship the object of one class is a member of the other class.
Aggregation always insists for a direction.

public class MyMainClass{

OtherClass otherClassObj = new OtherClass();




http://www.java-questions.com/oops_interview_questions.html
http://www.tutorialspoint.com/java/java_encapsulation.htm
http://www.interview-questions-java.com/
http://www.janeg.ca/scjp/overload/poly.html


8 Core Beliefs of Extraordinary Bosses


8 Core Beliefs of Extraordinary Bosses

1. Business is an ecosystem, not a battlefield.

2. A company is a community, not a machine.

3. Management is service, not control.
They push decision making downward, allowing teams form their own rules and intervening only in emergencies.

4. My employees are my peers, not my children
Average bosses see employees as inferior, immature beings who simply can't be trusted if not overseen by a patriarchal management.
Employees take their cues from this attitude, expend energy on looking busy and covering their behinds.

5. Motivation comes from vision, not from fear.
Average bosses see fear--of getting fired, of ridicule, of loss of privilege--as a crucial way to motivate people.
As a result, employees and managers alike become paralyzed and unable to make risky decisions.

6. Change equals growth, not pain.

7. Technology offers empowerment, not automation
trengthen management control and increase predictability

8. Work should be fun, not mere toil

http://www.inc.com/geoffrey-james/8-core-beliefs-of-extraordinary-bosses.html

5 Toxic Beliefs That Ruin Careers



5 Toxic Beliefs That Ruin Careers

1. My self-worth is based on what others think of me.

2. My past equals my future.
When some people experience a series of setbacks, they assume that their goals are not achievable.
Over time, they become dispirited and discouraged, and avoid situations where failure is a risk.
Because any significant effort entails risk, such people are then unable to make significant achievements

3. My destiny is controlled by the supernatural.
Some people believe that their status in life–or even their potential as a human being–is determined by luck, fate, or divine intervention.
This all-too-common (and ultimately silly) belief robs such people of initiative, making them passive as they wait for their "luck" to change.

4. My emotions accurately reflect objective reality.

5. My goal is to be perfect or do something perfectly.
Because perfection is unattainable, the people who seek it are simply setting themselves up for disappointment.
Perfectionists blame the world (and everything in it) rather than doing what's necessary to accomplish extraordinary results.
That's why "successful perfectionist" is an oxymoron


http://www.inc.com/geoffrey-james/5-toxic-beliefs-that-ruin-careers.html?utm_source=twitterfeed&utm_medium=twitter&utm_campaign=Feed%3A+inc%2Fheadlines+%28Inc.com+Headlines%29


Bouncing Back from Job Loss: The 7 Habits of Highly Effective Job Hunters

Bouncing Back from Job Loss: The 7 Habits of Highly Effective Job Hunters

if you look at job loss, like any setback from an enlarged perspective, you realize that success in life is measured far less by our opportunities than by how we respond to life’s setbacks and challenges.

The challenge people in that situation face is how they handle not only the loss of their job, but the many emotions that can arise. These range from a sense of humiliation, failure and vulnerability, to anxiety, resentment and self-pity. Sure, losing your job can be a blow to your back pocket, but it’s often an even bigger blow to your ego and self worth.

When it comes to a successful job hunt, attitude is everything.  A proactive and positive mindset will differentiate you from the masses, making all the difference in how “lucky” you get in an unlucky economy

1. Stay future-focused

2. Don’t let your job status define you.
Who you are is not what you do. Never was. Never will be.
People who interpret losing their job as a sign of personal inadequacy or failure are less likely to ‘get back on the horse’ in their job hunt than those who interpret it as an unfortunate circumstance that provided a valuable opportunity to grow in self-awareness, re-evaluate priorities and build resilience.

3. Prioritize self-care.
mental and emotional resilience requires physical resilience
(After all, you now have no excuse that you don’t have time for exercise.)
Studies have found that exercise builds resilience, leaving you more immune to stress.
just do something that lifts your spirits

4. Surround yourself with positive people
Emotions are contagious.
The people around you impact how you see yourself, your situation and what you do to improve it
Surround yourself with people who lift you up, and avoid those who don’t.
Let them know that while you may not have chosen your circumstances, you are confident that with time and effort, you will all pull through together, and be all the stronger and wiser for it.

5. Tap your network

6. Treat finding a job as a job.
Sure you have more time on your hands than you had before, but you will be amazed at how little you can do in a day if you aren’t intentional about what you want to get done
Then prioritize, structure your day and treat finding a job as a job.


7. Extend kindness.
extending kindness toward others makes us feel good.
scientists have found that acts of kindness produce some of the same “feel good” chemicals in the brain as anti-depressants
In addition, when we give our time to help others, it helps us stop dwelling on our own problems, and makes us realize how much we have to be thankful for.

http://www.forbes.com/sites/womensmedia/2012/06/12/bouncing-back-from-job-loss-the-7-habits-of-highly-effective-job-hunters/


class diagram


In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among the classes.

A relationship is a general term covering the specific types of logical connections found on class and object diagrams. 

UML shows the following relationships:
  • Instance level relationships
  • Class level relationships
  • General relationship


1) Instance Level Relationships
a. Association
b. Aggregation
c. Composition

2) Class Level Relationships
a. Generalization
b. Realization

3) General Relationships
a. Dependency
b. Multiplicity