Sei sulla pagina 1di 29

COMPUTER LABORATORY MANUAL

SOFTWARE CONSTRUCTION
(SE-312)
Spring Semester

DEPARTMENT OF COMPUTER SOFTWARE


ENGINEERING
Military College of Signals
National University of Sciences and Technology
www.mcs.nust.edu.pk
PREFACE
This lab manual has been prepared to facilitate the students of software engineering in studying
insight into working of computer systems. The obvious objective of studying computer architecture is
to learn how to design one. Writing machine dependent software such as compilers, operating
systems, and device drivers, need knowledge of possible structural and functional organization of
computer architectures. A software engineer or scientific programmer interested in high performance
studies computer architecture to learn how to design programs to gain maximum performance from a
given architecture. Working with systems that involve a variety of interfaces, equipment and
communication facilities require knowledge of computer organization.
PREPARED BY
Lab manual is prepared by Lecturer Rabia Khan and Demonstrator Kabeer Ahmed, updated by
Mehreen Ahmed under the supervision of Head of Department Dr. Adil Masood Siddiqi in year 2016.
GENERAL INSTRUCTIONS
a. Students are required to maintain the lab manual with them till the end of the semester.
b. All readings, answers to questions and illustrations must be solved on the place provided. If more
space is required then additional sheets may be attached. You may add screen print to the report by
using the ‘Print Screen’ command on your keyboard to get a snapshot of the displayed output.
c. It is the responsibility of the student to have the manual graded before deadlines as given by the
instructor
d. Loss of manual will result in re submission of the complete manual.
e. Students are required to go through the experiment before coming to the lab session. Lab session
details will be given in training schedule.
f. Students must bring the manual in each lab.
g. Keep the manual neat clean and presentable.
h. Plagiarism is strictly forbidden. No credit will be given if a lab session is plagiarised and no re
submission will be entertained.
i. Marks will be deducted for late submission.
j. In the exercises, you have to put the output in your Lab report.
k. Name your reports using the following convention:
Lab#_Rank_YourFullName
(1) ‘#’ replaces the lab number.
(2) ‘Rank’ replaces Maj/Capt/TC/NC/PC
(3) ‘YourFullName’ replaces your complete name.
l. You need to submit the report even if you have demonstrated the exercises to the lab
engineer/instructor or shown them the lab report during the lab session.
VERSION HISTORY
Date Update By Details
Lec Ayesha
July 2013 First Version Created
Naseer
Lec Ayesha
Sep 2014 Second version created. Labs improved
Naseer
Sep 2015 Kabeer Ahmed Labs improved &Updated exercises
Sep 2016 Kabeer Ahmed Labs improved &Updated exercises
Lab Engr Marium
Sept 2017 Labs added, improved &Updated exercises
Hida
March Lab Engr Marium
Labs added, improved &Updated exercises
2018 Hida
February Lab Engr Sehrish
Labs, CLO’s and lab rubrics updated
2020 Ferdous

SOFTWARE CONSTRUCTION LAB MANUAL 2


Mapping of Lab Experiments
Lab Rubrics (Group 1)
Criteria Unacceptable Substandard Adequate Proficient
(Marks=0) Marks=1 Marks=2 Marks=3
R1 The program failed to produce the right The program execution let to The program was correctly The program was correctly
Completeness accurate result inaccurate or incomplete functional and most of the functional, and all the features
and Accuracy results. It was not correctly features were implemented were implemented
functional or not all the
features were implemented

R2 Coding standards, best programming Coding standards, best Coding standards, best Coding standards, best
Coding practices are not followed. Student programming practices are programming practices are programming practices are
Standards cannot understand the code not followed rarely followed followed appropriately.

R3 Student failed to demonstrate a clear Student has basic knowledge Student has basic knowledge Student has demonstrated on
Demonstration understanding of the assigned task of understanding but asked of understanding. Answer to accurate understanding of the lab
questions were not the question are basic objective and concepts. All the
answered. questions are answered
completely and correctly

R4 The code is huge and appears to be The code is brute force and The code is fairly efficient The code is extremely efficient
Efficiency patched together. unnecessarily long without sacrificing without sacrificing readability and
readability and understanding.
understanding.

R5 The code is not organized for reusability. Some parts of the code could Most of the code could be The code could be reused as a
Reusability be reused in other programs reused in other programs. whole, or each routine could be
reused.

R6 Most part of the working program is Working program is Working program has some Working program has potential
Originality copied. uninspired and potential for making a for making a creative
straightforward work with creative contribution contribution.
little to no creative potential.
Lab Rubrics (Group 3)
Criteria Unacceptable Substandard Adequate Proficient
(Marks=0) Marks=1 Marks=2 Marks=3
R1 The system failed to produce the right The system execution let to The system was correctly The system was correctly
Completeness accurate result inaccurate or incomplete functional and most of the functional, and all the features
and Accuracy results. It was not correctly features were implemented were implemented
functional or not all the
features were implemented

R2 The student failed to demonstrate a clear The student has basic The student has moderate The student has demonstrated on
Demonstration understanding of the assigned task knowledge of understanding knowledge of understanding. accurate understanding of the lab
but asked questions were not Answer to the question are objective and concepts. All the
answered. basic questions are answered completely
and correctly

R3 Most part of the working program is Working program is Working program has some Working program has potential for
Originality copied. uninspired and potential for making a making a creative contribution.
straightforward work with creative contribution
little to no creative potential.

R4 Shows little commitment to group goals Demonstrates commitment to Demonstrates commitment to Actively helps to identify group
Contribution/ and fails to perform assigned roles group goals, but has group goals and carries out goals and works effectively to
Group difficulty performing assigned roles effectively meet them in all roles assumed
participation assigned roles

R5 Poor presentation; cannot explain topic; Presentation lacks clarity and Presentation acceptable; Well-organized, clear
Presentation scientific terminology lacking or organization; little use of adequate use of scientific presentation; good use of scientific
skills confused; lacks understanding of topic scientific terms and terms; acceptable vocabulary and terminology; good
vocabulary; poor understanding of topic understanding of topic
understanding of topic
SE-312 Software Construction
Course Learning Outcomes (CLOs)
At the end of the course the students will be able to: PLOs BT Level*
1. Explain the principles of Software construction 1 C-2
2. Apply patterns, frameworks and techniques for 2 C-3
software construction
3. Apply principles of bug-free, ready to change and 3 C-3
easy to understand software construction
4. Adapt modern tools for software construction 5 P-3

CLO MAPPING FOR LABS

S No Experiment Title CLO R-G


1 4 1
2 4 1
3 4 1
4 4 1
5 4 1
6 4 1
7 4 1
8 4 1
9 4 1
10 4 1
11 4 1
12 4 1
13 4 1
14 4 1
15 4 3
MARKS

Max. Instructor
Marks Obtained
Date Experiment Mark Sign
s R1 R2 R3 R4 R5 R6

Grand Total
CONTENTS
Experiment # 1: UML Diagrams...................................................................................................................8
Experiment # 2: Process of Creation of Detailed Design Document..........................................................12
Experiment # 3: Working with Javadoc, Java Applet.................................................................................13
Experiment # 1: UML Diagrams

Objective:
To introduce and practice the concept of different UML Diagrams.

Tool:
MS Visio /Visual Paradigm

Time:
3Hrs

Introduction:
What is Meant by UML?
UML stands for Unified Modeling Language. UML 2.0 helped extend the original UML
specification to cover a wider portion of software development efforts including agile practices.
 Improved integration between structural models like class diagrams and behavior models
like activity diagrams.
 Added the ability to define a hierarchy and decompose a software system into
components and sub-components.
 The original UML specified nine diagrams; UML 2.x brings that number up to 13. The
four new diagrams are called: communication diagram, composite structure diagram,
interaction overview diagram, and timing diagram. It also renamed state chart diagrams to
state machine diagrams, also known as state diagrams.

Types of UML Diagrams


The current UML standards call for 13 different types of diagrams: class, activity, object, use
case, sequence, package, state, component, communication, composite structure, interaction
overview, timing, and deployment.
These diagrams are organized into two distinct groups: structural diagrams and behavioral or
interaction diagrams.
Structural UML diagrams
 Class diagram
 Package diagram
 Object diagram
 Component diagram
 Composite structure diagram
 Deployment diagram
Behavioral UML diagrams
 Activity diagram
 Sequence diagram
 Use case diagram
 State diagram
 Communication diagram
 Interaction overview diagram
 Timing diagram
1. UML Use Case Diagrams
Use case diagrams are usually referred to as behavior diagrams used to describe a set of actions
(use cases) that some system or systems (subject) should or can perform in collaboration with
one or more external users of the system (actors). Each use case should provide some observable
and valuable result to the actors or other stakeholders of the system.

When to apply use case diagrams


A use case diagram doesn't go into a lot of detail—for example, don't expect it to model the order
in which steps are performed. Instead, a proper use case diagram depicts a high-level overview
of the relationship between use cases, actors, and systems. Experts recommend that use case
diagrams be used to supplement a more descriptive textual use case.

Use case diagram components


Common components include:
Actors: The users that interact with a system. An actor can be a person, an organization, or an
outside system that interacts with your application or system. They must be external objects that
produce or consume data.
System: A specific sequence of actions and interactions between actors and the system. A system
may also be referred to as a scenario.
Goals: The result of most use cases. A successful diagram should describe the activities and
variants used to reach the goal.

Use case diagram symbols and notation


The notation for a use case diagram is straightforward and doesn't involve as many types of
symbols as other UML diagrams.
 Use cases: Horizontally shaped ovals that represent the different uses that a user might
have.
 Actors: Stick figures that represent the people employing the use cases.
 Associations: A line between actors and use cases. In complex diagrams, it is important
to know which actors are associated with which use cases.
 System boundary boxes: A box that sets a system scope to use cases. All use cases
outside the box would be considered outside the scope of that system.
 Packages: A UML shape that allows you to put different elements into groups. Just as
with component diagrams, these groupings are represented as file folders.
 Relationships:
Illustrate relationships between an actor and a use case with a simple line. For
relationships among use cases, use arrows labeled either "uses" or "extends." A "uses"
relationship indicates that one use case is needed by another to perform a task. An
"extends" relationship indicates alternative options under a certain use case.

2. Sequence Diagram:
UML sequence diagrams model the flow of logic within your system in a visual manner,
enabling you both to document and validate your logic, and are commonly used for both analysis
and design purposes.
Sequence diagrams are typically used to model:
 Usage scenarios. A usage scenario is a description of a potential way your system is
used. The logic of a usage scenario may be part of a use case, perhaps an alternate
course. It may also be one entire pass through a use case, such as the logic described
by the basic course of action or a portion of the basic course of action, plus one or
more alternate scenarios. The logic of a usage scenario may also be a pass through the
logic contained in several use cases. For example, a student enrolls in the university,
and then immediately enrolls in three seminars.
 The logic of methods. Sequence diagrams can be used to explore the logic of a
complex operation, function, or procedure. One way to think of sequence diagrams,
particularly highly detailed diagrams, is as visual object code.
 The logic of services. A service is effectively a high-level method, often one that can
be invoked by a wide variety of clients. This includes web-services as well as
business transactions implemented by a variety of technologies.

o Class Diagram
Class diagrams are the main building block of any object-oriented solution. It shows the classes
in a system, attributes, and operations of each class and the relationship between each class.
In most modeling tools, a class has three parts. Name at the top, attributes in the middle
and operations or methods at the bottom. In a large system with many related classes, classes are
grouped together to create class diagrams. Different relationships between classes are shown by
different types of arrows.

o Package Diagram
As the name suggests, a package diagram shows the dependencies between different
packages in a system.
Elements
Package: a general-purpose mechanism for organizing model elements & diagrams into groups.
It provides an encapsulated namespace within which all the names must be unique. It is used to
group semantically related elements. It is a namespace as well as an element that can be
contained in other packages' namespaces.
Class: a representation of an object that reflects its structure and behavior within the system. It is
a template from which running instances are created. Classes usually describe the logical
structure of the system.
Interface: a specification of behavior. An implementation class must be written to support the
behavior of an interface class.
Object: an instance of a class. It is often used in analysis to represent an artifact or other item.
Table: a stereotyped class.

o Deployment Diagram
A deployment diagram shows the hardware of your system and the software in that hardware.
Deployment diagrams are useful when your software solution is deployed across multiple
machines with each having a unique configuration.
Exercise:

Q: Briefly explain UML Diagrams?


A UML diagram is a diagram based on the UML (Unified Modeling Language)
with the purpose of visually representing a system along with its main actors,
roles, actions, artifacts or classes, in order to better understand, alter, maintain, or
document information about the system
UML stands for Unified Modeling Language. It's an international industry standard
graphical notation used for describing, visualizing, constructing and documenting
the artifacts of a software system.
These diagrams are organized into two distinct groups: structural diagrams and
behavioral or interaction diagrams.
 Class diagram
Structural UML diagrams
 Package diagram
 Object diagram
 Component diagram
 Composite structure diagram
 Deployment diagram

Behavioral UML diagrams  Activity diagram


 Sequence diagram
 Use case diagram
 State diagram
 Communication diagram
 Interaction overview diagram
 Timing diagram
Q: Describe Purpose of each UML Model?

Behavioral UML diagrams:

1) UML Use Case Diagram

Purpose

Use case diagram is used during the analysis phase of a project to identify the
system functionality. It describes the interaction of people or external device with
the system under design. It doesn't show much detail, but only summarizes some of
the relationships between use cases, actors, and systems.

2) UML Sequence Diagram

Purpose

Sequence diagrams are used in the analysis and design phases. It's an interaction
diagram that details how operations are carried out. Sequence diagram is often
used to depict the chronologically-structured event flow through a use case. It's
good at presenting the communication relationships between objects; and what
messages trigger those communications.

3) UML Activity Diagram

Purpose

The purpose of activity diagram is to describe the procedural flow of actions as


part of a larger activity. It is used to model how activities are coordinated to
provide a service; to show the events needed to achieve some operation, and to
illustrate how the events in a single use case relate to one another.

4) UML State Diagram

Purpose

The primary purpose of a statechart diagram is to model interactive systems and


define each and every state of an object. Statechart diagrams are designed to
capture the dynamic behavior of an application system. These diagrams are used to
represent various states of a system and entities within the system.
5) UML Communication diagram

Purpose

A communication diagram is an extension of object diagram that shows the objects


along with the messages that travel from one to another. communication
diagrams are used by designers to define and clarify the roles of the objects that
perform a particular flow of events of a use case.

6) UML Interaction overview diagram

Purpose

Interaction overview diagrams focus on the overview of the flow of control where


the nodes are interactions (sd) or interaction use (ref). The other notation elements
for interaction overview diagrams are the same as for activity and
sequence diagrams. These include initial, final, decision, merge, fork and join
nodes.

7) UML Timing diagram

Purpose

Timing diagram is used to show interactions when a primary purpose of


the diagram is to reason about time; it focuses on conditions changing within and
among lifelines along a linear time axis. Timing diagram is a special form of a
sequence diagram.
Structural UML diagrams:

1) UML Component Diagram

Purpose

It allows application designers to verify that a system's required functionality is


being implemented by components, thus ensuring that the final system will be
acceptable. What's more, component diagram is useful communication tool among
stakeholders to discuss, analyze or improve a system design.

2) UML Deployment Diagram

Purpose

Deployment diagram is used to describe the hardware components used in system


implementations and the execution environments and artifacts deployed on the
hardware. It's used to visualize the hardware topology system, model physical
hardware elements and the communication relationship between them, and plan the
architecture of the system.

3) UML Package Diagram

Purpose

Package diagrams are used to organize the elements of a model. They are typically
used to depict the high-level organization of a software project. Package diagram
can show both structure and dependencies between sub-systems or modules. They
can be used to group any construct in the UML such as classes, actors, and use
cases.

4) UML Class Diagram

Purpose

A UML class diagram is not only used to describe the object and information
structures in an application, but also show the communication with its users. It
provides a wide range of usages; from modeling the static view of an application to
describing responsibilities for a system. Composition is a special type of
aggregation that denotes a strong ownership.

5) UML Composite structure diagram

Purpose
In UML models, a composite structure diagram depicts the internal structure of
structured classifiers by using parts, ports, and connectors. A structured classifier
defines the implementation of a classifier and can include a class, a component, or
a deployment node. You can use the composite structure diagram to show the
internal details of a classifier and to describe the objects and roles that work
together to perform the behavior of the containing classifier.

6) UML Object diagram

Purpose

During the analysis phase of a project, you might create a class diagram to describe
the structure of a system and then create a set of object diagrams as test cases
to.verify the accuracy and completeness of the class diagram.Object diagrams are
used to render a set of objects and their relationships as an instance.

Q: Explain When to design which particular UML Diagram based upon given scenario?

Web Resources:
https://www.uml-diagrams.org
https://www.lucidchart.com
https://www.smartdraw.com/uml-diagram/
https://www.uml-diagrams.org
https://www.lucidchart.com
https://www.smartdraw.com/uml-diagram/
Experiment # 2: Process of Creation of Detailed Design Document

Objective:
To introduce and practice creation of detailed design document.

Tool:
MS Visio/Visual Paradigm

Time:
3Hrs

Detailed Design Document


A software design description or SDD or Software Design Specification, is a written description
of a software product, that a software designer writes in order to give a software development
team overall guidance to the architecture of the software project.

Purpose of A Design Document


The purpose of the Software Design Document is to provide a description of the design of a
system fully enough to allow for software development to proceed with an understanding of what
is to be built and how it is expected to build.

Importance of Design Document


A design document is quite simply an effective way for you to communicate to others who may
be interested in your product, what your design decisions are and why your decisions are worthy
and reasonable decisions.

EXERCISE:
Q: Consider any Software Detailed Design Document and explain process of creation of detailed
design document with the help of flow chart?
Web Resources:
https://en.wikipedia.org/wiki/Software_design_description
https://www.google.com/search?
q=Detailed+Design+Document&tbm=isch&source=univ&sa=X&ved=2ahUKEwjlrpHeqO7nAhXIKewKHZys
CTcQsAR6BAgJEAE

https://www.projectmanagementdocs.com/template/project-documents/system-design-document/

Experiment # 3: Working with Javadoc, Java Applet

Objective:
To introduce and practice java doc and java Applets

Tool:
Cmd, JDK, Java Applet Viewer

Time:
3Hrs
General (for all OS)
In DOS command prompt do followings to set the environment for java

 Set CLASSPATH=%CLASSPATH%; C:\Program Files\Java\jdk-13.0.2\lib;.;


 Set Path=%path%; C:\Program Files\Java\jdk-13.0.2\bin;
 Type Set & enter, this should print all the environment variables and check your setting of
Classpath & Path.

Win 2000 or Later versions


Set Environment variables
o Double click on the system icon in the control panel.
o On the advance tab press Environment variables button
o Under system variables find path and press edit
o At the end of the path string add “C:\Program Files\Java\jdk13.0.2\bin;”
o Press new and enter variable name:” CLASSPATH” (if not already existed) and variable value:”
C:\Program Files\Java\jdk1.5.0\bin;”
o

JAR Files
Unzip scr.zip which will open up the source code of all packages (which collectively called java API)
rt.jar in ..\jdk1.5.0\jre\lib contains all the class files for respecting source files in scr.zip. Unjar this file
and compare.
Similar:

1. We have java,javax,org,sunw and com same in both

Differences:

1. The main difference if that in src we have files with .java extension
Whereas in rt we have files with .java extension
2. We have META-INF folder in jre which has a file with .MF extension

3. We have a Launcher in src which have C Header file

4. We have bytecode in jre.


 Src does not contain META-INF and sun whereas rt does.

SRC RT
Com folder contains sun Com contains oracle and sun
Has .java files Rt has .class files
Has a launcher folder Does not have a launcher folder
Has 12 files in com/sun Has 27 files in com/sun
- Org has jcp an extra folder

Create Documentation

1 – Make directory c:\home\html

2- Copy jdk folder from C drive and paste it in your current directory
3- Open jdk folder and goto Bin
4- Create a file Hello.java having “Hello world java code “in Bin folder
5- run the following command to create documentation using javadoc utility.
Working dir>javadoc hello.java

6- Observe what happened after executing above command

Javadoc is a command-line tool for extracting special comments (called doc comments) from java
source files and generating an easy-to-use HTML file tree containing them. Doc comments begin with
/** and immediately precede a class, interface, constructor, method, or field definition are extracted
and processed

HTML File:
Create Your own package

1 – Add statement “package APC.lab1;” as first line of your code


2 – Compile with javac –d. yourProgram.java
3 – This will create your yourProgram.class file in the <workingDir>\ APC\lab1
4 – Make a class to call yourProgram from step3
5 – create a jar file by following command
jar cf myapi.jar. C:\home\html\jdk-13.0.2\bin\APC\lab1\HelloPrg.class
// bold text is the path where your class file exists; gives that path in above command
6 – Add this jar file in the lib folder of classpath and change the class path
(CLASSPATH= C:\Program Files \ Java \ jdk1.5.0 \ lib \ myapi . jar; ;)
7 –Your API is added in the classpath and now you are able to make your program calling your own api
from the lib folder.

Java Application

1 – Write a simple Application to show a message “Hello world”


2 – Write an application using swing package to accept two integers from the user and display a result of

addition of input integers.

3 – Try a program with


o System.exit(0);
o System.exit(1);
Explain the differences in the two tried exercises.
For Compilation:
1- Goto your working directory.
2- Compile your application by command javac filename.java
3- Execute your application by command java filename

Java Applet

1 – Write a simple applet displaying “Hello world” with import java.applet.Applet;


2 – Write a simple applet displaying “Hello world” with import java.swing.JApplet;
Note (for 1 & 2):
Run the both applets with appletviewer and Internet browsers.
3 – Write an applet to show the addition of two integers entered by user.

Web Resources:
http://www.skylit.com/javamethods/faqs/createjar.html
https://docs.oracle.com/javase/tutorial/deployment/jar/build.html

https://www.thoughtco.com/building-your-first-java-applet-2034332

Potrebbero piacerti anche