2009-04-06

How to get (rid of) Anemic Domain Antipattern coding multitieried enterprisey application

Programmers want to make "good designed", "enterprise like" application. So keeping in mind boxy schema of multitiered application they start to organize code into separate layers like most common DAO,Service and Domain. Very often that way leads to Anemic Domain Antipattern. It's characterized by "dumb" C struct like domain objects without logic in methods.

The mechanism is simple: programmer wants to keep layers separate and dependent only on common interfaces. To reduce wiring and simplify initial development DAO object are connected to Service layer which uses also Domain objects. Service layer is filled by Script like methods, written in procedural style. That way of development is easy at the beginning. So main logic goes to Services "layer" and data operations go to DAO layer. After some time Services become really fat, but domain objects gain only more attributes and accessor methods. As long as application is a kind of a prototype, or just is small everything works quite good.

But to get more benefits of object oriented programming in future, we need net of more "intelligent" domain objects "talking" to each other, not just logic closed in services layer scripts. At this moment that could only be done by total refactoring, or just by designing from scratch using experience from previous implementation. Just keep in mind mantra encapsulation, reusability, simplicity.

The simplest cure to that antipattern is to design "good wiring" at the begging, to give domain object direct access to DAO layer, and other low level services needed by domain logic. Then, domain can evolve easy into more complex structures, needed by bigger "enterprise" applications.

2009-04-01

Another point of view on Object Oriented Programming problems

It's not another article about OOP pros and cons.
I want to present you a non orthodox example of dealing with common programming problems without using standard OOP patterns.

The site is for some time on the web already, and presents controversial articles about OOP and SQL criticism.

I don't agree with author's overall point of view, but many ideas are very usable in specific simple applications development, and some of patterns presented there could be found in current RAD frameworks.

Just read and brainstorm.

2009-03-23

Planning to build own cellphone based sleeptracker project

I'm using Sleeptracker, but I need something to get better data that it provides, and have more flexible work modes.
There are many interesting projects with custom devices based on micro-controllers. I used to solder small electronic devices in past, but now I'm maybe too lazy and just looking for some pragmatic device, that looks and works good. It's fun to make design of own device but there are many ready small computing platforms with suitable features.
I'm thinking about cellphone, or maybe smart-phone, with built in accelerometers and available free software development tools for developers. It needs to have accelerometers and API to get acceleration data from it.

That kind of device has nice features:
  • it's programmable so you can put any features you think about
  • compact size, good for wrist attachment (ok maybe little too big, but make some trade off)
  • built in battery with quite long operating time and possibility of charging
  • possibility to use other input devices to get data like camera to get light level, or microphone to catch noises
  • builtin gprs or wifi to send data to server
  • of course its still cellphone

The biggest problem may be lack of API to needed devices. New devices are more open than in those in past, but some vendors still don't expose access to internal services.

2009-03-20

Switched from Blogspot to new custom domain

I have switched to new custom domain:

itprolife.worona.eu

I'm still testing it so DNS problem while getting to my site are probable.

2009-03-18

Minor health problems - work is not everything

I caught a cold and get some stomatological problems. I was unable to make more complex tasks for a longer time, I just needed a rest. That focused me on myself and my health shape. Sitting in the front of computer doesn't make me fit and healthy.

My RescueTime report states efficiency score:

EFFICIENCY 1.58 for 28h 39m
AVG. USER EFFICIENCY 0.53 for 9h 27m



Maybe I have wrong RT settings, or my development and personal productivity categories kick in, as I spend a lot of time working. Maybe too much time.