CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brendan Tompkins [MVP]

Blog First. Ask Questions Later.

Boilerplate Entities?

I'm finding myself creating a bunch of basic Entity objects, like MailStop, Contacts, etc and I'm wondering if anyone knows of any boilerplate entity designs out there?  Specifically, I'm finding myself wondering if my MailStop object should contain a CityStateZip object, how many street properties, etc.  Suff like that mostly.   I know there must be some best practices for this sort of thing out there, but I can't seem to find anything short of books on the subject.  Anyone have any good sources? 

And here's another thought.  Wouldn't it be cool to have a boilerplate entity project on GotDotNet? Would this be useful?  



Comments

Paul Laudeman said:

Here is a good resource to get you started:

http://www.xml.org/xml/registry_searchresults.jsp
# July 17, 2004 9:37 AM

Eric J. Smith said:

Have you looked into using a code generation tool like CodeSmith?

http://www.ericjsmith.net/codesmith/
# July 17, 2004 6:11 PM

Brendan Tompkins said:

Eric.. Yes. I've heard lots of good things so far and have a copy of the demo...

Definitely will be a part of my entity framework solution. Right now, I'm hand coding my stuff so I have a good handle on what needs to be generated.. Currently wallowing in ITypedList implementation to do complex databinding.. uggh.

# July 18, 2004 7:40 AM

Benjy said:

Nice idea.

There is a book like this for Data modeling called the data Model resource handbook. In OO though, you might have to make distinction between boiler plate entities for Analysis models vs those for design models, but all in all an excellent Idea. I'd love to contribute.
# July 27, 2004 9:48 AM

Jimmy Nilsson said:

Hi Brendan,

I'm pretty sure that you will find this book worth a look:
"Enterprise Patterns and MDA. Building Better Software with Archetype Patterns and UML" by Jim Arlow and Ila Neustadt.

Best Regards,
Jimmy
www.jnsk.se/weblog/
###
# July 27, 2004 10:20 AM

Brendan Tompkins said:

Benjy, Jimmy.. Thanks for the pointers, I'll definitely look into these books. I'm still wondering if something like this would be useful. On the one hand, it'd be nice to have boilerplates for stuff like contact info, addresses, orgs, currency, etc. On the other hand this stuff is pretty easy to come up with yourself, and most of the hard work goes into domain-specific modeling.

What would be nice to have done for you would be base classes that handle the overidden equality methods and collections.

I'll give you a for example of something that's been bugging me: What's the best way to structure an address class? Does it have a sub-city state zip obejct? A sub country object? Should it be flat?

-Brendan
# July 27, 2004 11:37 AM

Benjy said:

Brendan,
Awfully sorry about the late reply to your post. I havent had much time to browse recently.Been stuck in a very hectic project.

I think reference models are always a good idea cos people can look them up and find things that they might have missed. They dont have to be copied and implemented in projects AS-IS. They can be accompanied with notes indicating where designs differ, such as the case you have pointed out and people can make up their minds about which way they want to go. So all we really need to setup is a set of pages with sketches and notes and take it from there.

In reply to the Address thing, I would say that it depends on the scope of the component. A highly generalized component would need the sub-object because you could then put in a RegEx based validation in the class that could handle validations based on whether it is a US address or a European address etc. But if you are building a completely local system that wont be used across the world, then you could settle for a fully flat structure which would be easier to handle and probably much faster too.

I had a discussion regarding Financial domain objects with a colleague sometime ago and we looked at scenarios such as Social Security Numbers or NI numbers (in UK) , Employee Ref Numbers etc and we had two options

(a) Either create a generalised entity called ReferenceData and have a IClassifier type interface on it so we can store all types of references or
(b) just create an EmployeeMiscInfo object and store it all which was easier for the small scope of the project we were looking at .

Hope this helps.

Benjy
# October 28, 2004 5:07 AM

Brendan Tompkins said:

Thanks Benjy! Interesting stuff.
# October 28, 2004 6:02 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Brendan Tompkins

Brendan has been programming with .NET since the first public beta and is owner and operator of Port Technology Services, a consultancy company providing .NET application development services to the Maritime industry. In July, 2007, he was awarded the Microsoft MVP award for ASP.NET. He's also a proud co-founder of failed .COM startup Intrinsigo, and has had a hand in the failure of numerous other businesses. He currently runs CodeBetter.Com and Devlicio.us, and lives in Norfolk, Virgina with his wife Tiara and son Ian.

View Brendan's profile on LinkedIn

Check out Devlicio.us!

Our Sponsors