oop

DDD: Modeling M:N relation between two roots where the relation itself carries semantic meaning

Update Edited to reflect clarifications requested by Chris Holmes below. Originally I was referring to a Terminal as a Site but changed it to better reflect my actual domain. At heart, I think this is a question about modeling a many to many relationship between two root entities where the relationship itself carries some semantic mean...

How much functionality is "acceptable" for a C++ struct?

My first post so please go easy on me! I know that there's no real difference between structs and classes in C++, but a lot of people including me use a struct or class to show intent - structs for grouping "plain old data" and classes for encapsulated data that has meaningful operations. Now, that's fine but at what point do you start...

Patterns to get a subset based on certain criteria (In Design)

I'm looking for a pattern for this general case: "I need to get a subset of data based on directly related criteria and indirectly related data." ...

How can I avoid code duplication with many small classes?

I have different classes called English, Spanish, French, etc.: Class English{ String name = "English"; String alias = "ENG"; } Class French{ String name = "French"; String alias = "Fre"; } Similarly other language classes. And one more class called Language: Class Language{ String name = ""; String alias = ...

Encapsulation within class definitions

For example, do you use accessors and mutators within your method definitions or just access the data directly? Sometimes, all the time or when in Rome? ...

Why is wx.SingleChoiceDialog not subclassing properly

I'm trying to subclass the wxpython SingleChoiceDialog class. I have a TableChoiceDialog class that inherits from SingleChoiceDialog adding generic functionality, and I have 2 sub classes for that add more refined functionality. Basically I'm O.O.P'ing In my TableChoiceDialog class I have a line which calls the superclass's __init__, ...

When should I use C++ private inheritance?

Unlike protected inheritance, C++ private inheritance found its way into mainstream C++ development. However, I still haven't found a good use for it. When do you guys use it? ...

Virtual inheritance in C++ usages/tricks

I've never used it in the professional software even though in our shop, and others I have worked for, we design large scale systems. The only time I messed with virtual inheritance was during my interview in a company. Nonetheless, I played with it during afterhours. Do you guys use it? Do you understand how it works in depth (how mo...

Explanation of re-usable structures in OO PHP

Can someone please explain "re-usable structures" for me? I was working on making some db objects in php, but was told I was using too much processing from the computer cause I made stuff to complicated with the below objects: My DB objects: $db = new Database; $db->db_connect(); $post_content = new DbSelect; $post_content->select('id...

Object Oriented CSS: Catchy Buzz-phrase or Legitimate Design Approach?

It seems there is a new catch-phrase emerging in the web development field: object-oriented CSS. On the face of it, this strikes me as simply being best-practice packaged up in a catchy slogan. I understand and fully respect the intentions behind the movement, but is there any more to it? Does anyone have any further insight that sets...

Validating Class Data

In my app, I am creating a series of validation classes to check, for example, that a user entered Name property of the class (from a WinForm) doesn't exceed the size of the varchar() in the database. Currently, the validation code will throw a custom Exception if the Name field is too large. (The custom exception, when caught by the UI...

Is a static class appropriate when state is immutable?

Let's say I have a simple class called WebsterDictionary that has a function that can take a word and return its definition. Perhaps there is another function that can take a definition and return a word. The class is used all the time by many clients. To facilitate the lookups, the class contains a member variable that is an in-memo...

Derived classes in C - What is your favorite method?

In my experience in object oriented C programming I have seen two ways to implement derived classes. First Method, have a definition of the parent class as a .h file. Then each class that derives from this class will have do: File parent_class.h: int member1; int member2; File testing.c: struct parent_class { #include "parent...

Create ERD type diagrams from Rails code

I'm beginning to learn Ruby on Rails, and looking at other peoples code. Is there any way to take an exisiting codebase and create object relationship diagrams or Entity relationship diagrams (ERD's) ? I know Visio can do some things given a database, but I was hoping to produce diagrams of classes, objects and objects. ...

What is this? Template method or what?

I have a class Request.cs It has an abstract method: public abstract Response CreateResponse(XmlReader reader); and there's also a method: public Response SendRequest(string requestURI) { ... XmlReader reader = XmlReader.Create(responseStream); return CreateResponse(reader); } The CreateResponse method is implemented...

Actionscript and ViewStack = Cannot access a property or method of a null object reference

I'm writing a flex program in an OO manner and I've got to the point of creating a ViewStack to hold various panels. My problem is that when I add a panel to the ViewStack it throws the aforementioned error. No doubt the answer is pretty obvious so here's the constructor for the manager class that holds my ViewStack. stack = new ViewS...

Websites like projecteuler.net

Sometimes I'm solving problems on projecteuler.net. Almost all problems are solvable with programs, but these tasks are more mathematical than programmatical. Maybe someone knows similar sites with: design tasks, architecture tasks, something like "find most elegant C++ solution"? ...

Generics, Inheritance and the new operator

Here is something that I find myself using from time to time and I just wanted to get some feedback on the merits of the practice. Lets say that I have a base class: abstract class RealBase { protected RealBase(object arg) { Arg = arg; } public object Arg { get; private set; } public abstract void DoThatThingY...

Need to override method that is in a namspace with another class which constructs it

Hello, I am trying to override a method on a control in the Community Server SDK called 'InlineTagsContainerTagEditor'. When I find the source for this control, it is inside of a file with another class called 'TaggableContentTagEditableList'. Here is what I think the relevant parts are: namespace CommunityServer.Controls { publi...

How to handle a massive factory in a cleaner fashion

My development team has run into a design issue. I'm hoping someone can help me clean this part of the architecture up a bit. In my system, I have an enum with 250 members [one member represents a distinct drop down]. In order to populate the drop downs on any given window, that form sends in the enum members that relate to the drop do...