Rethinking Best Practices

Ah, J2EE best practices — the community’s way of figuring out how to work with flawed technologies… You know, the Session Facade, Data Transfer Objects, etc. — they are ingrained in so many developers’ brains to the point of being second nature… It feels almost instinctual to design your system with them — putting your data over here in these classes, putting your logic over there in those classes…

Problem is, now that JEE 5 is becoming more common, those best practices are all wrong… ok, in most cases they won’t necessarily cause any harm (at least not of the magnitude of not following best practices about 5 years ago), but there are now better ways of doing things — we just need to learn what they are…

I’ll touch on a number of these in future posts, but I find that the area I have a lot of trouble with is getting rid of my habit to separate my data from my logic… the Session Bean/Entity Bean separation, in my opinion, is one of the more damaging patterns that was literally forced upon developers who went down the EJB path in the early days, and it’s a pattern that I’m not convinced is completely fixed yet… more on that in a later post…

Personally, my ‘toy’ projects are partially intended to get me thinking away from this — when it comes down to it, it’s all about trying to relearn those object oriented design principals, incorporate some newer techniques like Domain Driven Design, and just experiment in whatever way suits my fancy…

The first thing I do is put together my initial design in some form — either code, UML, a drawing, whatever… then I do it again, and look for specific flaws, like classes with only data and no behavior and vice-versa… of course, these scenarios aren’t always wrong, or even bad, but each time I go through this retrospective, I get a little better at identifying these issues to start with…

Do you have similar experiences? Spill the beans, let us know!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s