Questions tagged [class-design]

General guidelines on how to design classes with best known industry practices.

20 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
674 views

Correct Class Design for EAV Model

I need to design a class model to represent an EAV Model. I based my classes on this presentation http://www.slideshare.net/stepanyuk/implementation-of-eav-pattern-for-activerecord-models-13263311?...
2
votes
0answers
299 views

Have I created a Big Ball of Mud?

I'm working on a WPF application, trying to stay strict in separating View, ViewModel and Model. My application has a few different views in a relatively flat hierarchy. There is one view for editing ...
2
votes
0answers
236 views

How to build child classes as parent configuration?

I'm using Codeigniter PHP Framework for developing a web application, and when developing an admin zone, I've ended building a generic parent class called AdminController which is extended by the ...
2
votes
0answers
1k views

Provide an OnChange event for an internal property which is controlled externally?

For fun and by request I am updating this ImageGrid component, a kind of listbox for images that has a FileNames property of type TStrings. For ease of writing, I have been misusing its FileNames....
2
votes
1answer
122 views

How to model workflows

I'm building a helpdesk-type system, where there are: Customer - can submit/resubmit tickets; Manager - can review submitted tickets, assign to developers (one ticket to multiple developers), review ...
1
vote
0answers
226 views

Designing a multithreaded TCP/UDP server for audio sharing

As briefly introduced in the question title, I am trying to design and implement a server application able to let clients share audio contents between themselves. In order to achieve that, I decided ...
1
vote
0answers
230 views

Putting the rowmapper inside the domain class

Normally in java the RowMapper is placed in its own class. Instead, what about this design, putting the RowMapper inside each domain object, and giving all of them a consistent name: public class ...
1
vote
0answers
111 views

ES6(babel): Best practice for create class

I have a Product class. When I attempt to reference this from within a method on the class, I get an error saying this is undefined. To solve this, I have to bind this to all methods. And this, for ...
1
vote
0answers
125 views

Class decomposition for user interface panels

I'm developing a desktop application which has some similar UIs. So, I decided to extract out the common behaviors like below. Here is my Class diagram for the application. Since I have another ...
1
vote
0answers
114 views

Two classes which are supposed to be the same, but differ in lists

I am using a 3rd party API which yields JSON which has two ways of loading data - as a list of items, or as a singular item. The problem is that a given item in the list has different properties than ...
1
vote
0answers
597 views

Class Interfaces with Multiple Classes and Dependency Injection

NOTE ON QUESTION TITLE: I did not really even know how to phrase the title so if someone can edit and make it more articulate I would really appreciate it. QUESTION: Basically, what I'm trying to do ...
0
votes
0answers
53 views

Getting into situations that requires mixin while building classes. How should I correct my class design?

I have the following classes for to solve a particular problem related to HTTP responses. Problem is for class ServerSentEventStreamResponseService I am in a situation where I need mixin because I ...
0
votes
0answers
50 views

Two classes or One when maintaining Invariant and allowing De/Serialization

I am facing tough time deciding on whether to have two different classes in system, one for keeping class invariant and other for (de/)serialization or to just have a single class which does both. ...
0
votes
0answers
260 views

validating arguments in javascript constructors

In many cases, it is useful to have a constructor or factory method that validates arguments before instantiating an object, returning a new object if the arguments are valid and null otherwise. But ...
0
votes
0answers
92 views

Organising code in X++ where all classes for the application are in one long classes list

I am just beginning to develop in Dynamics AX 2012, using X++ (my background is .Net). The development environment in the application stores all classes for the application in one long classes list. ...
0
votes
0answers
817 views

Class design for Token, TokenType and regex constants

For use in a lexer class a have a class Token which represents a token of a specific type and its value, while the types are defined by the enum TokenType in which every token holds its own regular ...
0
votes
0answers
318 views

Reporting Logic vs Domain Logic

Should the reporting logic to extract domain data in a certain format reside in domain objects or separate reporting objects? The reporting logic needs to: select entities/data which match selection ...
-1
votes
2answers
259 views

“private methods” vs method out of class in a python module

I have a module with the class Foo. Foo has three methods: The constructor(__init__()) An error handling method (_error_handler()) The method that actually does something. (run()) Then, I have a ...
-1
votes
1answer
371 views

How to write a loose Python interface where subclasses can add extra data?

Here are two object makers I made: def make_assassination(i): neighbors = [] def test(graph): for n in graph.neighbors(i): neighbors.append(n) ...
-1
votes
2answers
179 views

Creating instances of an ability when there are multiple different type of abilities

I'm creating an RPG game where a player has a set of skills, each of which he can level up to improve its effect. Here are two example skills: health: increase player's maximum health regeneration: ...