ooad

What is the difference between composition and aggregation? [duplicate]

不问归期 提交于 2019-12-01 19:46:42
What is the difference between composition and aggregation? can anybody give me a sample of this OOAD? Found here "Both aggregation and composition are special kinds of associations. Aggregation is used to represent ownership or a whole/part relationship, and composition is used to represent an even stronger form of ownership. With composition, we get coincident lifetime of part with the whole. The composite object has sole responsibility for the disposition of its parts in terms of creation and destruction. Moreover, the multiplicity of the aggregate end may not exceed one; i.e., it is

Method Calling Public/Private Members or Methods Best Practice - C#.NET

僤鯓⒐⒋嵵緔 提交于 2019-12-01 17:12:14
What is the best practice for calling members/fields from a private method and public method? Should the private method always call private fields or should they call the public members? private string _name; public string Name { get {return _name; } set { _name = value; } } public void DoSomething() { _doSomething(); } private void _doSomething() { _name.ToLower(); } I prefer to have all code go through the public interface, simply to reduce the number of places in the code that accesses the actual backing field. Two reasons are Simplifies debugging; if you have an issue where a value is

Derived class Private method is getting called

只愿长相守 提交于 2019-12-01 01:10:03
I have a Base class pointer pointing to derived class object. The method foo() is public in base class but private in derived class. Base class foo() is virtual. So when i call foo() from Base class pointer, Vptr Table has the address of derived class foo(), BUT its private in Derived class ...so how is it getting called.?? I understand Run time polymorphism and i also understand that the Access specifiers work for compile time and Virtual concept works at run time. So there shall be No Compiler error. My question is : Is this is a loop hole through which we can call private methods of Derived

What is an anti-pattern?

眉间皱痕 提交于 2019-11-28 14:59:00
I am studying patterns and anti-patterns. I have a clear idea about patterns, but I don't get anti-patterns. Definitions from the web and Wikipedia confuse me a lot. Can anybody explain to me in simple words what an anti-pattern is? What is the purpose? What do they do? Is it a bad thing or good thing? coobird Anti-patterns are certain patterns in software development that are considered bad programming practices. As opposed to design patterns which are common approaches to common problems which have been formalized and are generally considered a good development practice, anti-patterns are

Coupling and cohesion

家住魔仙堡 提交于 2019-11-28 02:49:56
I'm trying to boil down the concepts of coupling and cohesion to a concise definition. Can someone give me a short and understandable explanation (shorter than the definitions on Wikipedia here and here )? How do they interact? Thanks. Anybody have a good, short example? Coupling Loose: You and the guy at the convenience store. You communicate through a well-defined protocol to achieve your respective goals - you pay money, he lets you walk out with the bag of Cheetos. Either one of you can be replaced without disrupting the system. Tight: You and your wife. Cohesion Low: The convenience store

What does 'low in coupling and high in cohesion' mean

五迷三道 提交于 2019-11-27 09:58:54
I have problems understanding the statement low in coupling and high in cohesion . I have googled and read a lot about this, but still finding it hard to understand. To what I understand is High cohesion means, that we should have classes that are specialized to perform a particular function. Hope this is correct? Like a credit card validation class, which is specialized to validate credit cards only. And still don't understand what low Coupling means? vishal_aim What I believe is this: Cohesion refers to the degree to which the elements of a module/class belong together, it is suggested that

Coupling and cohesion

房东的猫 提交于 2019-11-27 04:58:45
问题 I'm trying to boil down the concepts of coupling and cohesion to a concise definition. Can someone give me a short and understandable explanation (shorter than the definitions on Wikipedia here and here)? How do they interact? Thanks. Anybody have a good, short example? 回答1: Coupling Loose: You and the guy at the convenience store. You communicate through a well-defined protocol to achieve your respective goals - you pay money, he lets you walk out with the bag of Cheetos. Either one of you

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

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 02:00:28
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 of service(s) to meet the requirement? Note: It would be great if you can provide code demonstration

Difference Between Cohesion and Coupling

自闭症网瘾萝莉.ら 提交于 2019-11-26 18:02:30
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? mauris 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. only methods relating to the intention of the class. Example of Low Cohesion: ------------------- |

What does 'low in coupling and high in cohesion' mean

核能气质少年 提交于 2019-11-26 12:49:20
问题 I have problems understanding the statement low in coupling and high in cohesion . I have googled and read a lot about this, but still finding it hard to understand. To what I understand is High cohesion means, that we should have classes that are specialized to perform a particular function. Hope this is correct? Like a credit card validation class, which is specialized to validate credit cards only. And still don\'t understand what low Coupling means? 回答1: What I believe is this: Cohesion