UML Hidden Gems

UML. Ouch. OK, Diego don't you have some newer or shinny or sexy to talk about. Well, it's 2020 right? So jokes apart.  UML is modeling language from the 90s. Software Architecture and Software Engineering evolved a lot in 30 years. So is UML still relevant? IMHO Yes and No. The part that I dont think it makes sense is the notation part of the formalism part. Visual diagrams can be simple enough to be understood and you can survive without notation language. So if UML is not about the notation what is about? Or why there is value in UML in 2020? Questions that I intend to Answer in this very blog post - Let's get started.

Why UML is not so popular any longer?

UML was very popular at the beginning of OOP solutions such as Smalltalk, Java, and even .NET. UML was popular not only because of that languages but also because the process of the time was RUP and CMMI meaning they endorsed and highly recommended UML. So there was huge marketing and promotion of UML. Like most the successful stories on technology, things ascend and become mainstream and then people misuse until they get consumed by themselves and they fade and die. That pattern in summary:

 1. Marketing and endorsement by big company or process or movement

 2. Mainstrain happens (Everybody is doing and want to be doing it). 

 3. People do it completely wrong (when they dont need it, they dont even think about it). 

4. Issues happens, next thing appears

5. REPEAT

So that cycle happened so many times with some many things such as :

* UML 

* Java

 * Agile

 * Docker

 * SOA

 * Microservices 

I guess the next ones easily can be Serverless and Kubernetes. SO UML was part of that cycle. However there good things there. But first, let's talk about the issues.

The issue with UML of the past

The issue was that UML was used without any thinking. Basically as just a form of "Compliance". What I don't like about compliance is that always can be "gamed" and you "fool" yourself thinking I'm doing the right things, are you? 

During RUP/CMMI people used UML for all the wrong use cases such as CRUD and problems that were not complex at all - then what happens? WASTE. So people like always throw the baby with the bathwater. Every time people do something they dont fully understand(we arrived at this anti-pattern). So UML often was related to Waterfall, Big-Design-Up-to-Front, WASTE, Compliance, and low value-added and solutions that did not work nor made sense. 

The UML Hidden Gems

UML hidden gems are about breaking the inertia and supporting your thinking. UML will not "think for you" but will help you to figure out the right solution. There are 3 diagrams that have extreme value. Being the following:

  * Use Cases Diagram 

  * Class/Package Diagram

  * Sequence Diagram

Use Cases Diagram: Allow you to THINK about your use cases. Meaning what scenarios do you have? What different things do you need to support? What is your problem domain? Would requirements be better for that Diego? IMHO I dont like requirements. Requirements for Lean is just a WISH LIST or a set of decisions someone made. IMHO we need more. We need to explore the problem space. 

Class/Package Diagram: Allow you to think about Where you will put your code. Allow you to figure out external dependencies and internal coupling with other modules/packages. This is super important but the real value comes when we combine these 2 diagrams with a sequence one. 

Sequence Diagram: Sequence Diagram has value because they allow us to think, step by step on what the system needs to do. In order words Sequence and Class diagram and the Bread and Butter for thinking about complex workflows and structure. You should not create all classes and have all sequences in these diagrams. You also should not do it for cruds. 

For complex problems, the combination of these 3 diagrams allows you to:

 * Anticipate issues

 * Find Design Gaps

 * Find Corner Cases

 * Think about the solution(Algorithms) before you code it. 

 * Save re-work and re-design by shipping the wrong solution 

Sequence and class diagrams are like eggs and chicken. There is no specific order, one helps the other, I often do both at the same time. This sounds great, should I do it for all the things. No. Not all problems are hard, not all problems take multi-quarters. Design on-demand is completely fine for simple problems. The more coupled you are, the more moving parts you have, the more "in-between" systems you are, the more you need to think. There are also other great modeling tools that can help you to figure out similar findings such as DDD and Event Storming.  

Remember the bottleneck is not typing but thinking. 

Cheers,

Diego Pacheco

Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java