9788189086732 Flipbook PDF


10 downloads 115 Views 1MB Size

Recommend Stories


Porque. PDF Created with deskpdf PDF Writer - Trial ::
Porque tu hogar empieza desde adentro. www.avilainteriores.com PDF Created with deskPDF PDF Writer - Trial :: http://www.docudesk.com Avila Interi

EMPRESAS HEADHUNTERS CHILE PDF
Get Instant Access to eBook Empresas Headhunters Chile PDF at Our Huge Library EMPRESAS HEADHUNTERS CHILE PDF ==> Download: EMPRESAS HEADHUNTERS CHIL

Story Transcript

AND

OBJECT ORIENTED ANALYSIS DESIGN

OBJECT ORIENTED ANALYSIS AND DESIGN MCS-032 For Master In Computer Applications [MCA] Dinesh Verma MCA, BCA, ‘A’ & ‘O’ Level, SCJP(USA), JP

Prof. S.Roy MCA, B.SC., DECM, DCPA, DECOM Academic Consultant - Indira Gandhi National Open University Visiting Faculty - Punjab Technical University Guest Lecturer - Delhi College, Delhi University Academic Counsellor - IGNOU, ST. Xavier’s College, Kolkata

Useful For IGNOU, KSOU (Karnataka), Bihar University (Muzaffarpur), Nalanda University, Jamia Millia Islamia, Vardhman Mahaveer Open University (Kota), Uttarakhand Open University, Kurukshetra University, Himachal Pradesh University, Seva Sadan’s College of Education (Maharashtra), Lalit Narayan Mithila University, Andhra University, Pt. Sunderlal Sharma (Open) University (Bilaspur), Annamalai University, Bangalore University, Bharathiar University, Bharathidasan University, Centre for distance and open learning, Kakatiya University (Andhra Pradesh), KOU (Rajasthan), MPBOU (MP), MDU (Haryana), Punjab University, Tamilnadu Open University, Sri Padmavati Mahila Visvavidyalayam (Andhra Pradesh), Sri Venkateswara University (Andhra Pradesh), UCSDE (Kerala), University of Jammu, YCMOU, Rajasthan University, UPRTOU, Kalyani University, Banaras Hindu University (BHU) and all other Indian Universities.

Closer to Nature

We use Recycled Paper

GULLYBABA PUBLISHING HOUSE PVT. LTD. ISO 9001 & ISO 14001 CERTIFIED CO.

Published by:

GullyBaba Publishing House Pvt. Ltd. Regd. Office:

Branch Office:

2525/193, 1 st Floor, Onkar Nagar-A, Tri Nagar, Delhi-110035 (From Kanhaiya Nagar Metro Station Towards Old Bus Stand) Ph. 011-27387998, 27384836, 27385249

1A/2A, 20, Hari Sadan, Ansari Road, Daryaganj, New Delhi-110002 Ph. 011-23289034 011-45794768

E-mail: [email protected], Website: GullyBaba.com

New Edition Price: `330/ISBN: 978-81-89086-73-2 Copyright© with Publisher

All rights are reserved. No part of this publication may be reproduced or stored in a retrieval system or transmitted in any form or by any means; electronic, mechanical, photocopying, recording or otherwise, without the written permission of the copyright holder. Disclaimer: This book is based on syllabus of IGNOU. This is only a sample. The book/author/publisher does not impose any guarantee or claim for full marks or to be pass in exam. You are advised only to understand the contents with the help of this book and answer in your words. Gullybaba Publishing House Pvt. Ltd. is not connected to any university/board/institution in any way. All disputes with respect to this publication shall be subject to the jurisdiction of the Courts, Tribunals and Forums of New Delhi, India only.

Free Home Delivery of GPH Books You can get GPH books by VPP/COD/Speed Post/Courier. You can order books by Email/SMS/WhatsApp/Call. For more details, visit gullybaba.com/faq-books.html Note : Selling this book on any online platform like Amazon, Flipkart, Shopclues, Rediff, etc. without prior written permission of the publisher is prohibited and hence any sales by the SELLER will be termed as ILLEGAL SALE of GPH Books which will attract strict legal action against the offender.

Preface This book is mainly targeted for MCA (New Course), M.Sc.(CS), MIT etc. exam of Object Oriented Analysis and Design for all Open Universities including Indira Gandhi, MJPR University(U.P.). It has been introduced in market after seeing the huge demand of ready to grasp material for exams with high level of quality, and its un-availability in market. We the GullyBaba Publishing House took a step ahead to publish the quality material focusing on exams at the same time giving you indepth knowledge about the subject. GPH Book is the pioneer effort that provides a unique methodology so as to perform better in exams. If your goal is to attain higher grade use this powerful study tool independently or along with your text. On the Web : www.gullybaba.com is the vital resource for your exams acting as catalyst to boost up your preparation. Now you can access us on the net through www.doctorignou.com, www.doeacconline.com, www.ignouonline.com, and www.astrologyeverywhere.com. Feedback about the book can be sent at [email protected]. Acknowledgments : We appreciate the staff and facility support provided by GullyBaba Publishing House. In particular, we appreciate the encouragement and professional advises received from Mr. Ajay Saini, Mr. Tarun Sharma, H. Faheem Ahmed, Mr Pawan Kumar Goel, Ms. Pooja, Ms. Dr. Anshika Gupta, Mr. R.K. Yadav, Ms. Ruchi Wadhawan, Ms. Priyanka Gupta, Mrs. Meera Vyas, Mr. Arvind Vyas, Mr. Abhimanyu Tuteja, Mr. Bakshish Bhatia, Mr. Ashok Singhal, Mr. J.P Singh, Ms Seema Bhatia and many more. Also we would like to thank Gullybaba team Mrs. Bhawna Verma, Mr. Kamal Jigyasu, Mr. Bal Kishan, Mr. Mohit Garg, Mr. Mukesh, Mr. Vijay, and Mr. Rajender Gupta. We gratefully acknowledges the significant contributions of Mr. Mahesh Chand, Mrs. Bimla Devi, Mrs. Bhawna Verma and our experts in bringing out this publication. New Delhi

Contents Chapter-1

Basic philosophy of object orientation & characteristics object oriented modeling Chapter-2 Object Oriented Analysis Chapter-3 UML Chapter-4 Object Oriented Design Chapter-5 Advanced Object Modeling Chapter-6 Dynamic Modeling Chapter-7 Functional Modeling Chapter-8 Implementation Strategies Chapter-9 Object Mapping with Database Chapter-10 OMT Notation Some Important Questions

1-17 18-27 28-45 46-61 62-76 77-87 88-98 99-107 108-116 117-121 122-158

Question Papers (1) June-2006 (Solved) (2) Dec-2006 (Solved) (3) June-2007 (Solved) (4) Dec-2007 (Solved) (5) June-2008 (Solved) (6) Dec-2008 (Solved) (7) June-2009 (Solved) (8) Dec-2009 (Solved) (9) June-2010 (Solved) (10) Dec-2010 (Solved) (11) June-2011 (Solved) (12) Dec-2011 (Solved) (13) June-2012 (Solved) (14) Dec-2012 (Solved) (15) June-2013 (16) Dec-2013 (17) June-2014 (18) Dec-2014 (19) June-2015 (20) Dec-2015 (21) June-2016 (22) Dec-2016 (Solved) (23) June-2017 (24) Dec-2017 (25) June-2018 (Solved)

160-177 178-198 199-213 214-221 223-229 230-238 239-246 247-254 255-260 261-266 267-272 273-278 279-285 286-297 298-299 300-301 302-303 304-305 306-307 308-309 310-311 312-318 319-319 320-320 321-324

CHAPTER-1 BASIC PHILOSOPHY OF OBJECT ORIENTATION & CHARACTERISTICS OBJECT ORIENTED MODELING OBJECT ORIENTED IMPLICATION : The term ‘object-oriented’ stands for the organisation of software as a collection of discrete objects that incorporate both data structure and behaviour. This is in contrast to conventional programming in which data structure and behaviour are only loosely connected. There is some dispute about exactly what characteristics are required by an object-oriented approach, but they generally include four aspects : identity, classification, polymorphism and inheritance. Q1. What is OOM? List different steps involved in OOM process. [Dec-06, Q1(a)] Ans. Object oriented modeling is entirely a new way of thinking about problems. This methodology is all about visualizing the things by using models organized around real world concepts. Object oriented models help in understanding problems, communicating with experts from a distance, modeling enterprises, and designing programs and database developing a model for a software system, prior to its development or transformation, is as essential as having a blueprint for large building essential for its construction. Object oriented models are represented by diagrams. A good model always helps communication among project teams, and to assure architectural soundness. It is important to note that with the increasing complexity of systems, importance of modeling techniques increases. Because of its characteristics, Object Oriented Modeling is a suitable modeling technique for handling a complex system. OOM basically is building a model of an application, which includes implementation details of the system, during design of the system. As you know, any system development refers to the initial portion of the software life cycle: analysis, design, and implementation. During object oriented modeling identification and organization of application with respect to its domain

2

GullyBaba Publishing House

is done, rather than their final representation in any specific programming language. We can say that OOM is not language specific. Once modeling is done for an application, it can be implemented in any suitable programming language available. In OOM the modeling passes through the following processes: x System Analysis x System Design x Object Design, and x Final Implementation. System Analysis: In this stage a statement of the problem is formulated and a model is build by the analyst in encouraging real-world situation. This phrase show the important properties associated with the situation. Actually, the analysis model is a concise, precise abstraction and agreement on how the desired system must be developed. You can say that, here the objectives is to provide a model that can be understood and criticized by any application experts in the area whether the expert is a programmer or not. System Design: At this stage, the complete system architecture is designed. This is the stage where the whole system is divided into subsystems, based on both the system analysis model and the proposed architecture of the system. Object Design: At this stage, a design model is developed based on the analysis model which is already developed in the earlier phase of development. The object design decides the data structures and algorithms needed to implement each of the classes in the system with the help of implementation details given in the analysis model. Final Implementation: At this stage, the final implementation of classes and relationships developed during object design takes place a particular programming language, database, or hardware implementation (if needed). Actual implementation should be done using software engineering practice. This helps to develop a flexible and extensible system. Q2. What are the models used by OOM? Ans. The Models There are various models used during in different stages of OMT : (i) The object model describes the static structure of the objects in a system and their relationships. The object model contains object diagrams. An object diagram is a graph whose nodes are object classes and whose arcs are www.AstrologyEverywhere.com

MCS-32 GPH BOOK

3

relationships among classes. (ii) The dynamic model describes the aspects of a system that change over time. The dynamic model is used to specify and implement the control aspects of a system. The dynamic model contains state diagrams. A state diagram is a graph whose nodes are states and whose arcs and transitions between states caused by events. (iii) The functional model describes the data value transformations within a system. The functional model contains data flow diagrams. A data flow diagram represents a computation. A data flow diagram is a graph whose nodes are processes and whose arcs are data flows. Q3. What are the basic characteristics around which OOM systems are developed? Ans. (1) Abstraction Abstraction is restricted examination of certain aspects of a problem. Here abstract view of the problem is given to user after hiding tedious details. User define data type is called Abstract Data and the process of defining this type of data is called Data Abstraction. struct, typedef and class are three ways, through which the user can define its data type. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and functions to operate on these attributes. They encapsulate all the essential properties of the objects that are to be created. Since the classes use the concept of data abstraction, they are known as Abstract Data Types (ADT). Data Abstraction means hiding tedious details about data from the user, and providing only the abstract view, which makes the understanding very much clear. e.g. int a; float b; A class uses above definitions to define data without concerning the user about how integers or decimals are stored/handled in memory. (2) Encapsulation Encapsulation, or information hiding, is the feature of separating the external aspects of an object, from the internal implementation details of that object. It helps in hiding the actual implementation of characteristics of objects. You can say that encapsulation is hiding part of implementation that do internal things, and these hidden parts are not concerned to outside world. Encapsulation enables you to combine data structure and behaviour in a single entity. Encapsulation helps in system enhancement. If there is a need to change the www.ProfitByStock.com

4

GullyBaba Publishing House

implementation of object without affecting its external nature, encapsulation is of great help. (3) Polymorphism Using operators and functions in different ways depending upon what they are operated upon. In simple form, we can define polymorphism as ‘one name, multiple forms’. It means that the same operations may behave differently on different classes. For programming languages, polymorphism means that some code or operations or objects behave differently in different contexts. Two basic types of polymorphism are : (1) Compile time polymorphism, and (2) Run-time polymorphism. (1) Compile-time polymorphism : A specific matching form can be found at time of compiling, is known as compile time polymorphism. Function overloading is an example of compile -time polymorphism. (2) Run-time polymorphism : A specific matching form can be found at time of execution, is known as run time polymorphism. Function overriding is an example of runtime polymorphism. It is dynamic in nature as compared to compile time polymorphism. (B) OVERLOADING When an existing operator is given capability to operate on new data type it is said to be overloaded. Overloading allows a function or operation to be given more than one definition. The types of the arguments with which the function or operator is called, determine which definition to be used. There are two types of overloading : (i) Function Overloading : In this, single function name can be used to handle different number and different types of argument. This is something like, particular word having different meaning depending on the context. Using a single function to perform different types of class is called function overloading. (ii) Operator Overloading : Operator overloading provides a flexible option for the creation of new definitions & for most of the C++ operators. We can create almost a new language by the creative use of the function and operator overloading technique. We can overload all the C++ operator except the following : x Class member access operators (.,.*) www.AstrologyEverywhere.com

MCS-32 GPH BOOK

5

x Scope resolution operator ( : :) x Size of operator (sizeof) x Conditional operator (? :) (4) Sharing of Structure and Behaviour One of the reasons for the popularity of object-oriented techniques is that they encourage sharing at different levels. Inheritance of both data structure and behaviour allows common structure (base class) to be used in designing many subclasses based on basic characteristics of base class, and develop new classes with less effort. Inheritance is one of the main advantages of any object oriented language, because it gives scope to share basic code. In a broader way we can say that object oriented development not only allows information sharing and reuse within an application, but also, it gives a base for project enhancement in future. As and when there is a need for adding new characteristics in the system, they can be added as an extension of existing basic features. This can be done by using inheritance, and that too, without major modification in the existing code. But be aware that just by using object orientation you do not get a license to ensure reusability and enhancement. For ensuring reusability and enhancement you have to have a more general design of the system. This type of design can be developed only if the system is properly studied and features of proposed system are explored. Emphasis on Object Structure, not on Operation Implementation In object orientation the major emphasis is on specifying the characteristics of the objects in a system, rather than implementing these characteristics. The uses of an object depend highly on the facts of the application and regular changes during development. As requirements extend, the features supplied by an object are much more stable than the ways in which they are used, hence software systems built on object structure are more secure. While developing a system using the object oriented approach, main emphasis is on the essential properties of the objects involved in the system than on the procedure structure to be used for implementation. During this process what an object is, and its role in system is deeply thought about. Q4. What are the characteristics of OOM? Ans. (1) Objects www.ProfitByStock.com

[Dec-06, Q1(d)]

6

GullyBaba Publishing House

We define an object as a concept, abstraction or thing with crisp boundaries and meaning for the problem at hand. Objects serve two purposes : They promote understanding of the real world and provide a practical basis for computer implementation. Decomposition of a problem into objects depends on judgment and the nature of the problem. When you approach a programming problem in an object-oriented language you are no longer ask how the problem will be divided into functions, but how it will be divided into object. Thinking in terms of object, rather than functions has a surprisingly helpful effect on how easily programs can be designed. This results from the close match between objects in the programming sense and objects in the real world. What kinds of things become objects in object-oriented programs? The answer to this is limited only by your imagination, but below are some examples : Physical objects Automobiles in a traffic-flow simulation Electrical components in a circuit-design program Countries in an economics model Aircraft in an-traffic-control system Elements of the computer-user environment The mouse and the keyboard Windows Menus Graphics object (lines, rectangles, circles) The match between programming objects and real-world object is the happy results of combining data and functions: The resulting objects offer a revolution in program design. No such close match between programing constructs and the items being modeled exists in a procedural language. (2) Classes An object class describes a group of objects with similar properties (attributes), common behaviour (operations), common relationships to other objects and common semantics. Person, company, animal, process and window are all object classes. Each person has an age, IQ and many work at a job. Each process has an owner, priority and list of required resources. Objects and object classes often appear as nouns in problem descriptions. In OOP we say that objects are members of classes. What does this mean? Let’s look at an analogy. Almost all computer languages have built-in data www.AstrologyEverywhere.com

MCS-32 GPH BOOK

7

types. For instance a data type int. Meaning integer, is predefined in C++ . You can declare as many variables of types int as you need in your program: int marks; int no_of_assignments; int no_of_papers; In a similar way you can make objects of the same class, as shown in the following figure.

A class serves as a plan, or template. It specifies what data and what functions will be included in object of that class. Defining the class doesn’t create any abject, just as the mere existence of a type int doesn’t create any variables. A class is thus a collection of similar objects. It can be understood as an architectural drawing of a building by using it we can create many buildings with different color, size, and shape etc. but it is not a building itself. Here all buildings made are the objects and architectural drawing is a class. www.ProfitByStock.com

8

GullyBaba Publishing House

Links and Association : Links and associated are the means for establishing relationships among objects and classes. Generally, a link is a physical connection between objects, a link is an ordered list of object instances or a list is an instance of an association. An association describes a group of links with common structure and semantics. All the links in an association connect objects from the same classes. Associations are inherently bi-directional. The links shows a relationship between two or more objects. All connections among classes should therefore be modeled as associations as all the relational databases are built on the concept of associations are often implemented as pointers from one object to another. A pointer is an attribute in one object that contains an explicit reference to another object. In simple terms, we can say that a link is a relationship between objects or instances while the association is a relationship among different classes. Both either it may be link or association may have same name of relationship as works for or Has-capital are same name of relationships.

These both are shown by a single Line between or among objects and classes. Associations may be binary, ternary, or higher order Higher order associations are more complicated to draw, implement, and think. Generally, www.AstrologyEverywhere.com

MCS-32 GPH BOOK

9

ternary and n-ary associations is a diamond with lines connecting to related classes:

Multiple Association : Here we see multiple associations shown by a black solid ball that resembles the means is more than 2 line (2+) or multiple lines may intersect each other at more than one point. It is an example of many-to-many association. It may also be shown by link.

The hollow ball shows zero or one multiplicity while solid ball shows zero or many multiplicity, we can also assign numbers with dash, plus or commas to fell the order of multiplicity as: 1, 1+, “3-5”, “2, 4, 18” etc. that tells about as only “one”, “one or more”, “Three to five” and “two, four, eighteen”.

Zero-or multiplicity. Multiplicity of associations depends upon the assumptions. Below, given an example of ternary association as:

www.ProfitByStock.com

10

GullyBaba Publishing House

Aggregation : Aggregation is a special form of association, which models the “part-whole” or “a-part-of” relationship as an aggregate (the whole) and parts. The most considerable property of aggregation is transitivity, that is, if X is part of Y and Y is part of Z, then X is part of Z. Aggregation is seen as a relationship in which an assembly class is related to component class. In this component objects are not having separate existence, they depend on composite objects as you can see in Figure Exam Schedule is not having separate existence.

Association and whole-part relationship Generalization : www.AstrologyEverywhere.com

" Good Preparation and Good Score in Short Time"

Also Available MCS-011 : Problem Solving and Programming MCS-012 : Computer Organization and ALP MCS-013 : Discrete Mathematics MCS-014 : Systems Analysis and Design MCS-015 : Communication Skills MCSL-017 BCSL-021,022:C & Assembly Language Programming (Lab Manual) MCS-021: Data and File Structures and Programming MCS-022: Operating System Concepts and Networking Management MCS-023: Intro. to Database Management Systems MCS-024: Object Oriented Technologies and Java Prog. MCS-031 : Design and Analysis of Algorithms MCS-032 : Object Oriented Analysis and Design MCS-033 : Advanced Discrete Mathematics MCS-034 : Software Engineering MCS-035 : Accountancy and Financial Management MCS-041 : Operating System MCS-042 : Data Communication & Computer Networks MCS-043 : Advanced DBMS MCS-051 : Advanced Internet Technologies MCS-052 : Principles of Management & Information Systems MCS-053 : Computer Graphics and Multimedia

MCSE-003 : Artificial Intelligence and Knowledge Management MCSE-004 : Numerical and Statistical Computing MCSE-011 : Parallel Computing

ISBN 978-81-89086-73-2

Get in touch

Social

© Copyright 2013 - 2024 MYDOKUMENT.COM - All rights reserved.