ooad

Why do we use Interface? Is it only for Standardization? [closed]

痴心易碎 提交于 2019-11-26 12:01:59
Why do we use Interface? Is it only for Standardization? John K Purposes of Interfaces create loosely coupled software support design by contract (an implementor must provide the entire interface) allow for pluggable software allow different objects to interact easily hide implementation details of classes from each other facilitate reuse of software Analogy 1 : Much like the US space shuttle, Russian Soyuz spacecraft and Chinese Shenzhou 5 can all dock to the International Space Station, because they implement the same docking interface. (This is just an example - I don't know if it's true in

“Do not use Abstract Base class in Design; but in Modeling/Analysis”

三世轮回 提交于 2019-11-26 09:54:46
问题 I am newbie to SOA though I have some experience in OOAD. One of the guidelines for SOA design is “Use Abstract Classes for Modeling only. Omit them from Design”. The use of abstraction can be helpful in modeling (analysis phase). During analysis phase I have come up with a BankAccount base class. The specialized classes derived from it are “FixedAccount” and “SavingsAccount”. I need to create a service that will return all accounts (list of accounts) for a user. What should be the structure

Difference Between Cohesion and Coupling

寵の児 提交于 2019-11-26 06:09:03
问题 What is the difference between cohesion and coupling? How can coupling and cohesion lead to either good or poor software design? What are some examples that outline the difference between the two, and their impact on overall code quality? 回答1: Cohesion refers to what the class (or module) can do. Low cohesion would mean that the class does a great variety of actions - it is broad, unfocused on what it should do. High cohesion means that the class is focused on what it should be doing, i.e.

Why do we use Interface? Is it only for Standardization? [closed]

試著忘記壹切 提交于 2019-11-26 03:03:47
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . Why do we use Interface? Is it only for Standardization? 回答1: Purposes of Interfaces create loosely coupled software support design by contract (an implementor must provide the entire interface) allow for pluggable software allow different objects to interact easily hide

Constructors vs Factory Methods [closed]

隐身守侯 提交于 2019-11-26 01:04:51
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . When modelling classes, what is the preferred way of initializing: Constructors, or Factory Methods And what would be the considerations for using either of them? In certain situations, I prefer having a factory method which returns null if the object cannot be constructed.

Abstraction VS Information Hiding VS Encapsulation

烂漫一生 提交于 2019-11-26 00:26:30
问题 Can you tell me what is the difference between abstraction and information hiding in software development? I am confused. Abstraction hides detail implementation and information hiding abstracts whole details of something. Update: I found a good answer for these three concepts. See the separate answer below for several citations taken from there. 回答1: Go to the source! Grady Booch says (in Object Oriented Analysis and Design, page 49, second edition): Abstraction and encapsulation are

What does “program to interfaces, not implementations” mean?

为君一笑 提交于 2019-11-25 23:16:09
问题 One stumbles upon this phrase when reading about design patterns. But I don\'t understand it, could someone explain this for me? 回答1: Interfaces are just contracts or signatures and they don't know anything about implementations. Coding against interface means, the client code always holds an Interface object which is supplied by a factory. Any instance returned by the factory would be of type Interface which any factory candidate class must have implemented. This way the client program is

When should you use a class vs a struct in C++?

爱⌒轻易说出口 提交于 2019-11-25 22:26:01
问题 In what scenarios is it better to use a struct vs a class in C++? 回答1: Differences between a class and a struct in C++ are that structs have default public members and bases and classes have default private members and bases. Both classes and structs can have a mixture of public , protected and private members, can use inheritance and can have member functions. I would recommend using structs as plain-old-data structures without any class-like features, and using classes as aggregate data