DB Object passing between classes singleton, static or other?
So I’m designing a reporting system at work it’s my first project written OOP and I’m stuck on the design choice for the DB class.
Obviously I only want to create one instance of the DB class per-session/user and then pass it to each of the classes that need it. What I don’t know it what’s best practice for implementing this. Currently I have code like the following:-
Strategies for invoking subclass methods on generic objects [duplicate]
Possible Duplicate:
Alternatives to type casting in your domain
C++ – Constructor or Initialize Method to Startup [duplicate]
Possible Duplicate:
Avoid having an initialization method
How to name an subclass that add a minor, detailed thing? [closed]
Closed 9 years ago.
Class Design and Structure Online Web Store
I hope I have asked this in the right forum.
UML – Class Diagrams Order -> Products
I have a class diagram that is like this:
Is it appropriate for a class to only be a collection of information with no logic?
Say I have a class Person
that has instance variables age
, weight
, and height
, and another class Fruit
that has instance variables sugarContent
and texture
. The Person
class has no methods save setters and getters, while the Fruit
class has both setters and getters and logic methods like calculateSweetness
. Is the Fruit
class the type of class that is better practice than the Person
class. What I mean by this is that the Person
class seems like it doesn’t have much purpose; it exists solely to organize data, while the Fruit
class organizes data and actually contains methods for logic.
Architecting persistence (and other internal systems). Interfaces, composition, pure inheritance or centralization?
Suppose that you need to implement persistence, I think that you’re generally limited to four options (correct me if I’m wrong, please)
Is it a good idea to provide different function signatures that do the same thing?
Here is a C++ class that gets constructed with three values.
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.