class-hierarchy

Best Way to Organize PHP Class Heirarchy

I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure from the framework's structure, or is buliding on top of the framework not such a bad thing?...

Class and Interface hierarchies in Entity Framework?

I have two related classes which share a common interface and are both stored in the same underlying database table. However, the Entity Framework generates one common class, where I really need the two distinct classes. How do I resolve this? Is it best to use a base class rather than an interface? How do I change the EF model to provid...

Tool to Show Class Hierarchies in .NET

Is there a way/tool that could show me all the classes/interfaces that implement a certain interface in my project? In Eclipse (Java) I would use the context menu "Open Type Hierarchy" option, which would show me a (pretty) tree of types that extend the selected type. Is there a tool to do the same in .NET? ...

Table per Concrete Class Hierarchy in Hibernate

I have the following Hibernate Mapping, which has to be mapped using the Table per Concrete Class Hierarchy: <hibernate-mapping package='dao'> <meta attribute='class-description'></meta> <class name='PropertyDAO'> <id name='id' column='id_property'> <generator class='assigned'/> </id> <property name='address...

NHibernate - Changing sub-types

How do you go about changing the subtype of a row in NHibernate? For example if I have a Customer entity and a subclass of TierOneCustomer, I have a case where I need to change a Customer to a TierOneCustomer but the TierOneCustomer should have the same Id (PK) as the original Customer entity. The mapping looks something like this: <cl...

How to link "parallel" class hierarchy?

I've got a little class hierarchy where each class corresponds to a certain TComponent descendent (say base class TDefaultFrobber with descendents TActionFrobber and TMenuItemFrobber, corresponding to TComponent, TCustomAction and TMenuItem, respectively). Now I want a factory (?) function something like this: function CreateFrobber(ACo...

.NET Object Hierarchy - To Event or not to Event

Your job is to design a Project Plan class library which supports the tracking of tasks (similar to how MS Project works). This class library has a Task object (among others). The Task object has a EstimatedHours (Double), StartDate (DateTime), and EndDate (DateTime) properties, among others. A Task object can have one parent Task, and...

Serializing POCO Excluding Class Members

I wish to make a POCO [Serializable] but not any other class members in its class hierarchy tree. I know there is [NonSerialized] which works only for fields, but is there any way to exclude them or choose specific members using [Serializable] on the POCO? ...

Is there any relation between the class that implements interface and that interface???

Consider this class hierarchy: Book extends Goods Book implements Taxable As we know, there is a relationship between a subclass and its superclass (is-a). Q: Is there any relationship like "is-a" between Book and Taxable? GOOD Answers, but you said that "is-a" is also a relationship between Book and Taxable, but "is-a" is a relati...

Is there a way of finding what .NET classes implements a certain interface?

For example if I wanted to see what my .NET options were for something implementing IList or IDictionary. Is there a way to find that for example in the MSDN documentation? ...

Application to generate Java class hierarchy diagram

Looking for a tool that: Produces a visually appealing, orthogonally structured graph hierarchy Outputs high-quality PNG images (300dpi+) Visually differentiates classes, abstract classes, interfaces, and enumerated types (preferably by colour) Interactive user interface Allows pruning of packages and/or individual classes from the dia...

I need to implement C# deep copy constructors with inheritance. What patterns are there to choose from?

I wish to implement a deepcopy of my classes hierarchy in C# public Class ParentObj : ICloneable { protected int myA; public virtual Object Clone () { ParentObj newObj = new ParentObj(); newObj.myA = theObj.MyA; return newObj; } } public Class ChildObj : ParentObj { ...

Does ruby provide a method to show the hierarchy calls?

That's all, i want to see what are the clases that inherits a fixed class. There is a method for this in RUBY? Aptana offers an option that shows this, but is there any method? Thanks ...

create hierarchy in non parent child dimensions

I am creating a user hierarchy for product dimension with AdventureWorksDW in a cube. I have added Product Key, ProductCategory Key and Product Subcategory Key attributes. But, its always giving me a warning "create hierarchy in non parent child dimensions" as a tooltip as I hover my mouse pointer over the Dim Product in Attributes windo...

Changing type of a field in C# at runtime

Hi, I have an existing heirarchy of classes, say something like this: Business - Division - ProjectTeam - Employee These classes are instantiated via deserialization. However, now I need to expose extra fields in the Employee for a particular user of the library i.e. say something like this: SpecialBusiness (extends Bus...

C#: Unit testing of child classes

Say we have this hyper simple class hierchy: public class SomeMath { public int Add(int x, int y) { return x + y; } } public class MoreMath : SomeMath { public int Subtract(int x, int y) { return x - y; } } Should I write tests for the Add method when I write tests for the MoreMath class? Or sh...

What design should I use so a class can query one of it's ancestors?

I'm creating an object hierarchy that is representing a table that is draw on a control. My hierarchy looks like this : Table has multiple pages Page has multiple lines Line has multiple cells Cell has multiple glyph I want to have an option (a parameter) on the table to filter the column (cells) displayed. The client code can do some...

Spring JDBC RowMapper with Class Hiearchies

I wanted to know what the community considers the "best practices" in respect to mapping class hierarchies with Spring JDBC. We do not have the ability to use a full fledged ORM tool, however we are using the Spring JDBC to alleviate some of the tedious nature of JDBC. One class which we leverage very regularly are the BeanPropertyRo...

Java: How to write method to accept child without casting to parent?

Not sure how to title this... So I've got three child classes of Event: WeightEvent, TimedEvent, RepEvent. Through whatever means, I get an object of one of the children. Now I want to send that child event to a method in another object so it can pull the data from it with the getSavedEvents() method. The method only exists in the child...

Domain Driven Design - Entities VO's and Class Hierarchy

The shorter version of the Question: "Is it ok to have a superclass, with 2 subclasses, one is an entity the other is a Value Object?" To longer version: T have a Team superclass. The Team has the Master, Helpers and a Code. Then i have the DefaultTeam, subclass of Team, which is an entity with an unique *Code* has its domain identity. ...