Skip to main content

Posts

Showing posts from January, 2012

Changing the mindset - part 3 / 4 - Segregation of Responsibility

In the previous part we created quite verbose object oriented Model of our Domain. The Domain itself is extremely simple, but try to imagine your Model, which you are working on day by day, that would be so explicit. Wouldn't be easier to understand it? Whatever you can do on an object, you do it directly through methods, which names and arguments, comes strictly from the Domain Language. And even those objects' names come from this Language too. Well, this is just OOP done right, isn't it? There is actually one issue with that approach. We want to show some of the data to the user. And if so, then we have to expose internals. So in addition to our well-crafted, encapsulating behavior methods, we have leaky getters... Clean the model Let's do something that may look a little strange for the first time. Remove those getters. For a moment don't think about the View. Doesn't the Model look pure and clean without them? It has only behavior as a bo...

Changing the mindset - part 2 / 4 - Modeling the Domain

In the previous part we created Anemic Entity Match which was connected to another Anemic Entity Team , and they both were ruled by a Service MatchService . We had a bunch of getters and setters in them, which could be executed from any place that we can imagine. We didn't have any behavior in our domain objects. As I previously said, it can be a very good approach... Of course, if you are writing your code in C or Pascal... ;) After all - doesn't those, so called, Entities look like structures or records? And please do not tell me, that getters and setters are encapsulating the state... If we consider ourselves to be Object Oriented Programmers, than we have to start thinking differently. It is not enough to make our objects out of data. We have to teach them how to act. Where to start? OK, so we want to start changing the way we think to more Object Oriented, but where should we begin? If we cannot just define the data and put it into structures, where ...

Changing the mindset - part 1 / 4 - Classic approach

There are a lot of materials how to model Aggregates and Entities in Domain Driven Design . There are also a lot of materials how to manage your Event Stores, when you are applying Command Query Responsibility Segregation with Event Sourcing . And definitely there are a lot of materials how to combine those ideas together. However, I cannot find any articles about the way that developer’s mindset (and his code) is being changed when he tries to leave the Anemic Domain approach and goes into the deep with all the concepts mentioned above. So let’s take a closer look at it. I will provide an example and try to depict how my mindset was changed when I was adding new things to my code. I will use a very simple domain and model it in the easiest possible way, so as not to obscure the picture. This is the first article out of four that I will write in the nearest future, so stay tuned. One can debate if my approach to modeling the domain is the best, but for this series, I th...

2011's mindfucks

Do you know what mindfuck is? Quoting the urban dictionary : An idea or concept that shakes one's previously held beliefs or assumptions about the nature of reality. I like this definition, but I would widen it a bit. This idea or concept doesn't have to be based on held beliefs nor assumptions. It can also broaden the horizon by introducing something completely new. However this has to really change one's perceiving of the reality. Once you see it, you will not be able to miss it again. The 2011 has gone and it is a part of the past right now. It is a good moment to stop for a while and look backwards to see what has happened during the last twelve months. There were two people who messed up in my head in the previous year. I met both on conferences in my home city, Kraków (Cracow). The first person was Linda Rising. I haven't heard about her before, but she gave such a great prelection on the 33rd Degree , that I decided to dig deeper with her work and I d...