Questions tagged [design-principles]

Design principles are ideas that guide developers toward certain goals in software design.

Software has many different desirable quality aspects -- among them are reliability, security, maintainability, efficiency, and size; and these are all impacted by choices made by the developers. Software design principles tend to focus on the maintainability aspects of quality: is the code loosely coupled, or does it have many dependencies that make it hard to use? Is the code highly cohesive, or is a collection of unrelated information needed to use a module? Is the code readable and understandable? Is the code testable? Is the code usable and reusable? Is the code simple or complex?

Various design principles can be used by developers to advise them in making choices that will yield highly cohesive, loosely coupled, simple, maintainable designs. The SOLID design principles are an example of specific design advice for object oriented projects. The Principles of User Interface Design provide design advice for creating user interfaces.

309 questions
2
votes
1 answer

Difference between Composability and Decomposability

I've been looking across the web for a simple explanation about the differences between the two. I understand composition is "bottom-up" design while decomposition is "top-down" design. However, aside from that - are there any further…
hyit
  • 496
  • 4
  • 10
2
votes
3 answers

Java - Should I use a field or a class for the problem as follows:

I have two tables in the DB FuelStation (fuel_station_id: int (PK), fuel_station_name: varchar, fuel_brand_id: int(FK)) FuelBrand (fuel_brand_id: int (PK), fuel_brand_name: varchar) As we can see, both tables are linked via. foreign key…
Amit
  • 33,847
  • 91
  • 226
  • 299
2
votes
3 answers

How to manage interface segregation when using an IoC container?

Possible Duplicate: StructureMap singleton usage (A class implementing two interface) I'm currently designing a small system and i'm currently using structureMap as IoC. I just recently got the point of interface segregation...and I'm wondering…
2
votes
2 answers

Add methods to classes without breaking implementations

Let say I have 2 classes called class Cow ad class Pig. They both implements interface Animal. For the interface there are only 2 methods called public void eat() and public void speak(). All is fine. But while this seems good making use of…
Unheilig
  • 16,196
  • 193
  • 68
  • 98
2
votes
2 answers

Design suggestion for an invoice application

I am trying to make an invoice management system for our company. I am a little bit confused because of design principles. SOLID Lets say that a class takes care of invoices: InvoiceProcessor InvoiceProcessor ip=new…
mustafa öztürk
  • 539
  • 3
  • 13
2
votes
2 answers

liskov substitution principle and exception handling

It says that Derived class should not throw any exception which is not known to the Base class, i am trying to find how its work, in the base class i am throwing System.Exception and in Derived i am throwing ArgNullException(). Can someone explain…
New Coder
  • 501
  • 2
  • 6
  • 23
2
votes
3 answers

Strategy Pattern - multiple return types/values

We are working on an image processing project using C# and EmguCV. Our team is composed of 3 people. To make faster progress, the 3 of us work on different sub-problems or experiment with different algorithms at the same time. Currently each of us…
Aishwar
  • 9,284
  • 10
  • 59
  • 80
2
votes
1 answer

Synchronize asynchronous calls from more than one object

I have about 10 objects. Each object is different class. Requests sent to those objects (method calls with returning values) comes from different threads. I need to synchronise those method calls, that only one must be executed at a time. Some…
user2301299
  • 529
  • 1
  • 5
  • 15
2
votes
3 answers

Proper Inheritance Architecture in Java

I'm in a bit of a quandary. I have class animal, let's say it stores basic things like position, etc.. So then I have a class smartAnimal that extends animal. Let's say smartAnimal adds some functionality of being able to make decisions without the…
honkbert
  • 135
  • 1
  • 7
2
votes
1 answer

C++ Game Design Principles

I'm new to stackover and this is my first ever post, so please be gentle :-) I'm in the middle of developing a multi-level shooting game, and I'm questioning the best OOP design for my purposes, explicitly to manage the bullets. Generally the game…
NickZ
  • 21
  • 1
2
votes
1 answer

design pattern advice: graph -> computation

I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and branches will have properties). A graph will be…
cs0815
  • 16,751
  • 45
  • 136
  • 299
2
votes
3 answers

Is having Message Box in business class wrong?

Is having reference to System.Windows.Forms in a business class and using MessageBox.Show wrong? Currently have a event processing decorator class decorating a service class. When certain events fired decorator would like to ask user if they want to…
c00ke
  • 2,245
  • 5
  • 26
  • 34
2
votes
2 answers

MVC: Reset password belongs to Service layer or Actual Entity

I am relatively new to MVC, and have just come across some pre-existing code. We have a UserService, which mainly contains CRUD operations, and perhaps, one or two business logic operations - all needed by our controllers. It encapsulates the…
Karan
  • 14,824
  • 24
  • 91
  • 157
2
votes
2 answers

Allowing for more then one "no-value" value in value space

I use a string type for my Id attribute on all my domain abjects. E.g.: public class Person { property string Id { get; set; } // ... more properties } no tricks here. null represents a "no-value" value, when a new Person is created and…
THX-1138
  • 21,316
  • 26
  • 96
  • 160
2
votes
1 answer

MVC: why controller is the strategy for the view

Here is definition of Strategy Pattern: Strategy - defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. So, Strategy separate a…
hqt
  • 29,632
  • 51
  • 171
  • 250