Interview Questions On Java,Java EE

Enter your email address:

Add to Technorati Favorites
Google PageRank Checker
Showing posts with label UML. Show all posts
Showing posts with label UML. Show all posts

Tuesday, April 10, 2007

What are different kinds of Behavior diagrams?

Behavior Diagrams include :

- Use Case Diagram (used by some methodologies during requirements gathering)
- Activity Diagram
- State Machine Diagram.
Continue reading...

What are different kinds of Interaction diagrams?

The Interaction diagrams represent how objects interact with one another through message passing.

There are two kinds of Interaction Diagrams :

Sequence Diagram
Collaboartion Diagram

If you want to study these diagrams in detail then go through this pdf given by OMG.
Continue reading...

What are different kinds of Structure diagrams?

Structure Diagrams as part of UML2.1:

Class diagrams
Object diagrams
Composite structure diagrams
Component diagrams
Deployment diagrams
Package diagrams

For more details on individual structure diagrams, visit following links:

Practical UML
Continue reading...

What is the purpose of State machine diagrams?

Objects have both attributes and behaviors. Attribute is also know as state. When objects are incredibly complicated then to have better understanding during different state changes one should develop one or more state machine diagrams, formerly called state chart diagrams in UML 1.x, describing how their instances work.

UML state machine diagrams show the various states that an object may be in and the transitions between those states. And these transitions are triggered by an event that can either be internal or external to the system.An initial state of an object is called creation state,as this is the time when an object is created, and the final state is reached when there are no more leading out transitions from this state.

A self explanatory example of state machine diagram is given here for PIN check processing at ATM.It includes sub-machine diagrams, as shown in the diagram below:

Continue reading...

What is Dependency and how it maps into a Java class

A Dependency relationship means when a class consumes/uses methods or variables from other class(supplier).So a change to supplier class affects the consumer class as well.Here supplier is indepenedent of any changes being made to consumer classs.

In UML class diagrams, a dependency relationship connector appears as a dashed line with an open arrow that points from the consumer class to the supplier class. A dependency relationship means an "import" statement.

Continue reading...

What is Composition and how it maps into a Java class

A Composition is a tight Association and denotes "whole-part" relationship.So when an object is destroyed then all its constituents are also destroyed, these 'parts' have no meaning/sense in their lone existence from their 'whole'.

The best example of Composition is a 'Human body' which is composed of two legs,two hands,two eyes,two ears and so on.During the lifetime of a human being,all organs make sense being part of whole,but once a human being is dead most of these parts are also dead,unless some of his body parts are not medically reused.

Now come to map composition to Java world, the best example is garbage collection feature of the language.While garbage collecting objects, whole has the responsibility of preventing all its parts being garbage collected by holding some references to them.

It is the responsibility of whole to protect references to its parts not being exposed to outside world.The only way to have true composition in Java is to never let references to internal objects escape their parent's scope.

An example of Inner class as shown in the following code snippet may give you an idea how to implement Composition in Java.

public class Human

public Human()
Brain brain = new Brain();

private class Brain

Continue reading...

What is Aggregation and how it maps into a Java class?

An Aggregation is an Association which denotes an "is part of" relationship.

Take a 'Car', for example, it is consisted of an engine,a steering wheel, four tires,seats,gear box,fuel tank,engine oil tank, air filters etc.So all constituents of car are parts of it.

If a car is destroyed/smashed, its parts can still be used separately as spares in other cars,so these parts have individual use even when their conatiner entity is destroyed.

In a Java class, an aggregation can be represented from above example as :

class Car
List getTires();
List getSeats();
List getAllParts();
Continue reading...

What is Association and how it maps into a Java class?

An Association specifies how objects are related to one another.To identify associations,look for verb and prepositional phrases like 'part of','next to','works for' or 'contained in'.While identifying implicit associations,a lot common sense and general knowledge is required.It is very important to eleminate redundant associations while desiging a system.The most important aspects of associations are:
Cardinality - a cardinality of one on a given relationship end generates a Java reference, for example
public class Customer
Purchase purchase; ...
A cardinality of many (depicted as a number or *) generates a Java container:

public class Customer
List purchases; ...

Navigability - For given an instance of an object on one side of a association you can access an instance on the other side. If a association can only be traversed in one direction then this will be indicated with arrows. If there are no arrows then the association is bi-directional.

Association end - A given class only sees the association through the attributes set on the association end. In other words that simple line actually represents two independent sets of data, one for each of the two classes involved. Besides the cardinality and navigability the most important attribute is the association end name. This name is used to generate the getter and setter methods and in persistent classes database column names.

The different types of associations can be Aggregation and Composition.I will describe them in more details in next blogs to come.
Continue reading...

How to identify an Actor?

An Actor can be identified by finding an answer for following points: Who is:

-supplying information
-using information
-removing information Does system use an external resource?

A good/refined set of actors of system will be arrived iteratively.

Continue reading...

What is a Use case and an Actor?

A Usecase represents a particular scenario which corresponds to functional requirement(s) of a system to be designed and developed.An Actor is a user/external program or a system(anyone or anything), which interacts with a system.An Actor may input/receive or both(input and receive) information from the system.
In the diagram shown below, a scenario of buying bus/train/tram ticket from a vending machine is captured through a use case diagram.Here actor is a 'Customer' as shown by a stickman and in ovals all usecases have been documented.

Continue reading...

Is UML useful for procedural programming ?

Procedural programming is an unstructured way of programming which consists of set of procedures/method calls/instructions to be executed sequentially in such a way to attain the objective of a program.UML can help here in a very basic way in laying out the sequence of executions of instructions.
Continue reading...

What are different notations used in UML ?

UML predominantly includes static and dynamic model diagrams and each diagram has their own set of notations.
In brief, the classification of these diagrams is given as below: #

Structure Diagrams include the Class Diagram, Object Diagram, Component Diagram, Composite Structure Diagram, Package Diagram, and Deployment Diagram.

Behavior Diagrams include the Use Case Diagram (used by some methodologies during requirements gathering); Activity Diagram, and State Machine Diagram.

Interaction Diagrams, all derived from the more general Behavior Diagram, include the Sequence Diagram, Communication Diagram, Timing Diagram, and Interaction Overview Diagram.

Most frequently used diagrams for step by step analysis and design are: Use case,Activity,Sequence,Class
To know how do they look like,their constituents and how are they used while designing systems,please check following links:

UML Notation
UML Reference Card
Continue reading...

What is UML and how is it useful in designing large systems?

Unified Modelling Language(UML) is a notational language which comprises of several tools and techniques to support object oriented development.UML captures scenarios(use case diagram),object interactions(sequence diagram),class interactions(class diagrams) and object states(state diagrams).

UML helps in designing large and complex systems.It starts with analysis of business requirement and coming up with basic business flow chart and static diagrams i.e. use case diagrams which gives pictorial view of business requirements and captures scenarios. The next step is Interaction diagrams,which mainly consists of Sequence diagrams.A Sequence diagram tells how objects interact with each other through message passing in most importantly in what sequence.Then classes are identified of the system with various class identification approaches like 'Noun Phrase Approach','CRC Approach',this exercise results in UML class diagrams.

A modular approach helps in breaking down the complex system where each module can further be divided into components like classes and objects.Once the whole system is refined in terms of reusability of objects,omitting unnecessary objects and classes.The building of skeleton code on best practices of coding, like pattern based approach, helps in foundation of efficient code.
Continue reading...

Interview Questions On Java,Java EE Copyright © 2016. Reads: best tracker