1
vote
1answer
135 views

How to structure a program into classes [closed]

So after a while of working in programming field I still haven't figured it out how exactly should programs be structured, in a large set I mean. Which I think it's also because of working in an ...
2
votes
1answer
173 views

How should object identification be managed?

I have a java/swing application in (hopefully good) MVC structure. Here is a overview of my model classes: One or more workers may work at one working location and one worker may work at different ...
1
vote
1answer
85 views

Liskov substitution principle with abstract parent class

Does Liskov substitution principle apply to inheritance hierarchies where the parent is an abstract class the same way if the parent is a concrete class? The Wikipedia page list several conditions ...
0
votes
1answer
96 views

Should interface only be used for behavior and not to show logical data grouped together? [duplicate]

Should an interface only be used to specify certain behavior? Would it be wrong to use interface to group logically related data? To me it looks like we should not use interface to group logically ...
2
votes
1answer
204 views

How to design the relation between a Game and a Player in a game?

I am currently attempting to make a Trading Card Game and I have got a whole array of features working already, yet I am stuck now at the portion where one player can attacker another player (more ...
3
votes
1answer
79 views

Access items of a container with a pattern

I've two C++ classes with a relation: a container class which has a list of items. For example a library has got many books. The classes are the library and the book. Now from the external world I ...
6
votes
3answers
283 views

How to adhere to the open-closed principle in practice

I understand the intent of the open-closed principle. It's meant to reduce the risk of breaking something that already works while modifying it, by telling you to try to extend without modifying. ...
5
votes
1answer
312 views

Design review: how well does my object oriented design fit the SOLID principles? [closed]

This thread will be long, but I will try to make it as short as I can. Thank you. I have recently implemented a relatively simple program. What this program does is generate a simple piece of music ...
2
votes
3answers
196 views

Best Practices - separation of concerns and inheritance issues

Here's the situation: I have a "common" Data Access assembly that contains classes used in all my projects. Some of those are abstract classes that are only implemented by my data access layers for ...
1
vote
1answer
160 views

Designing software functions which are both pausable and restartable

Consider the following situation: One hardware device, two applications (1 C# application, 1 Firmware). The C# application sends frames to the firmware and the firmware executes scripts. C# -> ...
2
votes
1answer
300 views

When not to move a “C style” code to “C++ or Object Oriented” code?

Context I am (part of team A) developing a piece of functionality which depends on new APIs provided by team B. Old APIs (also provided by Team B) are there and this is how they are being used in our ...
1
vote
5answers
451 views

Lots of classes with only one single static method with same name as class - Code smell? [duplicate]

I'm trying to follow the single responsibility principle (SRP) in my applications. I have lots of CRUD classes I just name xxxxxManager. Following the SRP, I made 4 classes for each one : ...
2
votes
3answers
476 views

Empty virtual method on base class VS abstract methods

I couldn't find a question that was not too specific to some case, so I'll try to make this very generic. We need an extractor base class to a set of documents, for example. Each document has its ...
0
votes
1answer
821 views

Is this proper OO design for C++?

I recently took a software processes course and this is my first time attempting OO design on my own. I am trying to follow OO design principles and C++ conventions. I attempted and gave up on MVC for ...
3
votes
2answers
302 views

Object-Oriented design and proper Java architecture for my program

This is the very first time that I think I want to create a program which really uses OOP principles and I want to do it in the most effective and efficient way. First of all we are given this ...
25
votes
7answers
2k views

Are classes with only a single method a problem?

I am currently working on a software project that performs compression and indexing on video surveillance footage. The compression works by splitting background and foreground objects, then saving the ...
0
votes
2answers
163 views

How to remove redundant code that enables button. Or “if” statement

I got probably "micro optimization" problem. I got "History number", "Next Number", "Reset" buttons, as well "label" for text. Every time I click At "Next number" button I would like to show random ...
4
votes
1answer
168 views

How can I structure my code when I have orthogonal arrays of features?

Example: You have a game with different schools of magic (fire, ice, etc). Each school has a set of properties that pertain to independent features of the game, such as: strings to be displayed on ...
1
vote
3answers
201 views

Service method, bean as an argument and mandatory attributes

There is a service: createUser(User user) where you can create a new user, with so many attributes (name, address lines...). Now, some user attributes are mandatory. Other attributes are not ...
0
votes
1answer
143 views

Boolean properties in Class A control availability of members in Class B: Design Pattern?

Given the following code: class AnimalDescriptor { String species; boolean hasLegs; boolean hasTeeth; boolean hasHair; public AnimalDescriptor(String species, boolean hasLegs, ...
1
vote
1answer
315 views

Interface Dependencies or Abstract Classes

I have a decision to make and I am wondering what would be the better solution. I am refactoring an older application and intend to really get into the nuts and bolts of it. There are 8 report types ...
1
vote
4answers
521 views

Explanation needed, for “Ask, don't tell” approach?

I'm taking a course on design patterns in software engineering and here I'm trying to understand the good and the bad way of design relating to "coupling" and "cohesion". I could not understand the ...
8
votes
4answers
780 views

How do we keep dependent data structures up to date?

Suppose you have a parse tree, an abstract syntax tree, and a control flow graph, each one logically derived from the one before. In principle it is easy to construct each graph given the parse tree, ...
51
votes
10answers
3k views

What is meant by, “A user shouldn't decide whether it is an Admin or not. The Privileges or Security system should.”

The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was: user.isAdmin() This ...
5
votes
4answers
533 views

How do I decide to which class a method should belong

I have TopicBusiness.class and PostBusiness.class. I have no problem with deciding into which class methods such as addPostToDatabase() or getAllPostsFromDatabase() should go. But what about ...
17
votes
7answers
1k views

Does functional programming ignore the benefits gained from the “On the Criteria To Be Used in Decomposing Systems into Modules” (data hiding)?

There's a classic article named On the Criteria To Be Used in Decomposing Systems into Modules that I just read for the first time. It makes perfect sense to me, and is probably one of those articles ...
4
votes
2answers
558 views

How much logic can be put into an object-pooling factory class before it does more harm than good?

The main language I'm interested in doing object pooling in is AS3, which is known to need it in many cases. In the past I've always made a brand new factory class for every type I was going to try ...
4
votes
5answers
719 views

What is the name of this particular kind of over-engineering? [closed]

When faced with (even a small) project, I tend to fall into the following bad practice. I think about the structure of the problem. Then I create some base classes, derive from them and then derive ...
0
votes
1answer
191 views

Architecting Domain Layer and other modules with dependency injection in mind

I am currently new to Dependency Injection pattern. I am influenced by link by Mark Seemann. I have a confusion regarding whether an interface for an agent class of some agent module should be ...
1
vote
4answers
468 views

How to figure out design pattern for this particular solution?

While working on a project I've come up with some design solution. I am having a hard time relating it to any general design pattern or analyzing this situation in details. This is also prohibiting me ...
2
votes
5answers
505 views

How to handle assumptions while designing any system?

I have been going through various system design examples to understand how we approach any system design question. Here is what I have understood till now. Know the system first and find out how it ...
4
votes
1answer
289 views

Is using protected inheritance to hide (but exploit) implemented interface from the public ok?

Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the ...
0
votes
1answer
222 views

Code design: is this specific case of monkeypatching in python acceptable?

I'm using python to do some research tasks. I have a class hierarchy for "tools", where each object is an instance of a particular tool. They all share some functionality and have many similarities in ...
5
votes
2answers
269 views

Does increasing the number of classes increase code complexity? [duplicate]

To illustrate the question, let's say we have two programmers of comparable skill that both solve the same problem. The code they turn out has roughly the same lines of code, but one programmer uses 5 ...
11
votes
3answers
1k views

How to create better OO code in a relational database driven application where the database is poorly designed

I am writing a Java web application that consists mainly of a bunch of similar pages in which every page has several tables and a filter that applies to those tables. The data on these tables comes ...
0
votes
1answer
106 views

Creating Set Subclasses or Allowing Outside Configuration

I have a TriggerCaller and a TriggerAction class. The Caller "calls" the do() method on the action, which is set with the TriggerCallers setAction() method. The rest of the program should deal with ...
1
vote
1answer
159 views

Component design: getting cohesion right

I currently have a set of components named DataValues, ValueParsers, ValueFormatters and ValueValidators. The first one defines an abstract base class DataValue and contains a whole load of ...
14
votes
6answers
1k views

Loose Coupling in Object Oriented Design

I am trying to learn GRASP and I found this explained (here on page 3) about Low Coupling and I was very surprised when I found this: Consider the method addTrack for an Album class, two possible ...
1
vote
1answer
150 views

Design pattern advice required for sending xml files to different destinations

I am using an Export Module, now I want to extend it for different connections. I have a database which contains products Its Description, Review, Images etc. I use the serialize function to save it ...
-1
votes
2answers
122 views

Design suggestion required to create an Export plugin

I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here to get some guide lines. In our database we have a list of Products, which can be ...
6
votes
2answers
435 views

Is it good to have an interface plenty of methods which belong to different concepts, just to preserve the Liskov's Principle?

I'm currently studying a course based on Software Design and I had a discussion in class with my professor and some classmates about a problem represented by the next scenario: Scenario Imagine ...
0
votes
3answers
119 views

Should a complex unifying class be doing computation?

I have a large application in Java filled with independent classes which are unified in a PlayerCharacter class. The class is intended to hold a character's data for a game called the Burning Wheel, ...
5
votes
6answers
272 views

Passing an object between different handlers or a Superclass that contains most of the logic

I'm going to try to make this as concise and concrete as possible, but apologies since I can think of multiple ways to make it work. This question might also relate to handling production workflows ...
4
votes
2answers
492 views

Why do most java classes end with “ers”? [closed]

...Provider ...Searcher ...Resolver ...Builder ...Manager ...Importer ...Descriptor ...Helper ...Indexer Is it a global convention to refer a thing with "..ers" or "..ors". In contrast, a "thing" ...
0
votes
1answer
67 views

Program Structure for Table Cells Representing Objects

So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the ...
2
votes
4answers
425 views

Derived Class Method Naming

I'm having a hard time coming up with a good naming convention for methods in derived classes that serve the same purpose as the methods in the base class. For example, if both the base class, and the ...
4
votes
2answers
481 views

Log design approach

Logging was always a nightmare for me! Now I have to implement it again for a proxy system. In this proxy application, some systems ask proxy system to call some other services. What I have to log is ...
2
votes
5answers
522 views

Why sequential cohesion for operations in a method is not a good idea?

I read from the seminal Code Complete book that method statements that require to be executed in order passing parameter from one to the next is a code smell and is an example of a sequential ...
4
votes
1answer
639 views

Explanation of Object-parameter-coupling as mentioned in Code Complete book

I have been reading up on the seminal and excellent book Code Complete. It discusses about the various kinds of couplings that can happen between modules(which may be classes as well as methods): ...
4
votes
2answers
291 views

Preventing Liskov Substitution violation

I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . ...