software design manual 2013
DESCRIPTION
Software Design Manual For VTU MCA student of the 2010 Pattern.TRANSCRIPT
10MCA56 Software Design Laboratory 1RN11MCA01
10MCA56 Software Design Laboratory 1RN11MCA01
Choose Workspace folder
Select Workbench
Set Modeling
Creating a New UML Project
Enter the Project Name and Click Next
Select Blank Model, give Proper name and Click Finish
Created UML Project details displayed on Project Explorer
To Find Pattern Explorer
Search for pattern Select Pattern ExplorerClick OK
Creating Pattern InstanceSelect the required pattern from Pattern Explorer
Drag and drop on model Main screen
Pass the arguments
Create Class DiagramRight click on Model -> Select Add Diagram -> Select Class Diagram
Drag & drop the arguments created for Pattern instance on Class diagram
Pass the required Attributes and Operations
Transformation from UML to JavaGo to Modeling -> Select Transform -> New Configuration
Give a name for Transformation file and select transformation UML to Java V5.0Click Next
Select the UML model to transformClick on Create New Target Container
Give name to Target Java Project and Click Finish
Uncheck the Check box Generate getter and settersClick Finish
Right click on Transformation file and Select Transform UML to Java V5.0
Define the methods in Java classes generated and make it as executable code by adding a class with main() method.Right click on Class with main( ) method Select Run As -> Java Application
Check the Output on Console
Creating Use-case Diagram
Creating Sequence Diagram
Creating Activity Diagram
Creating Component Diagram
Reverse Transformation (Java to UML)Create a Java Project
Give name for Java Project and Click Finish
Right Click on Java project -> Select New -> Select Package
Give the package name and Click Finish
Right click on package Select New -> Select Class
Give name for Class and Click Finish
Define the class created
To create a Class with main() methodRight click on package Select New -> Select Class
Give name for Class, select the Check box public static void main(String[] args) and Click Finish
Define the methods in classes created.To Transform from Java to UMLGo to Modeling -> Select Transform -> New Configuration
Give a name for Transformation file and select transformation Java to UML.
Select Java project as Source and Click on Create New Target Container
Select Standard template and Click Next Select Blank Model and Container folder and Click Finish
Publisher Subscriber design patternContext: A component uses data or information provided by another component. Problem: Changing the internal state of a component may introduce inconsistencies between cooperating components. Two forces associated with this problem are: The components should be loosely coupled. The components that are depends on the information provider are not known a priori. Solution: Implement a Change-Propagation mechanism between the information provider Subject and the components dependent on it observers. Observers can dynamically register or unregister with this mechanism.Whenever the subject changes its state, changes are propagated by invoking a special update ( ) function common to all observers.Pattern Instance
Class diagram
Use Case Diagram
Sequence Diagram
Activity diagram
ImplementationMclass.javapublic class Mclass{public static void main(String[] args) {Furnace fr=new Furnace();CurrentTemp ct=new CurrentTemp();DisplayTemp dt=new DisplayTemp();fr.addObserver(ct);fr.addObserver(dt);fr.setTemp(56);fr.setTemp(6);}}
Furnace.javaimport java.util.Observable;
public class Furnace extends Observable {public int temp;public void setTemp(int a) {temp=a;setChanged();notifyObservers(temp);}}
CurrentTemp.javaimport java.util.Observable;import java.util.Observer;
public class CurrentTemp implements Observer {public void update(Observable o, Object arg) {int t=(Integer)arg;System.out.println("The current temperature is "+t);}}
DisplayTemp.javaimport java.util.Observable;import java.util.Observer;
public class DisplayTemp implements Observer{public void update(Observable o, Object arg) {int t=(Integer)arg;if(t>35)System.out.println("Temperature is High");else if(t