1
vote
2answers
89 views

Passing central objects around or having global instances? [duplicate]

Having a larger WinForms application with several classes I currently pass references to several "central" objects around to function calls. This leads to more method parameters. Example: public ...
0
votes
4answers
319 views

How to design an IDisposable that unconditionally needs to be disposed?

Consider a class that implements IDisposable, and that has members in such a way that it will never become eligible for garbage collection when it is not disposed. And as it will not be garbage ...
0
votes
2answers
180 views

Data structures VS Classes and what happens if they merge? [closed]

Alright so I've learned this: Classes have public methods that perform operations on the class's data and they hide away their implementations. Data structures on the other hand, completely expose ...
1
vote
3answers
423 views

C# vector class - Interpolation design decision

Currently I'm working on a vector class in C# and now I'm coming to the point, where I've to figure out, how i want to implement the functions for interpolation between two vectors. At first I came up ...
0
votes
2answers
182 views

Subclassing to avoid line length

The standard line length of code is 80 characters per line. This is accepted and followed by the most of programmers. I working on a state machine of a character and is necessary for me follow this ...
3
votes
3answers
556 views

How bad is it to have two methods with the same name but different signatures in two classes?

I have a design problem related to a public interface, the names of methods, and the understanding of my API and code. I have two classes like this: class A: ... function collision(self): ...
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 ...
4
votes
3answers
420 views

Why is it so difficult to know where to use interfaces,generics in program design?

I am attempting to learn c# from the head first series, in addition i also consult other books such as Pro C# by Andrew Tolson. Now the thing is that i perfectly understand the interface,generics ...
0
votes
3answers
147 views

Best practice to propagate preferences of application

What is your approach with propagation to all classes/windows of preferences/settings of your application? Do you share the preference_manager class to all classes/windows who need it or you make ...
47
votes
12answers
3k views

Is it bad practice to pass instances through several layers?

In my program design, I often come to the point where I have to pass object instances through several classes. For example, if I have a controller that loads an audio file, and then passes it to a ...
6
votes
3answers
159 views

Grouping conceptual algorithms into one class or associate with their object models

If I have a number of classes, lets say a variety of buildings of some sort. Each of these buildings have various properties and do some stuff etc Now there is a set of operations I need to do on ...
8
votes
5answers
2k views

Interface and Inheritance: Best of both worlds?

I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required. ...
3
votes
5answers
240 views

How to decide which classes are necessary for the system

I know design principles and design patterns in theory. But it's embarrassing to realize that it's not clear when applying it in practice. For example, let's think about simple tic tac toe console ...
12
votes
4answers
2k views

Is It “Wrong”/Bad Design To Put A Thread/Background Worker In A Class?

I have a class that will read from Excel (C# and .Net 4) and in that class I have a background worker that will load the data from Excel while the UI can remain responsive. My question is as follows: ...