Question

In: Computer Science

A couple of questions that I want to understand better. How to draw a class diagram?...

A couple of questions that I want to understand better.

  1. How to draw a class diagram?
  2. What a clean object hierarchy diagram looks like?
  3. How to instantiate objects?
  4. What {cohesive, decoupled, information hiding, inheritance, and polymorphic} mean and why we strive to achieve them?
  5. When to implement a list with an array and when to implement it with a linked list
  6. When to use a list, stack, or queue?

Solutions

Expert Solution

Class diagrams will be treated from top to bottom. They are the graphical representation and represents multiple aspects of the application. Few points to be kept in mind while drawing :

1.Name of class diagram should be quite meaningful and apt for the aspect of the system.

2.Each element and their relationships have to be identified easily and before itself.

3.Attributes and methods of each class should be clearly identified. For Each class there should be minimum number of properties specified.

4.Each aspect of the diagram should be clearly understandable to the developer.

5.The diagram should be drawn on paper in a more clearer way and it should be revised as many times as possible to make it correct.

Clean Object hierarchy diagram is closer to the actual system behaviour. It shows the static view of the system at particular instance. It can be summarised as forward and backward engineering, object relationships.

Information hiding means separating the description of how to use a class from implementation details. This is important because it reduces complexity and prevents anyone to change code.

To instantiate an object is to create an object using a new keyword. We use rectangle to represent an Object. Objects usually represent a particular instance.

Cohesion describes the relationships within the modules. It is the degree to which all elements directed towards performing a single task are contained in the component. This is required because a good software design will have high cohesion.

Decoupling is the process of making something that was tightly coupled less or not at all. Flexible systems should have loose coupling.

Inheritance allows to create classes using the existing classes. The new class can have new implementation as well as the behaviour from the parent class. This is required and makes it easier to create and maintain an application. It also helps for the reuse of functionality. Data members are inherited from parent class.

Polymorphic represents something which is having many forms referring to both objects as well as methods. It allows to code to an interface that reduces coupling. Helps in increasing reusablity and make it easier.

Linked lists are preferable when you need constant time insertions, deletions from the list. These are used when you don't know the length of the items and random access is not required.

Arrays are preferable when you need random or indexed access to elements.When the number of items are known. When you wanted to iterate through each element and also use pointer. When you wanted exact memory to be used.

Queue is first in, firstout(FIFO)

Stack is last in, first out (LIFO)

Arrays and lists are random access. They are flexible as well as easily corruptible

Lists are used when you wanted to have a quick access of the element and when you wanted to arrange in a organised manner. Elements can be added to the end. It has high random access speed.


Related Solutions

. Big picture question: Now that you understand statistics. I want you to answer a couple...
. Big picture question: Now that you understand statistics. I want you to answer a couple of questions. Can a skilled statistician “make anything significant”? How would this be/not be accomplished? How could you design a study to guarantee significance? What is statistical power and how is it relevant to this big picture question? [6 Points]
Big picture question: Now that you understand statistics. I want you to answer a couple of...
Big picture question: Now that you understand statistics. I want you to answer a couple of questions. Can a skilled statistician “make anything significant”? How would this be/not be accomplished? How could you design a study to guarantee significance? What is statistical power and how is it relevant to this big picture question? [6 Points]
Big picture question: Now that you understand statistics. I want you to answer a couple of...
Big picture question: Now that you understand statistics. I want you to answer a couple of questions. Can a skilled statistician “make anything significant”? How would this be/not be accomplished? How could you design a study to guarantee significance? What is statistical power and how is it relevant to this big picture question?
I want to draw a sphere and I want to rotate it, How can I do...
I want to draw a sphere and I want to rotate it, How can I do it in JOGL? ( I am working on a program to visualize the sun ) please provide a pic of the code.
7. Big picture question: Now that you understand statistics. I want you to answer a couple...
7. Big picture question: Now that you understand statistics. I want you to answer a couple of questions. Can a skilled statistician “make anything significant”? How would this be/not be accomplished? How could you design a study to guarantee significance?
Class, what is job shadowing and how might it be used to better understand a potential...
Class, what is job shadowing and how might it be used to better understand a potential employer?
Draw whole class diagram that represent Candy online shopping website. The class diagram should consist of...
Draw whole class diagram that represent Candy online shopping website. The class diagram should consist of following: 1) Inventory Management System 2) Delivery Management System 3) Production Management System 4) Order Management System 5) Payment Management System Note: The website offers special candy that with customer name.
“A complete and consistent class diagram is all that is required to implement and to understand...
“A complete and consistent class diagram is all that is required to implement and to understand an application”. Discuss the correctness or otherwise of this statement. In your answer, among other things, consider how class diagrams evolve and who has a stake in the understanding and implementation of an application.
“A complete and consistent class diagram is all that is required to implement and to understand...
“A complete and consistent class diagram is all that is required to implement and to understand an application”. Discuss the correctness or otherwise of this statement. In your answer, among other things, consider how class diagrams evolve and who has a stake in the understanding and implementation of an application.
“A complete and consistent class diagram is all that is required to implement and to understand...
“A complete and consistent class diagram is all that is required to implement and to understand an application”. Discuss the correctness or otherwise of this statement. In your answer, among other things, consider how class diagrams evolve and who has a stake in the understanding and implementation of an application.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT