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
8
votes
7 answers

Is using Java's instanceOf compatible with the "program to an interface" design principle?

As you know the 'program to an interface' design principle broadly prefers supertypes instead of concrete types or implementations. Is it consistent with the principle to use instanceof in a Java program to derive a concrete type from a…
Arvanem
  • 1,043
  • 12
  • 22
8
votes
2 answers

What is the principle of "code moving to data" rather than data to code?

In a recent discussion about distributed processing and streaming I came across the concept of 'code moving to data'. Can someone please help explaining the same. Reference for this phrase is MapReduceWay. In terms of Hadoop, it's stated in a…
8
votes
1 answer

Clean Architecture: UseCase Output Port

I have a question regarding the "Use Case Output Port" in Uncle Bob´s Clean Architecture. In the image, Uncle Bob describes the port as an interface. I am wondering if it has to be that way or if the invoked Use Case Interactor could also return a…
8
votes
6 answers

Returning a new Object vs modifying one passed in as a parameter

I came across the following piece of code during a code review. My intuition is telling me that this isn't following proper OOP. I'm thinking that instead the LoadObject method should return a new SomeObject object, instead of modifying the one…
vicsz
  • 9,552
  • 16
  • 69
  • 101
8
votes
2 answers

Which SOLID Principles are violated?

INTRODUCTION I work on my master thesis about inheritance problems and work out some indicators which show that an inheritance problem exist. Like the following example: EXAMPLE public static String getAnimalNoise(Animal animal) { if (animal…
Zelldon
  • 5,396
  • 3
  • 34
  • 46
7
votes
5 answers

Is this Simple Factory violating the Open Closed Principle?

Is this Simple Factory violating the Open Closed Principle? The SimpleProductFactory needs to change every time a new concrete product needs to be created but it adheres to the single responsibility principle because that is the only reason it will…
7
votes
3 answers

Circular Dependency among two Projects of Different Solution

Suppose there are two .net projects not under same solution. ProjectA is under solution1 and ProjectB is under solution2. ProjectA has a reference of ProjectB and ProjectB has reference of ProjectA. There are two classes ProjectA_Class and…
7
votes
3 answers

Concrete Types or Interfaces for return types?

Today I came to a fundamental paradox of the object programming style, concrete types or interfaces. Whats the better election for a method's return type: a concrete type or an interface? In most cases, I tend to use concrete types as the return…
SDReyes
  • 9,798
  • 16
  • 53
  • 92
7
votes
4 answers

Is AJAX push a HTTP protocol aberration?

Develop a elegant Pub-Sub architecture in web-oriented-apps is a real challenge. Although there are some very interesting solutions using long-polling-connections (e.g. COMET) and repetitive-timeouts (e.g. js setTimeout). IMHO AJAX push still…
SDReyes
  • 9,798
  • 16
  • 53
  • 92
7
votes
2 answers

Does one child implementing an interface, but another not, violate the Liskov Substitution Principle?

I've been thinking recently about the Liskov Substitution Principle and how it relates to my current task. I have a main form which contains a menu; into this main form I will dock a specific form as a MDI child. This specific form may or may not…
7
votes
3 answers

UI Advice: how to design a form with a lot of data

I'm re-writing an app that is a data-entry tool. The existing app is in Access and consists of a form with multiple grids, with each grid containing many columns that requires the user to scroll horizontally in order to view columns. The current…
Chris Burgess
  • 5,787
  • 13
  • 54
  • 69
6
votes
1 answer

Graph database design principles, general principles and granularity issue

In relational database design, there are normal forms to guide the design process. Are there similar prinicples that apply to the design of graph databases like neo4j? In particular, I'm puzzled by the issue granularity: I could design a graph…
Daebwae
  • 83
  • 1
  • 6
6
votes
4 answers

What is the use of single responsibility principle?

I am trying to understand the Single Responsibility principle but I have tough time in grasping the concept. I am reading the book "Design Patterns and Best Practices in Java by Lucian-Paul Torje; Adrian Ianculescu; Kamalmeet Singh ." In this book…
6
votes
2 answers

Should object-oriented principles be applied in procedural languages?

I know that it's possible in principle to turn even procedural languages such as C or MATLAB into object-oriented ones. This question has been fairly well discussed here and here. What I found missing from these discussions and the references…
lindelof
  • 34,556
  • 31
  • 99
  • 140
6
votes
1 answer

RESTful design for multiple responses with single endpoint

I'm working on the project which provides REST API. Recently we decided to integrate it with Swagger to create detailed documentation for each endpoint. Almost all RESTs were successfully integrated but for some of them we encountered few…
evgeniy44
  • 2,862
  • 7
  • 28
  • 51
1 2
3
20 21