Category Archives: General Development

New classes for improved readability

In general design decisions are driven by either implementation problems or desire to improve readability. Interestingly I have found that for me the latter often drives refactorings inside existing classes but rarely creation of new classes. However creating new class to make important domain constraints or business rules explicit can be much more expressive than just introducing some new local variable or method.

Continue reading

Implementing validation using validity scopes

In a typical business web applications there are following common options for validating business rules:

– Validator, usually in presentation layer which checks rules related to single UI form or Presentation Model object
– Service in domain layer which validates input parameters of its business methods
– Entity or Value Object in domain layer which validates changes made to its state

All of these have their benefits and tradeoffs hence it usually doesn’t make sense to apply only one strategy for all types of rules. One possibility for establishing common validation guidelines for the application is to use the concept of validity scope.
Continue reading

Domain model implementation consideration – dealing with presentation-domain model mismatch using rich domain model

Sorry about the title 🙂

In a typical data management system significant amount of effort is spent on implementing mappings between three different models – presentation, domain and persistence model. In this article I will describe one approach to dealing with these transformations in case special ORM tool cannot be used.
Continue reading

Do the simplest thing that works cause you ain’t gonna need it anyway

One widely known agile principle is Do the Simplest Thing That Works. Often this guideline transforms into “Do the Fastest Things that Works”. I suppose that the logic behind this is that if something can be done fast then it must be simple, right? Problem is that given principle is as much about simplicity of reading the code than it is about writing it.
Continue reading

About complexity

It seems to me that the complexity of any system (solution) that doesn’t contain unnecessary redundancy is constant given the set of requirements is has to fulfill. It is only possible to redefine that complexity – to move it from one level to other but one cannot reduce it. So what are the possibilities to tackle with complexity? Basically we can either abstract or partition.
Continue reading