Assignments1 with Answers
Assignments1 with Answers
OR
Answer
Encapsulation (also information hiding) separates the external aspects of an
object, that are accessible to other objects, from the internal implementation
details, that are hidden from other objects. Encapsulation prevents portions of
a program from becoming so interdependent that a small change has massive
ripple effects.
Objects restrict the visibility of their resources (attributes and methods) to other
users. Every object has an interface, which determines how other objects can
interact with it. The implementation of the object is encapsulated, that is,
invisible outside the object itself. Consider a real-life example of encapsulation,
in a company, there are different sections like the accounts section, finance
section, sales section etc.
The object-oriented concept of message passing helps to encapsulate the
implementation of an object, including its data as other parts of a system only
see an object's interface (services it can perform and operation signatures).
Internal details including data are hidden and can only be accessed by a
message that contains a valid signature.
Ques 10 Write short note on information hiding.
Answer:same as above
Answer
The object modeling techniques is an methodology of object oriented analysis,
design and implementation that focuses on creating a model of objects from
the real world and then to use this model to develop object–oriented software.
object modeling technique, OMT was developed by James Rambaugh. Now-
a-days, OMT is one of the most popular object oriented development
techniques. It is primarily used by system and software developers to support
full life cycle development while targeting object oriented implementations.
OMT has proven itself easy to understand, to draw and to use. It is very
successful in many application domains: telecommunication, transportation,
compilers etc. The popular object modeling technique are used in many real
world problems. The object-oriented paradigm using the OMT spans the entire
development cycle, so there is no need to transform one type of model to
another.
Phase of OMT
The OMT methodology covers the full software development life cycle. The
methodology has the following phase.
o To increase flexibility.
o To make amendments easily.
o For the design traceability.
o To increase efficiency.
OR
OR
Answer
Procedural based Programming Object Oriented Programming
OR
Answer
Object-oriented technology (OOT) is a software design model in which
objects contain both data and the instructions that work on the data. It is
increasingly deployed in distributed computing.
Pros of object oriented technology:
1. It allows for parallel development.
If you’re working with programming teams, then each can work independently
of one another once the modular classes have been worked out. That allows
for a relative level of parallel development that wouldn’t be available
otherwise.
2. The modular classes are often reusable.
Once the modular classes have been created, they can often be used again in
other applications or projects. At times, little-to-no modification is necessary
for the next project as well. That gives a team more flexibility once they get
beyond the initial start-up phase.
3. The coding is easier to maintain.
With OOT, because your coding base has been centralized, it is easier to
create a maintainable procedure code. That makes it easier to keep your data
accessible when it becomes necessary to perform an upgrade. This process
also improves the security of the programming since high levels of validation
are often required.
Cons of object oriented technology:
1. It can be inefficient.
Object-oriented Technology tends to use more CPU than alternative options.
That can make it be an inefficient choice when there are technical limitations
involved due to the size that it can end up being. Because of the duplication
involved, the first-time coding can be more extensive than other options as
well.
2. It can be too scalable.
If OOT is left to run out of control, then it can create a massive amount of
bloated, unnecessary code. When that occurs, the overhead rises and that
makes it difficult to keep costs down.
3. It can cause duplication.
OOT projects tend to be easier to design than implement. That is because the
modular classes are so flexible in their application. You may be able to get
new projects up and running at a greater speed, but that comes at the cost of
having projects sometimes feel like they’ve been cloned.
Ques 8 What do you understand by object identity? Explain with an
example.
Answer
Object Identity means that data is quantized into discrete, distinguishable
entities called objects.
Object identity is a fundamental object orientation concept. With object
identity, objects can contain or refer to other objects. Identity is a property of
an object that distinguishes the object from all other objects in the application.
There are many techniques for identifying objects in programming languages,
databases and operating systems ,the most commonly used technique for
identifying objects is user-defined names for objects.
Object identity is a property of data that is created in the context of an
object data model, where an object is assigned a unique internal object
identifier, or OID. The object identifier is used to define associations between
objects and to support retrieval and comparison of object-oriented data based
on the internal identifier rather than the attribute values of an object.
• Operations and data structures are fully defined along with any internal
objects needed for implementation.
• Class level associations are determined.
• Issues of inheritance, aggregation, association and default values are
checked.
4.Implementation - Implementation phase of the OMT is a matter of
translating the design into a programming language construct. It is important
to have good software engineering practice so that the design phase is
smoothly translated into the implementation phase. Thus while selecting
programming language all constructs should be kept in mind for following
noteworthy points.
• To increase flexibility.
• To make amendments easily.
• For the design traceability.
• To increase efficiency.
Ques 5 Differentiate between structured approach and object-
oriented approach.
Answer
Structured Approach Object Oriented Approach
It shows a clear transition from design Not so clear transition from design to
to implementation. implementation.
Give the conceptual model of UML. use some example to illustrate the
model in detail using diagram.
Answer
UML, short for Unified Modeling Language, is a standardized modeling
language consisting of an integrated set of diagrams, developed to help
system and software developers for specifying, visualizing, constructing, and
documenting the artifacts of software systems, as well as for business
modeling and other non-software systems. The UML represents a collection of
best engineering practices that have proven successful in the modeling of
large and complex systems. The UML is a very important part of developing
object oriented software and the software development process. The UML
uses mostly graphical notations to express the design of software projects.
Using the UML helps project teams communicate, explore potential designs,
and validate the architectural design of the software. In this article, we will give
you detailed ideas about what is UML, the history of UML and a description of
each UML diagram type, along with UML examples.
Three Aspects of UML:
• It is a representation of a subject.
• It captures a set of ideas (known as abstractions) about its subject.
3. Unified:
These things are the basic object-oriented building blocks of the UML. You
use them to write well-formed models.
Relationships:
There are 4 kinds of relationships in the UML:
1. Dependency
2. Association
3. Generalization
4. Realization
These relationships are the basic relational building blocks of the UML.
Diagrams:
It is the graphical presentation of a set of elements. It is rendered as a
connected graph of vertices (things) and arcs (relationships).
1. Class diagram
2. Object diagram
3. Use case diagram
4. Sequence diagram
5. Collaboration diagram
6. Statechart diagram
7. Activity diagram
8. Component diagram
9. Deployment diagram
Rules:
The UML has a number of rules that specify what a well-formed model should
look like. A well-formed model is one that is semantically self-consistent and in
harmony with all its related models.
The UML has semantic rules for:
Common Mechanisms:
The UML is made simpler by the four common mechanisms. They are as
follows:
1. Specifications
2. Adornments
3. Common divisions
4. Extensibility mechanisms
Answer
Advantages of UML
• One disadvantage some developers might find when using UML is the
time it takes to manage and maintain UML diagrams. To work properly,
UML diagrams must be synchronized with the software code, which
requires time to set up and maintain
• UML places much emphasis on design, which can be problematic for
some developers and companies.
• You can't represent every condition in sequence diagram
• Complex to learn and requires time to master completely
• UML software costs money
Answer
Do we really need UML?
OR
Answer
1. The choice of model is important
The choice of what models to create has a profound influence on how a
problem is attacked and how a solution is shaped. We need to choose your
models well.
• The right models will highlight the most critical development problems.
• Wrong models will mislead you, causing you to focus on irrelevant
issues.
For Example: We can use different types of diagrams for different phases in
software development.
2. Every model may be expressed at different levels of precision
For Example,
• If you are building a high rise, sometimes you need a 30,000-foot view
for instance, to help your investors visualize its look and feel.
• Other times, you need to get down to the level of the studs for instance,
when there's a tricky pipe run or an unusual structural element.
3. The best models are connected to reality
All models simplify reality and a good model reflects important key
characteristics.
4. No single model is sufficient
Every non-trivial system is best approached through a small set of nearly
independent models. Create models that can be built and studied separately,
but are still interrelated. In the case of a building:
Importance of Modeling