design-principles

DRY principle in java [closed]

霸气de小男生 提交于 2019-12-01 13:12:21
I have been reading DRY principle.Though it seems so easy but I am having difficulty in understanding how we actually achieve it in any Project be it Web Application or Swing? May be few examples will give me lead and help me in developing my thought process. I have tried to search on Google but could not find any thing suitable. DRY is nothing that requires examples. If you are copying and pasting blocks of code from one method, function or block of code to another, then you are in violation of DRY. Very simply, DRY tells you to move that code into a reusable unit: either into a function or

UML help C# Design Principles

断了今生、忘了曾经 提交于 2019-11-30 16:12:51
I have a problem understanding an UML below: Specifically, what is the relationship between PersistentSet and ThirdPartyPersistentSet ? What is the relationship between PersistentObject and ThirdPartyPersistentSet ? Please note that the UML is from Agile Principles, Patterns, and Practices in C# By Martin C. Robert, Martin Micah 2006. Chapter 10 Thanks in advance! The relationship between PersistentSet and ThirdPartyPersistentSet is an Aggregation, which means the PersistentSet contains one or more ThridPartyPersistenSet instances. This is a "weak" relationship, meaning the instances of

What practices can safeguard against unexpected deferred execution with IEnumerable<T> as argument? [closed]

早过忘川 提交于 2019-11-30 04:43:43
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . There are a few questions similar to this which deals with right input and output types like this. My question is what good practices,

OO Software Design Principles

狂风中的少年 提交于 2019-11-29 21:08:55
I am a huge fan of software design principles such as SOLID and DRY . What other principles exist for OO software design? Note. I’m not looking for answers like "comment your code" but instead looking for OO design principles like the ones discussed by Uncle Bob . A fairly comprehensive list from Wikipedia: http://en.wikipedia.org/wiki/List_of_software_development_philosophies Agile software development Agile Unified Process (AUP) Behavior Driven Development (BDD) Big Design Up Front (BDUF) Brooks's law Cathedral and the Bazaar Code and fix Constructionist design methodology (CDM) Cowboy

Liskov substitution principle - no overriding/virtual methods?

荒凉一梦 提交于 2019-11-29 19:36:14
My understanding of the Liskov substitution principle is that some property of the base class that is true or some implemented behaviour of the base class, should be true for the derived class as well. I guess this would mean when a method is defined in a base class, it should never be overrided in the derived class - since then substituting the base class instead of the derived class would give different results. I guess this would also mean, having (non-pure) virtual methods is a bad thing? I think I might have a wrong understanding of the principle. If I don't, I do not understand why is

What's the difference between design patterns and design principles?

半世苍凉 提交于 2019-11-29 08:15:47
问题 I'm new to Ruby on Rails, and I went through these articles. Design Patterns in Ruby: Observer, Singleton Design Patterns in Ruby But I couldn't understand the actual difference between design patterns and design principles . Could someone please explain the distinction? 回答1: Design Principles: Design principles are core abstract principles which we are supposed to follow while designing software. Remember they aren't concrete - rather abstract. They can be applied on any language, on any

Does Scala's pattern matching violate the Open/Closed Principle?

自闭症网瘾萝莉.ら 提交于 2019-11-29 02:41:43
问题 If I add a new case class, does that mean I need to search through all of the pattern matching code and find out where the new class needs to be handled? I've been learning the language recently, and as I read about some of the arguments for and against pattern matching, I've been confused about where it should be used. See the following: Pro: Odersky1 and Odersky2 Con: Beust The comments are pretty good in each case, too. So is pattern matching something to be excited about or something I

OO Software Design Principles

邮差的信 提交于 2019-11-28 17:16:27
问题 I am a huge fan of software design principles such as SOLID and DRY . What other principles exist for OO software design? Note. I’m not looking for answers like "comment your code" but instead looking for OO design principles like the ones discussed by Uncle Bob. 回答1: A fairly comprehensive list from Wikipedia: http://en.wikipedia.org/wiki/List_of_software_development_philosophies Agile software development Agile Unified Process (AUP) Behavior Driven Development (BDD) Big Design Up Front

What is the reasoning behind the Interface Segregation Principle?

我们两清 提交于 2019-11-28 05:22:52
The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important? ISP states that: Clients should not be forced to depend on methods that they do not use. ISP relates to important characteristics - cohesion and coupling . Ideally your components must be highly tailored. It improves code robustness and maintainability. Enforcing ISP gives you following bonuses: High cohesion - better understandability, robustness Low coupling - better maintainability, high resistance to changes If you want to learn more

What is the meaning and reasoning behind the Open/Closed Principle?

无人久伴 提交于 2019-11-27 11:07:11
The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design? Specifically, it is about a "Holy Grail" of design in OOP of making an entity extensible enough (through its individual design or through its participation in the architecture) to support future unforseen changes without rewriting its code (and sometimes even without re-compiling **). Some ways to do this include Polymorphism/Inheritance, Composition, Inversion of