class-design

Class Designer in Visual Studio - is it worth it?

Hello, Does anybody use the Class Designer much in Visual Studio? I have downloaded the Modeling Power Toys for 2005 and have been impressed with what I've seen so far. The MSDN Class Designer Blog doesn't seem to have been updated for a while but it still looks quite useful. Is the Class Designer a quick way to build the basic applic...

Class designer

What software do you use when designing classes and their relationship, or just pen and paper? ...

Should DB layer members be static or instance?

I've seen projects where the classes in the DB layer have just static functions in them and other projects where those classes need to be instantiated to get access to the member functions. Which is "better" and why? ...

Is UML practical?

In college I've had numerous design and UML oriented courses, and I recognize that UML can be used to benefit a software project, especially use-case mapping, but is it really practical? I've done a few co-op work terms, and it appears that UML is not used heavily in the industry. Is it worth the time during a project to create UML dia...

List<BusinessObject> or BusinessObjectCollection?

Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable IE: public class CollectionBase : IEnumerable and then would derive their Business Object collections from that. public class BusinessObjectCollection : CollectionBase Now with the generic lis...

How do you find a needle in a haystack?

When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives: 1. needle.find(haystack) 2. haystack.find(needle) 3. searcher.find(needle, haystack) Which do you prefer, and why? I know some people prefer the second alternative because it avoids introducing a third object. However,...

Which class design is better?

Which class design is better and why? public class User { public String UserName; public String Password; public String FirstName; public String LastName; } public class Employee : User { public String EmployeeId; public String EmployeeCode; public String DepartmentId; } public class Member : User { pub...

.NET serialization class design problem

We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for properties than yes or no. The problem is now how we implement the...

Is there a specific name for the node that coresponds to a subtree?

I'm designing a web site navigation hierarchy. It's a tree of nodes. Nodes represent web pages. Some nodes on the tree are special. I need a name for them. There are multiple such nodes. Each is the "root" of a sub-tree with pages that have a distinct logo, style sheet, or layout. Think of different departments. What should I name...

nonvirtual interface idiom for more than two levels of inheritance?

The non-virtual interface idiom describes how the virtual methods are nonpublic customisation points, and public methods are nonvirtual to allow the base class to control at all times how the customisation points are called. This is an elegant idiom and I like to use it, but how does it work if the derived class is a base class in itse...

Class design vs. IDE: Are nonmember nonfriend functions really worth it?

In the (otherwise) excellent book C++ Coding Standards, Item 44, titled "Prefer writing nonmember nonfriend functions", Sutter and Alexandrescu recommend that only functions that really need access to the members of a class be themselves members of that class. All other operations which can be written by using only member functions shoul...

Class structure pattern question. What should I choose?

What are (if any)the implied assumptions or restrictions and the differences of designing like: A) this: class SampleClass1 { IWorker workerA; IWorker workerB; void setWorkerA(IWorker w); void setWorkerB(IWorker w); WorkResult doWork(); } B) versus this: class SampleClass2 { WorkResult doWork(IWorker workerA...

Which you think is the best class design tool for .net?

Do you use visual studio's class diagram generator? Or, do you suggest any other better tool? The main features I'm expecting out of such a tool are: Ability to generate C#/VB.net code skeletons Ability to reverse engineer C#/VB.net code (Ability to update class diagram if I modified my source code) Integration with Visual Studio, if ...

OO vs. Layered; balancing "OO purity" with getting things done

I believe in OO, but not to the point where inappropriate designs/implementations should be used just to be "OO Compliant". So, how to deal with the Serlvet/EJB/DataContainer layered architecture: Servlets receive requests and call a "business layer" (e.g. session EJBs) The business layer locates DataContainers from the database and m...

Modelling Related Objects

I'm designing an application which deals with two sets of data - Users and Areas. The data is read from files produced by a third party. I have a User class and an Area class, and the data is read into a Users array and an Areas array (or other appropriate memory structure, depending on the technology we go with). Both classes have a ...

How should I split large and bloated classes into smaller ones?

I have a large 'Manager' class which I think is doing too much but I am unsure on how to divide it into more logical units. Generally speaking the class basically consists of the following methods: class FooBarManager { GetFooEntities(); AddFooEntity(..); UpdateFooEntity(..); SubmitFooEntity(..); GetFooTypes(); GetBarEnti...

Encapsulating an algorithm into a class

I'm wondering how (un)common it is to encapsulate an algorithm into a class? More concretely, instead of having a number of separate functions that forward common parameters between each other: void f(int common1, int param1, int *out1); void g(int common1, int common2, int param1, int *out2) { f(common1, param1, ..); } to encapsula...

Garbage with pointers in a class, C++.

I am using Borland Builder C++. I have a memory leak and I know it must be because of this class I created, but I am not sure how to fix it. Please look at my code-- any ideas would be greatly appreciated! Here's the .h file: #ifndef HeaderH #define HeaderH #include <vcl.h> #include <string> using std::string; class Header { public: ...

Class data responsibilities

I have a 'Purchase Order' class. It contains information about a single purchase order. I have a DAO class for database methods. Where should the responsibility reside for the methods that will load and update the purchase order? Should the PurchaseOrder class have '.update', 'insert', 'delete', and '.load' methods that use the DAO cla...

Class design with vector as a private/public member ?

what is the best way to put a container class or a some other class inside a class as private or a public member? Requirements: 1.Vector< someclass> inside my class 2.Add and count of vector is needed interface ...