Skip to main content

Posts

Maintaining Legacy Software

Weeds "Weed is a plant that has ended up in the wrong place. Either it got there through carelessness or it has been allowed to germinate and grow from being insignificant. "(New Farmers Handbook) Software is full of weeds. With weeds in this case I mean badly architectured software and not pure bugs. But, believe me: bugs arize from this later even if the are not there yet. This is not only from sloppy programmers and architects. In my last  blog post  I wrote about architecture in legacy software and with weeds I mean parts of the software not adhering to the architecture. Vines going between  layers in the chosen software model. When creating an architecture we often have high ambitions. Whichever framework we use: Domain Driven Design, Model View Controller or similar. Folders and modules created for the then current ways of working and separation of concern. Since starting work, the product owner has ordered thins and you have had to solve problems. You are...

Architechture Legacy Software

The software developer has typically used the engineer as a model. This is obviously sprung out that we are dealing with technology. We build stuff! Our line of work grew out of electrical engineering and mathematics, hand in hand, it became a new profession. Development also has a soft side that you might not see from the outside and all developers not themselves discover. They become stuck in problem solving and happy that things are working. Programmers borrows many words from linguists. We have the language to describe what we do, languages have a grammar and helps us to communicate. Communication is not only between us and the computer, but also with other developers. Really well written programming code can be like poetry for those who understand it. Code is in many ways a cultural manifestation, almost art. Most books and articles we read about software development often describe an ideal stage. You get recipes on how to make the project design and how to write their code to...

Building Blocks in DDD

In addition to having a common language with domain experts, the developers need a common language. There are a number of standard patterns that reoccur in DDD. Characterization of these is a vital in the domain-driven design. Sometimes it's pretty obvious which category a particular class belongs to but other times it's not so easy to sort out the different building blocks of a model-driven design. Using standard building blocks helps. Application Context In the appli c ation- c ontext all the objects that depend on the infrastructure that the application runs in are created . This allows to easily replace parts of the system, such as which database to use. Do not mix this together with the bounded context. The application initiates the application and is a class, while the bounded context is about working on the conceptual level often realized at as packages in Java . A good way to make the application context is to have a generic context that give singleton insta...

Bounded contexts

Now we are entering the main part of DDD: To model the domain. Context Context - The environment in which a word or proposition that determines it's meaning. Bounded contexts are a breakdown of the domain. All major projects covering different sub-models and when the code based on the different models are combined, it can become complex. Communication to and from, and within the team gets confusing. It is often not clear in which context one model should not be applied. The model must be divided in limited contexts with clear interfaces to other parts of the system. Each bounded context shall be independent of the others. When a number of people working in the same bounded context, there is a risk model becomes fragmented. The more people who are inside, the greater the problems. This breaks down the system into smaller contexts and eventually lose the integration and coherence. There must be a process of merging all code and other artifacts with automated testing. Use the ...

Layers in DDD

Separation of Concerns The main objective of DDD is to create separation of concern to keep the system stable. The term Separation of Concerns means in computer programming to use different mechanisms to separate things that do not have with each other to do. The most known is might be the MVC pattern with separates Models, Views and Controllers. Here we are not talking about MVC: We are talking about DDD but of course these patterns can be combined to some extent. The separation takes place in two different directions in DDD: Bounded contexts that I will return to in a later post. DDD people often talk about something called a hexagonal design. As I never have found any good explanation of why the authors use the hexagon symbol I do not use it, but it might be good to know that the term exists. The hexagonal design is intended to divide up the application in the parts and control how they communicate with each other. Sometimes called the pattern also is called Ports and ...

Working with DDD - Domain, Model and Language

There are a lot of concepts that is important for DDD. The most important ones are the Domain, the Model and the Ubiquitous Language. Domain A sphere of knowledge (ontology), influence or activity. The subject that the user is working a program on the domain of is software. The domain in DDD is the problem space. The corresponding solution space is called the model. Model A system of abstractions that describe selected aspects of a domain and can be used to solve the problems associated with that domain. With DDD, we are looking to create models of the domain. Things which often places great effect at the beginning of a project, such as persistence, user interface and protocol. Model does not mean a graph or set of graphs e.g. UML. Charts are useful, but they are not the model, just different views of the model. The model is one that we choose to implement in software, represented in the code used to construct the system. The code itself is the model. This gives certain expec...

Domain Driven Design

A couple of year old trend is DDD. I love a lot of the ideas behind DDD, but the people talking about it can be really annoying. They talk a lot how DDD is not the strategic and tactical patterns that most of the books on the topic covers on 90% about the pages. They have seen some kind of light that is greater. I like to take a more pragmatic look of it: What can I use of this to build great software. Domain Driven Design (DDD) is a method of creating a software architecture. The basis for domain-driven design is to start from domain experts' knowledge and allows the software a model of the domain and its processes: base the design on a model of the domain  you have a creative collaboration between developers and domain experts to refine a model  establishing a ubiquitous language shared between developers and domain experts  The idea is to start from the business and not in the technical part. Domain-driven design also presents a set of patterns for building ap...