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.

According to Wikipedia, software design is:

Software design is the process by which an agent creates a specification of a software artifact, intended to accomplish goals, using a set of primitive components and subject to constraints. Software design may refer to either "all the activities involved in conceptualizing, framing, implementing, commissioning, and ultimately modifying complex systems" or "the activity following requirements specification and before programming, as ... [in] a stylized software engineering process."

1966 questions
17
votes
3 answers

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

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 help catch such mistakes by either: (1) starting…
max
  • 49,282
  • 56
  • 208
  • 355
17
votes
3 answers

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 parameter list of its constructor (that is, of course,…
skypjack
  • 49,335
  • 19
  • 95
  • 187
17
votes
2 answers

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 starts looking at a map with places (pins) on…
Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
16
votes
1 answer

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 person/organization. (The technical specifica of the…
automatix
  • 14,018
  • 26
  • 105
  • 230
16
votes
5 answers

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] to the example described in the following…
MHOOS
  • 5,146
  • 11
  • 39
  • 74
15
votes
2 answers

Delegates as Properties: Bad Idea?

Consider the following control (snipped for brevity): public partial class ConfigurationManagerControl : UserControl { public Func CanEdit { get; set;} public Func CanDelete { get; set; } public…
Mike Hofer
  • 16,477
  • 11
  • 74
  • 110
15
votes
2 answers

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 written in TypeScript, and most of the models will be…
Caius
  • 2,084
  • 6
  • 31
  • 47
15
votes
4 answers

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 events and act on/use them accordingly. But the…
RBanerjee
  • 957
  • 1
  • 9
  • 18
15
votes
18 answers

Design principles for complete noobs?

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 on Software Design out there that can offer a…
Enrico Tuvera Jr
  • 2,739
  • 6
  • 35
  • 51
15
votes
2 answers

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 takes a stream as an argument is: much easier to…
max
  • 49,282
  • 56
  • 208
  • 355
14
votes
10 answers

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, rotations, animation etc. What I need to know the best way…
Brock Woolf
  • 46,656
  • 50
  • 121
  • 144
14
votes
3 answers

Is it a bad practice to use jQuery in Angular?

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 across problems where he couldn't find any other…
Davit Karapetyan
  • 589
  • 1
  • 6
  • 14
14
votes
1 answer

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 groups of users. That means that if you follow a…
ySgPjx
  • 10,165
  • 7
  • 61
  • 78
14
votes
7 answers

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 sufficient. I find it hard to detect, if the design…
Black
  • 5,022
  • 2
  • 22
  • 37
13
votes
5 answers

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 not two persons with the same id type and number"…
JPCF
  • 2,232
  • 5
  • 28
  • 50