Questions tagged [software-design]

Software design is the activity of deciding what properties, elements, responsibilities, interfaces, relationships and interactions are required in order to create an effective piece of software.

Filter by
Sorted by
Tagged with
676 votes
15 answers
461k views

Difference Between Cohesion and Coupling

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, ...
JavaUser's user avatar
  • 26k
207 votes
12 answers
333k views

What is a software framework? [closed]

Can someone please explain me what a software framework is? Why do we need a framework? What does a framework do to make programming easier?
Anxious's user avatar
  • 2,185
195 votes
8 answers
88k views

What does "program to interfaces, not implementations" mean?

One stumbles upon this phrase when reading about design patterns. But I don't understand it, could someone explain this for me?
never_had_a_name's user avatar
173 votes
13 answers
97k views

When to use the Bridge pattern and how is it different from the Adapter pattern?

Has anyone ever used the Bridge pattern in a real world application? If so, how did you use it? Is it me, or is it just the Adapter pattern with a little dependency injection thrown into the mix? Does ...
Charles Graham's user avatar
119 votes
14 answers
89k views

Are utility classes evil? [closed]

I saw this question: If a "Utilities" class is evil, where do I put my generic code? And I thought, why are utility classes evil? Let’s say I have a domain model that is dozens of classes ...
hvgotcodes's user avatar
  • 119k
103 votes
6 answers
48k views

What is the benefit of using Fragments in Android, rather than Views?

When developing for Android, you can set your target (or minimum) sdk to 4 (API 1.6) and add the android compatibility package (v4) to add support for Fragments. Yesterday I did this and successfully ...
Phil's user avatar
  • 36.2k
95 votes
15 answers
71k views

adapter-Any real example of Adapter Pattern [closed]

I want to demonstrate use of Adapter Pattern to my team. I've read many books and articles online. Everyone is citing an example which are useful to understand the concept (Shape, Memory Card, ...
AksharRoop's user avatar
  • 2,263
82 votes
5 answers
123k views

What are the DAO, DTO and Service layers in Spring Framework?

I am writing RESTful services using spring and hibernate. I read many resource in internet, but they did not clarify my doubts. Please explain me in details what are DAO, DTO and Service layers in ...
Prathap Badavath's user avatar
77 votes
6 answers
47k views

Coupling and cohesion

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 ...
Jonathan's user avatar
  • 7,379
74 votes
13 answers
29k views

Is it the best practice to extract an interface for every class?

I have seen code where every class has an interface that it implements. Sometimes there is no common interface for them all. They are just there and they are used instead of concrete objects. They ...
the_drow's user avatar
  • 19k
67 votes
6 answers
24k views

what is the difference between a view model and a data transfer object?

I'm basing this question on Fowler PoEAA. Given your familiarity with this text, aren't the ViewModels used in ASP.NET MVC the same as DTOs? Why or why not? Thank you.
mkelley33's user avatar
  • 5,437
64 votes
8 answers
79k views

Avoiding Circular Dependencies of header files [duplicate]

Do you have any good advice on how to avoid circular dependencies of header files, please? Of course, from the beginning, I try to design the project as transparent as possible. However, as more and ...
Bunkai.Satori's user avatar
64 votes
5 answers
34k views

Onion architecture compared to hexagonal

Is there any difference between them (onion | hexagonal), from my understanding they are just the same, they focus upon the domain which is at the core of the application and should be technology / ...
user avatar
61 votes
20 answers
82k views

Encapsulation vs Data Hiding - Java

Interviewer: What is encapsulation and how do you achieve it in Java? Me: Encapsulation is a mechanism to hide information from the client. The information may be data or implementation or ...
Sandeep Jindal's user avatar
49 votes
5 answers
170k views

Find Number of CPUs and Cores per CPU using Command Prompt

I am trying to retrieve the Number of CPUs and Cores per CPU using Command Prompt. I have executed the following command: wmic cpu get NumberOfCores, NumberOfLogicalProcessors/Format:List I get this ...
Mustafa's user avatar
  • 755
45 votes
2 answers
13k views

Decompose microservices: Business capability vs Domain

As I read, there are two patterns to define one microservice, by business capability and by subdomain. But I still find it very ambiguous. I get confused how these two patterns differentiate from each ...
necroface's user avatar
  • 3,405
44 votes
1 answer
33k views

Repository and Data Mapper pattern

After a lots of read about Repository and Data Mapper I decided to implement those patterns in a test project. Since I'm new to these I'd like to get your views about how did I implement those in a ...
Saber Amani's user avatar
  • 6,469
41 votes
9 answers
11k views

What PHP application design/design patterns do you use?

Please share your favorite application design / design patterns for use in PHP with me. Some things I'd like to know: How your folders are designed How you use object oritentation in your PHP ...
Ali's user avatar
  • 265k
40 votes
3 answers
12k views

Questions about VIPER - Clean Architecture

I've been reading about Clean Architecture from Robert Martin and more specifically about VIPER. Then I ran into this article/post Brigade’s Experience Using an MVC Alternative which describes pretty ...
Rodrigo Ruiz's user avatar
  • 4,297
39 votes
2 answers
24k views

What is the core difference of redux & reflux in using react based application?

Recently I conducted a preliminary study on developing an E-commerce site and discovered that redux and reflux both come from flux architecture in Facebook and that both are popular. I am confused ...
Zahidur Rahman's user avatar
36 votes
6 answers
18k views

Adapter Pattern: Class Adapter vs Object Adapter

I have a few questions about the Adapter pattern. I understand that the class adapter inherits from the adaptee while the object adapter has the adaptee as an object rather than inheriting from it. ...
Silverbolt's user avatar
  • 7,293
31 votes
4 answers
11k views

the significance of java RMI please? [closed]

Why do people use RMI, or when should I use RMI? I read those tutorials about RMI on oracle's website. But it doesn't provide enough practical examples. To my understanding, software should have its ...
Fermat's Little Student's user avatar
30 votes
5 answers
38k views

Why encapsulation is an important feature of OOP languages? [closed]

I came across different interview where question was asked to me why encapsulation is used? Whose requirement actually is encapsulation? Is it for users of program? Or is it for co-workers? Or is it ...
Shahzad's user avatar
  • 580
30 votes
7 answers
6k views

Should I throw on null parameters in private/internal methods?

I'm writing a library that has several public classes and methods, as well as several private or internal classes and methods that the library itself uses. In the public methods I have a null check ...
user9993's user avatar
  • 6,041
26 votes
5 answers
11k views

How to design an application in a modular way?

I am looking for pointers, suggestions, links, warnings, ideas and even anecdotical accounts about "how to design an application in a modular way". I am going to use python for this project, but ...
mac's user avatar
  • 42.6k
22 votes
2 answers
14k views

Should I share models across multiple microservices?

I'm in the analysis phase of a big project, that will be created with a micro services architecture. I am pretty confident that (at least for the next 3 years to come) the whole codebase will be ...
Caius's user avatar
  • 2,224
21 votes
1 answer
2k views

Why doesn't JavaScript get its own thread in common browsers?

Not enough that JavaScript isn't multithreaded, apparently JavaScript doesn't even get its own but shares a thread with a load of other stuff. Even in most modern browsers JavaScript is typically in ...
user777's user avatar
  • 926
20 votes
2 answers
6k views

How do I choose heap allocation vs. stack allocation in C++?

One of the C++ features that sets it apart from other languages is the ability to allocate complex objects as member variables or local variables instead of always having to allocate them with new. ...
Omnifarious's user avatar
  • 55.2k
20 votes
1 answer
14k views

How to understand the VIPER clean architecture?

I recently discovered VIPER clean architecture and I started looking for sample tutorials on applying this architecture on the Android platform. However, what I only found was sample projects which ...
Georgi Koemdzhiev's user avatar
19 votes
9 answers
3k views

Keeping track of utility classes

I've recently been more and more frustrated with a problem I see emerging in my projects code-base. I'm working on a large scale java project that has >1M lines of code. The interfaces and class ...
Asaf's user avatar
  • 6,462
19 votes
5 answers
2k views

Django - how to visualize signals and save overrides?

As a project grows, so do dependencies and event chains, especially in overridden save() methods and post_save and pre_save signals. Example: An overridden A.save creates two related objects to A - ...
Milano's user avatar
  • 18.5k
18 votes
2 answers
6k views

Clean Architecture - Robert Martin - How to connect use cases

I'm trying to implement the Clean Architecture described by Robert Martin. More specifically I'm using VIPER which is an iOS version of Clean Architecture. The problem I have is as follows: The user ...
Rodrigo Ruiz's user avatar
  • 4,297
18 votes
5 answers
8k views

How to persist objects which implement the State pattern?

I am new to the State design pattern and I can't find a proper example of saving different states of an object to the database (SQL Server in my case). The scenario is quite similar [almost identical] ...
MHOOS's user avatar
  • 5,216
17 votes
3 answers
19k views

python: abstract base class' __init__(): initializion or validation? [closed]

class ABC is an "abstract base class". class X is its subclass. There's some work that needs to be done in any subclass of ABC, which is easy to forget or do incorrectly. I'd like ABC.__init__() to ...
max's user avatar
  • 50.8k
17 votes
3 answers
2k views

Constructors, templates and non-type parameters

I've a class that must depend for some reasons from an int template parameter. For the same reasons, that parameter cannot be part of the parameter list for the class, instead it is part of the ...
skypjack's user avatar
  • 49.9k
16 votes
1 answer
554 views

How to build a class structure, when members are also structured hierarchically?

I'm building a PHP web application, that should provide to the user a possiblity to order an "installation"/setup of a (ConnectDirect or File Transfer Gateway) connection between him and another ...
automatix's user avatar
  • 14.7k
15 votes
18 answers
3k views

Design principles for complete noobs? [closed]

I've been programming for around a year now, and all the stuff that I've written works - it's just extremely poorly written from my point of view. I'd like to know if there are any (free) good books ...
Enrico Tuvera Jr's user avatar
15 votes
2 answers
10k views

Delegates as Properties: Bad Idea?

Consider the following control (snipped for brevity): public partial class ConfigurationManagerControl : UserControl { public Func<string, bool> CanEdit { get; set;} public Func<...
Mike Hofer's user avatar
  • 16.7k
15 votes
2 answers
4k views

file name vs file object as a function argument

If a function takes as an input the name of a text file, I can refactor it to instead take a file object (I call it "stream"; is there a better word?). The advantages are obvious - a function that ...
max's user avatar
  • 50.8k
14 votes
7 answers
2k views

When to call the gang of four? [When to use design patterns?]

In The Guerilla Guide to Interviewing Joel says that guys who want to get things done, but are not smart will do stupid things like using a visitor design pattern where a simple array would be ...
Black's user avatar
  • 5,072
14 votes
10 answers
12k views

How To Make a Tetris Clone?

I am working on coding a Tetris clone in XNA C# and am unsure of the best way to approach the data structure side of the game on a high level. I am totally fine with the collision detection, ...
Brock Woolf's user avatar
14 votes
3 answers
16k views

Is it a bad practice to use jQuery in Angular? [closed]

My question is the following. Should I avoid using any kind of jQuery code in Angular application as it seems legit to have only one thing interacting with DOM. Another question is if anyone came ...
Davit Karapetyan's user avatar
14 votes
1 answer
5k views

Twitter-like app using MongoDB

I'm making an app that uses the classic "follow" mechanism (the one used by Twitter and a lot of other apps around the web). I'm using MongoDB. My system has a difference, though: an user can follow ...
ySgPjx's user avatar
  • 10.2k
14 votes
4 answers
4k views

Is Event sourcing using Database CDC considered good architecture?

When we talk about sourcing events, we have a simple dual write architecture where we can write to database and then write the events to a queue like Kafka. Other downstream systems can read those ...
RBanerjee's user avatar
  • 957
13 votes
2 answers
15k views

Purpose of Utility tree in ATAM

What is an utility tree and what is it's purpose in case of Architecture tradeoff analysis method(ATAM)? Thanks
user avatar
13 votes
2 answers
7k views

DDD: guidance on updating multiple properties of entities

So, i decided to learn DDD as it seems to solve some architectural problems i have been facing. While there are lots of videos and sample blogs, i have not encountered one that guides me to solve the ...
sergio's user avatar
  • 1,026
13 votes
3 answers
8k views

DDD navigation to entities inside aggregate root via composite identity

I have an aggregate root Products which contains a list of entities Selection, which in turn contains a list of entities called Features. The aggregate root Product has an identity of just name The ...
morleyc's user avatar
  • 2,299
13 votes
3 answers
4k views

Marker interface vs empty abstract class

I am facing difficulties to decide between using a marker interface or an empty abstract class. I have two classes BrokerResponse and Notification, which have no structural similarity. The only thing ...
tgr's user avatar
  • 3,578
13 votes
5 answers
1k views

How to catch DB errors and translate them into meaningful information for the business layer?

Usually I have to insert some data in a DB and it can't be inserted because the table has constraints preventing me from doing that. With the app I'm developing, some business rules (like "there are ...
JPCF's user avatar
  • 2,252
13 votes
2 answers
21k views

DTO Design in TypeScript/Angular2

I'm currently developing an Angular 2 application. While developing I started to use TypeScript classes to create objects from JSON I receive through HTTP or when creating a new object in a form. The ...
DaSch's user avatar
  • 941

1
2 3 4 5
40