{"version":"https:\/\/jsonfeed.org\/version\/1","title":"ralfw-de","description":"","home_page_url":"https:\/\/ralfw.de","feed_url":"https:\/\/ralfw.de\/feed.json","user_comment":"","icon":"https:\/\/ralfw.de\/media\/website\/logo-smaller.png","author":{"name":"Ralf Westphal"},"items":[{"id":"https:\/\/ralfw.de\/fluessiger-bloggen\/","url":"https:\/\/ralfw.de\/fluessiger-bloggen\/","title":"Fl\u00fcssiger bloggen","summary":"Es ist stiller geworden auf meiner Homepage - denn meine Aktivit\u00e4t habe ich auf einen Newsletter verlagert: https:\/\/ralfwestphal.substack.com\/. Wahrscheinlich w\u00e4re eine Abnahme meiner Aktivit\u00e4t sogar eine nat\u00fcrliche Entwicklung \u00fcber all die Jahre. Immerhin schreibe ich seit 2003 Blog-Artikel. Dass ich nach knapp 20 Jahren nicht&hellip;","content_html":"<p>Es ist stiller geworden auf meiner Homepage - denn meine Aktivit\u00e4t habe ich auf einen Newsletter verlagert: <a href=\"https:\/\/ralfwestphal.substack.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/ralfwestphal.substack.com\/<\/a>.<\/p>\n<p>Wahrscheinlich w\u00e4re eine Abnahme meiner Aktivit\u00e4t sogar eine nat\u00fcrliche Entwicklung \u00fcber all die Jahre. Immerhin schreibe ich seit 2003 Blog-Artikel. Dass ich nach knapp 20 Jahren nicht mehr so ideensprudelnd bin, kann ich mir eigentlich nicht verdenken.<\/p>\n<p>Einerseits. Denn andererseits haben mich gerade die letzten beiden Jahre gedr\u00e4ngt, einiges zu schreiben - nur nicht unbedingt \u00fcber die Softwareentwicklung. Die Corona-Jahre haben mich tief bewegt und ich musste \"da etwas loswerden\". Das passte allerdings nicht zu meiner softwaretechnisch orientierten Homepage. Also habe ich angefangen, auf anderen Plattformen zu bloggen.<\/p>\n<p>Interessanterweise fiel mir dort der Schreibprozess auch leichter; ich konnte wieder fl\u00fcssiger schreiben. Die Editoren zuerst bei medium und dann bei Substack waren schlicht besser als der f\u00fcr meine Homepage. Und das live Schalten von Beitr\u00e4gen war auch etwas einfacher. (Seit einigen Jahren habe ich mich von Wordpress f\u00fcr meine Homepage verabschiedet und setze auf static HTML; so habe ich keine Last mit irgendwelchen Plug-Ins oder Cookies. Alles so sch\u00f6n schlank mit <a href=\"https:\/\/getpublii.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Publii<\/a> und GitHub Pages.)<\/p>\n<p>Doch nach l\u00e4ngerer Zeit der Divergenz m\u00f6chte ich jetzt das Dortige zum Hiesigen hinzuf\u00fcgen. Deshalb gibt es im Blog-Men\u00fc einen neuen Eintrag: \"Newsletter\". Der verweist auf mein <a href=\"https:\/\/ralfwestphal.substack.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Substack-Blog<\/a>, das Substack <em>Newsletter<\/em> nennt, weil \u00fcber neue Beitr\u00e4ge immer gleich auch per Email informiert wird, wenn man sich als Abonnent eingetragen hat. Dieses Feature hatte meinem Blog in all den Jahren gefehlt.<\/p>\n<p>Die Beitr\u00e4ge hier auf meiner Homepage werde ich einstellen. Ich nutze sie nur noch f\u00fcr recht statische Inhalte, z.B. die Beschreibung meiner Trainings. Alles, was dynamisch ist, findet zuk\u00fcnftig bei Substack statt. Ich denke, das ich eine h\u00fcbsche Trennung im Sinne des <em>Separation of Concern<\/em> (<em>SoC<\/em>) Prinzips. (Ob das f\u00fcr SEO der Hit ist, wei\u00df ich nicht. Aber hinter dem besten Google-Ranking renne ich ohnehin nicht hinterher.)<\/p>\n<p>Mein Substack-Blog kann man per kostenlosem Email-Abo verfolgen oder sich als RSS-Feed in einen RSS-Reader wie <a href=\"https:\/\/reederapp.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Reeder<\/a> ziehen lassen. Ich bin seit einiger Zeit wieder Fan dieser alten Technologie; sie f\u00fchlt sich der Idee des Internet n\u00e4her an als die Social Media Plattformen.<\/p>\n<p>Bei Substack ist mein Blog in mehrere Kategorien unterteilt. So kann ich sowohl \u00fcber Technisches wie Gesellschaftliches und Politisches berichten, ohne dass es sich zu sehr in die Quere kommt. Auf der Hauptseite kommt zwar alles aus den Kategorien zusammen, doch wer sich nur f\u00fcr Technisches interessiert, kann sich z.B. auf den Newsletter \"<a href=\"https:\/\/ralfwestphal.substack.com\/s\/clean-code-development\" target=\"_blank\" rel=\"noopener noreferrer\">Clean Code Development<\/a>\" konzentrieren.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  style=\"color: var(--text-primary-color); font-family: var(--editor-font-family); font-size: inherit; font-weight: var(--font-weight-normal); outline: 3px solid rgba(var(--color-primary-rgb), 0.55)  !important;\" src=\"https:\/\/ralfw.de\/media\/posts\/152\/newsletter-screenshot.jpg\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-xs.jpg 300w ,https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-sm.jpg 480w ,https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-md.jpg 768w ,https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-lg.jpg 1024w ,https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-xl.jpg 1360w ,https:\/\/ralfw.de\/media\/posts\/152\/responsive\/newsletter-screenshot-2xl.jpg 1600w\"  alt=\"\" width=\"800\" height=\"646\"><\/figure>\n<p><span style=\"color: var(--text-primary-color); font-family: var(--editor-font-family); font-size: inherit; font-weight: var(--font-weight-normal);\">Ich wei\u00df, solche \u00c4nderungen bringen Unruhe in meinen Web-Auftritt. Sollte der nicht stabil sein und alles, alles auf der Homepage unter meiner Domain zusammenziehen? Ja, vielleicht. Aber ich m\u00f6chte neue Entwicklungen auch mitnehmen k\u00f6nnen, hier: eine Plattform, die das Bloggen und den Versand von Newslettern noch einfacher macht. Ich vertraue deshalb einfach mal darauf, dass der Effekt nicht zu negativ sein wird.<\/span><\/p>\n<p>Insofern: Ich w\u00fcrde mich freuen, wenn Sie mir auch zu Substack folgen w\u00fcrden, mit oder ohne Email-Abo.<\/p>","author":{"name":"Ralf Westphal"},"tags":[],"date_published":"2022-06-29T15:32:23+08:00","date_modified":"2022-06-29T15:55:48+08:00"},{"id":"https:\/\/ralfw.de\/wert-mehr-als-komplexitaet\/","url":"https:\/\/ralfw.de\/wert-mehr-als-komplexitaet\/","title":"Wert mehr als Komplexit\u00e4t","summary":"Wie misst ein agiles Softwareteam - gar eines, das Scrum einsetzt - eigentlich seinen Fortschritt? In Erinnerung sind mir da noch burn-down und burn-up Charts, in denen Story Points aufgetragen werden. Ist das aber wirklich hilfreich und zeitgem\u00e4\u00df? Interessanterweise kommen Story Points im Scrum Guide&hellip;","content_html":"<p>Wie misst ein agiles Softwareteam - gar eines, das Scrum einsetzt - eigentlich seinen Fortschritt? In Erinnerung sind mir da noch burn-down und burn-up Charts, in denen Story Points aufgetragen werden. Ist das aber wirklich hilfreich und zeitgem\u00e4\u00df?<\/p>\n<p>Interessanterweise kommen Story Points im <a href=\"https:\/\/www.scrumguides.org\/scrum-guide.html\" target=\"_blank\" rel=\"noopener noreferrer\">Scrum Guide<\/a> ja nicht mehr vor. Der erw\u00e4hnt zwar noch burn-down Diagramme f\u00fcr den \"forecast\" - auch der Begriff \"estimation\" ist aus dem Guide gestrichen -, doch was da heruntergebrannt wird, ist nicht benannt. Eine \"velocity\" findet ebenfalls keine Erw\u00e4hnung mehr.<\/p>\n<p>Damit h\u00e4ngen zumindest Scrum-Teams ein bisschen in der Luft, oder? Die Quelle der Wahrheit gibt keine Guidance.<\/p>\n<p>Nat\u00fcrlich h\u00e4lt sich die Praxis der Story Point Sch\u00e4tzung hartn\u00e4ckig und auch die Velocity steht in den meisten Scrum-Teams, die ich kenne, ganz oben auf der Beobachtungsliste. Konstante Geschwindigkeit ist das Ideal - auch wenn man inzwischen mit wissendem Blick betont, dass Geschwindigkeitsunterschiede normal seien.<\/p>\n<h2>Komplexit\u00e4t kaschiert Aufwand<\/h2>\n<p>Die Velocity ist die Zahl der Story Points, die pro Sprint umgesetzt wurden. Und Story Points stehen f\u00fcr eine Einsch\u00e4tzung der Komplexit\u00e4t einer umzusetzenden Anforderung, wie sie von den Entwickler eingesch\u00e4tzt wird.<\/p>\n<p>Eine vom Product Owner pr\u00e4sentierte Anforderungen wird diskutiert und dann wird in einem mehr oder weniger komplizierten Sch\u00e4tzverfahren eine Komplexit\u00e4t daf\u00fcr bestimmt. Die Komplexit\u00e4t ist ganz bewusst keine Sch\u00e4tzung eines Umsetzungsaufwands oder einer Umsetzungsdauer. Agile Entwickler lassen sich zu einer Zeitsch\u00e4tzung nicht mehr herab; dass die daneben liegen muss, wei\u00df doch jeder. Auf solche ein Spiel lassen sie sich nicht mehr ein.\ud83d\ude24<\/p>\n<p>Sie versprechen nur noch, dass sie eine bestimmte Menge an Anforderungsinkrementen mit einer bestimmten Komplexit\u00e4tssumme in einer festgelegten Zeit umsetzen.\ud83d\ude09<\/p>\n<p>Auch wenn Story Points keine genaue Dauer f\u00fcr eine Umsetzung angeben, ist allen Beteiligten nat\u00fcrlich klar, dass die mit der Dauer positiv korrelieren. Mehr Story Points f\u00fcr eine Anforderung bedeuten l\u00e4ngere Umsetzungsdauer. Ob 8 Story Points im Vergleich zu 5 Story Points nun genau 60% l\u00e4nger dauern oder nur 30% oder 100% oder mal so und mal so, das w\u00fcrde kein agiler Entwickler definieren wollen. Eine Komplexit\u00e4t von 8 ist eben nur h\u00f6her als eine von 5. Und eine von 13 ist mehr h\u00f6her im Vergleich zu 8 als 8 im Vergleich zu 5. Ich denke, dar\u00fcber gibt es keinen Zweifel.<\/p>\n<p>Alles andere w\u00fcrde auch keinen Sinn ergeben. Denn der PO will ja eine Idee bekommen, ob die Anforderung A in der Umsetzung wohl l\u00e4nger dauern wird als die Anforderung B. Denn wenn das so ist, k\u00f6nnte das f\u00fcr ihn ein Signal sein, A vorzuziehen - oder A zu verschieben.<\/p>\n<p>Eine Komplexit\u00e4tssch\u00e4tzung ist also eine verbr\u00e4mte Aufwandssch\u00e4tzung. Und ein Diagramm, das Komplexit\u00e4tswerte darstellt, stellt also Aufw\u00e4nde dar.<\/p>\n<p>Was sagt dann ein Velocity Chart aus? Dass man in einer Periode eine Komplexit\u00e4t bew\u00e4ltigt, gar \u00fcberw\u00e4ltigt und niedergerungen hat.\ud83d\udcaaEntwickler sind eben Helden! Jeden Tag schauen sie dem Komplexit\u00e4tsmonster unersch\u00fcttert ins Auge!\ud83d\udc79<\/p>\n<p>Das klingt irgendwie gut - nur was bedeutet das wirklich? Hat das einen Wert? Wenn ja, f\u00fcr wen?<\/p>\n<p>Wie gesagt: Sich die Komplexit\u00e4tsfrage zu stellen, ist eine gute Sache. Um sie beantworten zu k\u00f6nnen, muss man mit dem Product Owner ins Gespr\u00e4ch kommen. Im Gespr\u00e4ch erkundet man die Anforderungen. Alle werden sich dar\u00fcber klarer. Wo man gro\u00dfe Komplexit\u00e4t erkennt, mit der gro\u00dfe Unklarheit und Unverl\u00e4sslichkeit in der Umsetzung einhergehen, kann man sich um Reduktion schon im Vorfeld bem\u00fchen.<\/p>\n<p>Das ist alles super! Nur warum diese Werte tracken?<\/p>\n<h2>It's the focus, stupid!<\/h2>\n<p>F\u00fcr mich ist nur eine Motivation plausibel: Indem man Story Points nicht nur sch\u00e4tzt, sondern auch verspricht, die niederzuringen in einem Zeitraum, setzt man sich ein Ziel. Dieses Ziel soll fokussieren. Dieses Ziel soll einen\u00a0<em>sense of urgency<\/em> induzieren. Wer versucht ist, einer Ablenkung nachzugeben im Verlauf eines Sprints, der wird durch das Commitment auf eine zu erreichende Velocity zur\u00fcck ins Glied geholt. Und je gr\u00f6\u00dfer die zu bew\u00e4ltigenden Story Points, desto dringlicher ist der Fokus! Hohe Komplexit\u00e4t kommt mit gro\u00dfer Unklarheit; da z\u00e4hlt jede Minute im Sprint.<\/p>\n<p>Am Ende einer Periode kann man dann schauen, inwiefern der Fokus gegl\u00fcckt ist. Wurde die angepeilte Gesamtkomplexit\u00e4t bew\u00e4ltigt? Wenn nein, wo hat es gehakt? Oder war sogar Luft nach oben?<\/p>\n<p>Auf eine solche Retrospektive finde ich wunderbar. Man nimmt sich etwas vor und schaut am Ende, ob man es geschafft hat. Indem man sich etwas vornimmt, sich ein Ziel setzt, wird die Fokussierung bef\u00f6rdert. Im Zweifelsfall wei\u00df man immer, wo Aufmerksamkeit investiert werden sollte.<\/p>\n<p>Warum aber die Story Points zur Fokussierung benutzen? Reicht es nicht, die auch aus den Story Points abgeleiteten Anforderungen zu tracken? Am Anfang einer Periode stehen 10 Anforderungen zur Diskussion. Die werden in der Komplexit\u00e4t gesch\u00e4tzt. Dadurch werden daraus 12 Anforderungen. Von diesen 12 Anforderungen nimmt man sich f\u00fcr die Periode 7 vor. Fertig.<\/p>\n<p>Nachdem man sich f\u00fcr diese 7, das Sprint Backlog, entschieden hat, ist es doch egal, warum man das getan hat. Entweder man schafft alle 7 oder nicht. Am Ende der Periode kann man dann auf sein digitales Team-Kerbholz 7 oder auch nur 5 oder gar 8 Kerben machen und diese Anzahl einer Summe hinzuf\u00fcgen f\u00fcr eine kummulierende Darstellung.<\/p>\n<p>Wenn man den Plan unter- oder \u00fcbererf\u00fcllt, dann kann man gern dar\u00fcber reflektieren und dabei auch die Komplexit\u00e4tssch\u00e4tzungen heranziehen. \"Bei welcher Anforderung haben wir die Komplexit\u00e4t wieder zu niedrig eingesch\u00e4tzt?\" ist dabei wahrscheinlich die h\u00e4ufigste Frage.<\/p>\n<p>Ein Tracking der Komplexit\u00e4tssumme jedoch braucht es daf\u00fcr nicht. Das ist nicht nur nicht hilfreich, das ist sogar missweisend.<\/p>\n<h2>Fortschritt nur mit Wert<\/h2>\n<p>Softwareentwicklung soll kundenorientiert sein. Wert soll f\u00fcr den Kunden geschaffen werden. Wo ist der in einer Komplexit\u00e4tssch\u00e4tzung zu finden? Welche Wertentwicklung hat eine Software, wenn die Velocity stets \u00e4hnlich ist?<\/p>\n<p>Korreliert Wert mit Komplexit\u00e4t positiv? H\u00f6chstens schwach, w\u00fcrde ich sagen. So schwach, dass ein Diagramm, das die Entwicklung heldenhafter Komplexit\u00e4tsbew\u00e4ltigung zeigt, nicht mit einer kundenorientierten Wertschaffung verwechselt werden darf.<\/p>\n<blockquote>\n<p>Wert \u2260 Komplexit\u00e4t<\/p>\n<\/blockquote>\n<p>Was soll also ein Kunde davon halten, wenn ein Team in dieser Periode mehr und in der n\u00e4chsten weniger und dann wieder etwas mehr Komplexit\u00e4t bew\u00e4ltigt?<\/p>\n<p>Nichts!<\/p>\n<p>Komplexit\u00e4t interessiert den Kunden nicht. Oder sie interessiert ihn nur indirekt, wenn er eine Antwort auf die Frage will: \"Wann bekomme ich das Features, das mir sehr wertvoll erscheint?\"<\/p>\n<p>Entwickler geben darauf mit ihren Komplexit\u00e4tsangaben keine Antwort, selbst wenn die mit Aufwand positiv korrelieren. F\u00fcr eine so konkrete Prognose braucht es andere Mittel. Ich empfehle: <a href=\"https:\/\/ralfw.de\/magically-predictable-software-production-for-projects\/\">Vorhersagen basierend auf historischen Daten.<\/a> Aber das ist ein anderes Thema.<\/p>\n<p>Jeder Kunde kann unmittelbar den Fortschritt der Zeit sp\u00fcren. Die kostet ihn n\u00e4mlich gew\u00f6hnlich Geld auf die eine oder andere Weise, solange die Software noch zu w\u00fcnschen \u00fcbrig l\u00e4sst:<\/p>\n<ul>\n<li>Entweder der Kunde gibt f\u00fcr die Softwareentwicklung Geld aus.<\/li>\n<li>Und\/oder der Kunde kann einen Wert der Software noch nicht realisieren, weil ihre Feature fehlen.<\/li>\n<\/ul>\n<h3>Wert entsteht im Auge des Kunden<\/h3>\n<p>Nur der Kunde kann einer Software Wert beimessen. Ihr Produzent - Product Owner und Entwickler - k\u00f6nnen nur vermuten, was nach Auslieferung f\u00fcr den Kunden werthaltig sein k\u00f6nnte. Das ist sogar der Hauptantrieb hinter der Agilit\u00e4t! Dem Kunden soll m\u00f6glichst z\u00fcgig nach \u00c4u\u00dferung einer Idee f\u00fcr eine werthaltige Ver\u00e4nderung eine Umsetzung pr\u00e4sentiert werden, um zu \u00fcberpr\u00fcfen, ob die Hypothese des Kunden - denn mehr ist es nicht - stimmig ist.<\/p>\n<p>Das Entwicklungsteam vermutet, der Kunde vermutet ebenfalls. Softwareentwicklung ist eine komplexe Angelegenheit. Geradlinig ist der Weg zu einem werthaltigen Produkt nicht.<\/p>\n<p>Und was ist Wert f\u00fcr den Kunden? Ich glaube, das l\u00e4sst sich auf einen Begriff zusammendampfen:<\/p>\n<blockquote>\n<p>Nur <strong>Gewinnzuwachs<\/strong> stellt f\u00fcr den Kunden Wert dar.<\/p>\n<\/blockquote>\n<p>Wenn der Kunde heute 30.000\u20ac pro Monat Gewinn ohne eine Software macht, dann m\u00f6chte er morgen mit einer Software z.B. 15% mehr Gewinn machen, also 34.500\u20ac. Ob die Software hilft, den Umsatz zu erh\u00f6hen oder die Kosten zu reduzieren, ist dabei egal.<\/p>\n<p>Hier ein Beispiel f\u00fcr eine solche Situation f\u00fcr eine Periode von 3 Jahren:<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/151\/Bildschirmfoto-2021-01-30-um-16.13.54.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.13.54-2xl.png 1600w\"  alt=\"Gewinnentwicklung ohne Software\" width=\"312\" height=\"655\"><\/figure>\n<p>Ausgehend von einer solchen Vorstellung von Gewinnzuwachs durch eine Software, ist der Kunde bereit, erstens Geld f\u00fcr die Software auszugeben und zweitens auf die Softwarelieferung zu warten.<\/p>\n<p>Er k\u00f6nnte Beispielsweise bereit sein, 270.000\u20ac f\u00fcr eine Software auszugeben. Diesen Preis w\u00fcrde ein Gewinnzuwachs nach 60 Monaten (5 Jahren) wieder einspielen. Danach w\u00fcrde der Gewinn wirklich realisiert.<\/p>\n<p>Ob das eine zu lange Wartezeit ist, sei dahingestellt. Es geht mir um die prinzipielle Rechnung.<\/p>\n<p>Wenn die Softwareentwicklung im Wasserfall \u00fcber 18 Monate stattfinden w\u00fcrde, s\u00e4he die Gewinnentwicklung so aus ab Auftragsvergabe:<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/151\/Bildschirmfoto-2021-01-30-um-16.29.56.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.29.56-2xl.png 1600w\"  alt=\"Entwicklung der Software im Wasserfall. Gewinnzuwachs tritt erst nach vollst\u00e4ndiger Auslieferung ein.\" width=\"490\" height=\"688\"><\/figure>\n<p>Zuerst hat der Kunde 18 Monate lang Kosten von 15.000\u20ac pro Monat zu tragen; 50% seines monatlichen Gewinns investiert er f\u00fcr den sp\u00e4teren Gewinnzuwachs.<\/p>\n<p>Nach Auslieferung der Software fallen die Entwicklungskosten weg und jeden Monat liegt der Gewinn um 15% h\u00f6her als ohne Software. Der Kunde hat sein Ziel erreicht! (Dass es nie so einfach ist, ist mir klar. Prinzipiell sollte es aber so funktionieren.)<\/p>\n<p>Alle umgesetzten Anforderungen zusammen haben f\u00fcr den Kunden einen Wert von 4.500\u20ac pro Monat.<\/p>\n<p>Dieser Wert ist f\u00fcr den Kunden interessant. Nichts sonst. Wer ihm diesen Wert schneller liefert, ist f\u00fcr ihn attraktiver als Entwicklungspartner.<\/p>\n<p>Nat\u00fcrlich hat der Kunde die Bef\u00fcrchtung, dass sich die Lieferung solch wertvoller Software verz\u00f6gern k\u00f6nnte. Er will deshalb \u00fcber den Fortschritt der Entwicklung informiert werden. Wie kann das geschehen? Was kann ihm ein Softwareteam als Metrik nennen, die f\u00fcr den Kunden relevant ist?<\/p>\n<p>Solange der Kunde nichts in die Hand bekommt, solange f\u00fchr ihn kein Wert entsteht, sind alle Metriken abstrakt. Er l\u00e4sst sich notgedrungen auf sie ein. \"Wir haben schon 25% der Anforderungen umgesetzt!\" klingt gut - ist aber auch untauglich, solange der Kunde davon nichts hat. \"Wir sind schon mit der Anbindung des Buchhaltungssystems fertig!\" ist auch nicht hilfreich, solange der Kunde davon nichts hat. \"Wir haben schon Meilenstein 1 mit den Anforderungen A und B und C erreicht!\" f\u00e4llt letztlich auch in die Kategorie \"hei\u00dfe Luft\", solange der Kunde nichts davon hat.<\/p>\n<p>Mit \"davon haben\" meine ich, dass die Software bei ihm im Einsatz ist und schon Gewinnzuwachs produziert. Nur dann ist f\u00fcr den Kunden Wert hergestellt.<\/p>\n<p><a href=\"https:\/\/agilemanifesto.org\/iso\/de\/principles.html\" target=\"_blank\" rel=\"noopener noreferrer\">Das hat die Agilit\u00e4t erkannt und bem\u00fcht sich genau darum:<\/a><\/p>\n<blockquote>\n<p>Unsere h\u00f6chste Priorit\u00e4t ist es, den Kunden durch fr\u00fche und kontinuierliche Auslieferung wertvoller Software zufrieden zu stellen.<\/p>\n<\/blockquote>\n<p>Das Ideal agiler Softwareentwicklung sieht dann so aus:<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/151\/Bildschirmfoto-2021-01-30-um-16.40.06.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.40.06-2xl.png 1600w\"  alt=\"Agile Softwareentwicklung liefert fr\u00fcher und mehr Wert.\" width=\"1184\" height=\"1186\"><\/figure>\n<p>Nicht erst nach der geplanten Projektlaufzeit von 18 Monaten wird etwas wertvolles geliefert, sondern st\u00e4ndig. Im Beispiel gibt es jeden Monat ein Release, das die Software ein bisschen werthaltiger macht.<\/p>\n<ul>\n<li>Ab dem 3. Monat kann der Kunde schon kleine und dann wachsende Gewinnzuw\u00e4chse realisieren.<\/li>\n<li>Am Ende ist der erw\u00fcnschte Gewinnzuwachs sogar \u00fcbertroffen. Das ist m\u00f6glich, weil der Kunde durch fr\u00fchzeitigen Einsatz Erkenntnisse gewinnen konnte, wie die Software f\u00fcr ihn noch wertvoller gestaltet werden k\u00f6nnte.<\/li>\n<\/ul>\n<p>Der Wertzuwachs ist nat\u00fcrlich nicht linear. Am Anfang fehlt es noch an Voraussetzungen f\u00fcr gro\u00dfe \"Wertspr\u00fcnge\", dann k\u00f6nnen die gemacht werden - und nach etwas mehr als der halben Projektlaufzeit sind ca. 80% des sp\u00e4teren Gesamtwertes erreicht.<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/151\/Bildschirmfoto-2021-01-30-um-16.50.27.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/Bildschirmfoto-2021-01-30-um-16.50.27-2xl.png 1600w\"  alt=\"Nicht linearer Anstieg des Wertes bei inkrementeller Lieferung.\" width=\"575\" height=\"363\"><\/figure>\n<p><em>Das<\/em> ist, was den Kunden interessiert. Er will sehen, wie sich seine Ausgaben in Wert verwandeln. Wie viel mehr Gewinn l\u00e4sst ihn die Software schon realisieren? Wenn die Kurve \"Wert kummuliert\" kontinuierlich steigt, wenn sie sogar steil steigt, dann ist der Kunde gl\u00fccklich.<\/p>\n<blockquote>\n<p>Fortschritt gibt es f\u00fcr den Kunden nur, wenn Software f\u00fcr ihn werthaltiger geworden ist.<\/p>\n<\/blockquote>\n<p>Flacht die Kurve ab oder w\u00e4chst der Wert gar nicht oder - auch das ist m\u00f6glich - sinkt er sogar, dann ist der Kunde ungl\u00fccklich.<\/p>\n<p>Wenn die Agilit\u00e4t also kundenorientiert sein will, dann sollte sie sich doch daran messen, ob sie Wert f\u00fcr den Kunden produziert. Oder? Alles andere ist irrelevant.<\/p>\n<p>Und wenn der Product Owner einen Anlass f\u00fcr das Gespr\u00e4ch mit Entwicklern sucht, dann kann er die Wertentwicklung heranziehen. Gemeinsam l\u00e4sst sich dar\u00fcber reflektieren, warum Wert gesunken ist - das w\u00e4re eine Regression - oder warum die Kurve nur so schwach steigt. Warum dauert es so lange, bis wieder etwas an den Kunden geliefert wird, das der als wertvoll erachtet?<\/p>\n<h2>Fazit<\/h2>\n<p>Scrum ist von den Ideen der Lean Production inspiriert. Und die ist darauf aus, fl\u00fcssige, konfliktfreie Produktion herzustellen. Was ist es also, das in einem agilen oder gar Scrum-Prozess hergestellt werden soll?<\/p>\n<p>Das kann nur Wert sein. Etwas anderes kann \"valuable software\" nicht meinen. Und Wert entsteht nur und ausschlie\u00dflich im Auge des Kunden. Konkret ist das ein Zuwachs an Gewinn auf die eine oder andere Weise. Je fr\u00fcher er den realisiert, desto besser.<\/p>\n<p>Agile Softwareentwicklung, die nicht den Fokus auf die Entwicklung von Wert legt und deshalb die Wertproduktion protokolliert, geht am Kern der Agilit\u00e4t vorbei. Wert ist wichtiger als Komplexit\u00e4t. Deshalb im Stile des agilen Manifests:<\/p>\n<blockquote>\n<p>Wert mehr als Komplexit\u00e4t<\/p>\n<\/blockquote>\n<p>Komplexit\u00e4tseinsch\u00e4tzung hat ihren Platz in der Softwareentwicklung; mehr verdient es jedoch der Wert, dass sie sich daran ausrichtet.<\/p>\n<p>Dass f\u00fcr die Lieferung von Wert Komplexit\u00e4t bew\u00e4ltigt werden muss, ist unbenommen. Einen Orden verdient jedoch nicht der, der Komplexit\u00e4t wie versprochen in einer Periode niederringt, sondern der, der einen bestimmten Wert zuverl\u00e4ssig liefert.<\/p>\n<p>Dass es nicht einfach ist, den Wert von Software als Ganzes oder eines Inkrements zu bestimmen, steht auf einem anderen Blatt. Es bleibt die Aufgabe der Softwareentwicklung, die Wertproduktion zu optimieren. Daf\u00fcr muss sie sich halt anstrengen, Wert greifbar zu machen. Das halte ich f\u00fcr eine wirklich lohnende M\u00fche.<\/p>\n<p>Als Kunde w\u00fcrde ich jedenfalls lieber mit einem Softwareteam arbeiten, das mir ein Diagramm der Entwicklung des angepeilten Wertes meiner Software zeigt, als eines, auf dem eine obskure Komplexit\u00e4t getrackt wird.<\/p>\n<hr>\n<h4>P.S. Nicht realisierter Wert durch nicht-inkrementelle Entwicklung<\/h4>\n<p>Der Nachteil einer verz\u00f6gerten Auslieferung von Wert l\u00e4sst sich \u00fcbrigens auch an den Beispieldaten ablesen. Ein nicht-inkrementelles Vorgehen wie im Wasserfall ist daf\u00fcr ein extremes Beispiel. Doch auch bei bem\u00fcht agilem Vorgehen kann es immer wieder dazu kommen, das etwas eigentlich f\u00fcr den Kunden Werthaltiges (noch) nicht \u00fcbergeben wird.<\/p>\n<p>Die Summe des markierten Bereichs ist 46.150\u20ac. Dieser Gewinnzuwachs konnte bei agiler Entwicklung schon \"unterwegs\" bis Projektende vom Kunden realisiert werden:<\/p>\n<figure class=\"post__image\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/151\/2021-01-30_17-16-00.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/151\/responsive\/2021-01-30_17-16-00-2xl.png 1600w\"  alt=\"Agiles Vorgehen reduziert cost of delay.\" width=\"425\" height=\"411\"><\/figure>\n<p>Das Vorgehen nach Wasserfall verwehrt dem Kunden diesen Gewinnzuwachs. Es l\u00e4sst ihn auf die Software warten. Die 46.150\u20ac stellen deshalb <em>cost of delay (CoD)<\/em> dar, die durch eine <em>big bang<\/em> Auslieferung entstehen.<\/p>\n<p>Der zentrale Wertma\u00dfstab f\u00fcr die agile Softwareentwicklung ist daher CoD. Alles Bestreben agilen Vorgehens sollte auf die Minimierung von CoD gerichtet sein.<\/p>","image":"https:\/\/ralfw.de\/media\/posts\/151\/Bildschirmfoto-2021-01-30-um-16.48.10.png","author":{"name":"Ralf Westphal"},"tags":["Scrum","Agilit\u00e4t"],"date_published":"2021-01-30T23:30:33+08:00","date_modified":"2021-01-31T15:03:20+08:00"},{"id":"https:\/\/ralfw.de\/event-sourcing-challenge-bowling-game-kata\/","url":"https:\/\/ralfw.de\/event-sourcing-challenge-bowling-game-kata\/","title":"Event Sourcing Challenge: Bowling Game Kata","summary":"Event Sourcing ist f\u00fcr mich die Zukunft der grunds\u00e4tzlichen Zustandshaltung in Software. Alles andere ist eine Optimierung, die man nicht leichtfertig und schon gar nicht vorzeitig vornehmen sollte. Mit Event Sourcing verdr\u00e4ngt endlich Konstruktivismus den bisherigen Materialismus des immer noch dominierenden RDBMS\/OO-Denkens.1 Und ich halte&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>Event Sourcing ist f\u00fcr mich die Zukunft der grunds\u00e4tzlichen Zustandshaltung in Software. Alles andere ist eine Optimierung, die man nicht leichtfertig und schon gar nicht vorzeitig vornehmen sollte.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Mit Event Sourcing verdr\u00e4ngt endlich <a href=\"#INTERNAL_LINK#\/post\/NaN\">Konstruktivismus<\/a> den bisherigen Materialismus des immer noch dominierenden RDBMS\/OO-Denkens.<sup><a id=\"ffn1\" class=\"footnote\" href=\"#fn1\">1<\/a><\/sup> Und ich halte Event Sourcing f\u00fcr die Grundlage von Antifragilit\u00e4t in der Softwareentwicklung.<sup><a id=\"ffn2\" class=\"footnote\" href=\"#fn2\">2<\/a><\/sup><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich finde Event Sourcing also sehr spannend und wichtig \u2013 nur leicht ist es nicht. Denn auch wenn Event Sourcing auf das eine Datenmodell, die eine gro\u00dfe Datenstruktur verzichtet, bedeutet das nicht, dass man sich keine Gedanken um Datenmodelle machen muss.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Damit meine ich nicht die vielen situationsspezifischen Strukturen, die nun sehr einfach m\u00f6glich werden. F\u00fcr jede Interaktion mit einer Software kann es nun ein daraufhin optimiertes Datenmodell geben.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich meine die Events, die beim Event Sourcing in einem stetig wachsenden Strom gespeichert werden und den sich entwickelnden Systemzustand repr\u00e4sentieren. Statt des einen gro\u00dfen Datenmodells gibt es im Event Sourcing ein Granulat bestehend aus kleinen und kleinsten Datenstrukturen, den Events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das ist f\u00fcr das RDBMS- oder auch Dokumenten-gewohnte Denken eine Umstellung. W\u00e4hrend man bisher versuchen konnte, \u201edie Struktur der Welt\u201c zu erkennen und m\u00f6glichst realit\u00e4tsgetreu in Software abzubilden, geht es jetzt um ihre Entfaltung \u00fcber die Zeit. Es geht nicht mehr um statische Resultate von letztlich irrelevanten Ereignissen, sondern um h\u00f6chst relevante Ereignisse, aus denen alle m\u00f6glichen Resultate in Zukunft abgeleitet werden k\u00f6nnen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Welt der Zustandshaltung steht damit Kopf, w\u00fcrde ich sagen.\ud83d\ude43\ud83d\ude01<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Gedanken muss man sich also beim Event Sourcing um die Events machen. Klingt auch ohne gro\u00dfe Einleitungsworte plausible, oder?\ud83d\ude09<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wie findet man aber \u201edie besten\u201c Events? Was sind \u00fcberhaupt \u201egute\u201c Events? Das sind Fragen, die mich deshalb bewegen. Ich suche Prinzipien und Heuristiken, um f\u00fcr gegebenen Anforderungen mindestens \u201eziemlich gute\u201c Events zu finden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Die Challenge<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Deshalb habe ich im Domain Driven Design Slack-Workspace \u201eDDD Germany\u201c mal nachgefragt, wie man dort die Sache sieht. Getan habe ich das mit einer kleinen Aufgabe, die mir einerseits sehr \u00fcberschaubar scheint, andererseits aber doch ein bisschen Herausforderung bietet.<sup><a id=\"ffn3\" class=\"footnote\" href=\"#fn3\">3<\/a><\/sup><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p><a href=\"https:\/\/paper.dropbox.com\/doc\/EventSourcing-Challenge-Die-Bowling-Game-Kata--AqiYiJ05NEjMjfC6iUSFxU2lAg-MrmZs8ODudTrrlrvSi5i0\" target=\"_blank\" rel=\"noopener\">Als Aufgabe<\/a> habe ich die aus Coding Dojos bekannte Bowling Game Kata gew\u00e4hlt:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2773, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"alignnone wp-image-2773\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2xl.png 1600w\"  alt=\"\" width=\"548\" height=\"1244\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es soll ein \u201eErgebnisz\u00e4hler\u201c realisiert werden, der die Punktzahl eines Bowling-Spiels bestimmt. Dieser Z\u00e4hler reagiert auf zwei CQS-Nachrichten: dass ein Wurf registriert und dass das Ergebnis geliefert werden soll. Mehr nicht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es gibt also zwei glasklare Interaktionen der Umwelt mit einer Z\u00e4hler-Software. Dar\u00fcber muss nicht spekuliert werden. Die einzige Frage, die die Aufgabe stellt, ist die nach den Events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Interaktionen basieren auf gemeinsamem Zustand. Dieser Zustand soll mit Event Sourcing realisiert gedacht werden, d.h. als Strom von Events. Welche Events sollten das sein?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Mehr ist nicht zu liefern, nur die Events. Die L\u00f6sung soll gerade nicht komplett implementiert werden, weil es mir ja darum geht, wie Events <em>a priori<\/em> gefunden werden k\u00f6nnen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Event Storming - nomen es omen - ist eine Technik, die daf\u00fcr zum Einsatz kommen k\u00f6nnte; allerdings sehe ich sie vor allem bei Szenarien, die deutlich gr\u00f6\u00dfer sind und\/oder bei denen es viele Sichtweisen zu ber\u00fccksichtigen gilt.<sup><a id=\"ffn4\" class=\"footnote\" href=\"#fn4\">4<\/a><\/sup><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dass man nach Implementation und Betrieb einer L\u00f6sung immer schlauer ist und also vielleicht auch eine noch bessere Idee hat, welche Events n\u00fctzlich w\u00e4ren, scheint mir ausgemacht. Wie bei RDBMS oder umf\u00e4nglichen Objektmodellen ist eine \u00c4nderung der Datenbasis dann jedoch schwierig. Und Event Sourcing verspricht ja, dass man gerade das nicht tun muss\/soll.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Events versionieren, weitere Events sp\u00e4ter nachschieben, einen Eventstrom komplett umschreiben: das kann man alles machen und es mag zuzeiten n\u00f6tig sein. Doch so, wie es einige Kriterien f\u00fcr RDBMS-Schemata gibt, um nicht gleich mit dem falschen Fu\u00df aufzustehen, so gibt es ja vielleicht auch Kriterien f\u00fcr das Schneiden von Events, um den Zeitpunkt hinauszuz\u00f6gern, da man sich in eine Ecke gepinselt hat. Was meint die DDD-Community dazu?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Die L\u00f6sungen<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich hatte zuerst f\u00fcr mich selbst die Aufgabe gel\u00f6st (und nat\u00fcrlich doch nicht darauf verzichtet, den kompletten Code daf\u00fcr zu schreiben\ud83e\udd2a). Ohne meine Events zu verraten, habe ich dann die Aufgabe der Community vorgelegt und weitere vier L\u00f6sungen bekommen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich liste sie einfach mal mit den Slack-Benutzernamen ihrer Einreicher in alphabetischer Reihenfolge:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2772, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2772\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-1-2xl.png 1600w\"  alt=\"L\u00f6sung von @akii\" width=\"241\" height=\"79\"><\/figure>\n<figcaption>L\u00f6sung von @akii<\/figcaption>\n<\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:image {\"id\":2774, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2774\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-2-2xl.png 1600w\"  alt=\"L\u00f6sung von @bwaidelich\" width=\"273\" height=\"77\"><\/figure>\n<figcaption>L\u00f6sung von @bwaidelich<\/figcaption>\n<\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:image {\"id\":2769, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2769\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-3-2xl.png 1600w\"  alt=\"L\u00f6sung von @phj\" width=\"405\" height=\"338\"><\/figure>\n<figcaption>L\u00f6sung von @phj<\/figcaption>\n<\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:image {\"id\":2770, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2770\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-4.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-4-2xl.png 1600w\"  alt=\"Meine eigene L\u00f6sung (@ralfw)\" width=\"443\" height=\"396\"><\/figure>\n<figcaption>Meine eigene L\u00f6sung (@ralfw)<\/figcaption>\n<\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:image {\"id\":2771, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2771\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-5.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/138\/responsive\/DraggedImage-5-2xl.png 1600w\"  alt=\"L\u00f6sung von @sebastian\" width=\"231\" height=\"211\"><\/figure>\n<figcaption>L\u00f6sung von @sebastian<\/figcaption>\n<\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die L\u00f6sungen wurden in Pseudocode, Typescript, C#, F# eingereicht. Ich habe sie zur besseren Vergleichbarkeit alle nach C# \u00fcbersetzt. Ein bisschen ging dabei die Ausdrucksf\u00e4higkeit von F# (@phj) verloren, aber das finde ich nicht schlimm.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Au\u00dferdem habe ich sie insofern vereinheitlicht, als dass ich eine Game ID, die in manchen L\u00f6sungen in den Events stand, gel\u00f6scht habe. Ich denke, sie tr\u00e4gt in Bezug auf diese Aufgabe nichts zur Erkenntnis von Prinzipien und Heuristiken bei und betrifft einen orthogonalen Belang.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>L\u00f6sungsebenen<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Aufgabe war nicht gro\u00df. Die L\u00f6sungsvorschl\u00e4ge sollten also nicht so weit auseinander liegen. So hatte ich es mir gedacht - und war dann doch \u00fcberrascht, dass selbst hier eine L\u00f6sungsvielfalt entstanden ist.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich sehe die L\u00f6sungen auf drei Ebenen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li>Minimall\u00f6sung (@akii, @bwaidelich): Es wird nur ein Event ben\u00f6tigt, der die \u00fcber das Kommando gemeldeten geworfenen Pins aufzeichnet.<\/li>\n<li>Aufzeichnung von Bonuspunkten (@sebastian): Zus\u00e4tzlich zum Event der Minimall\u00f6sung wird aufgezeichnet, dass ein Wurf als Bonus f\u00fcr einen vorhergehenden anerkannt wurde.<\/li>\n<li>Aufzeichnung von Frames und Bonusw\u00fcrdigkeit (@phj, @ralfw): Zus\u00e4tzlich zu den Events der zweiten Ebene wird aufgezeichnet, falls ein Wurf einen Frame beendet hat und ob der Frame bonusw\u00fcrdig ist (Spare oder Strike).<\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Analyse<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Idee hinter der Aufgabe war, dass ein Event Store bef\u00fcllt wird mit Events im Rahmen der Verarbeitung des einen Kommandos - und dass die Events w\u00e4hrend der einen Query zu einem Gesamtergebnis verarbeitet werden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Logik zur Herstellung des Verhaltens w\u00fcrde sich in einer Implementation also auf einen Command- und einen Query-Handler verteilen. Die Wahl der Events hat darauf einen gro\u00dfen Einfluss.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Minimall\u00f6sungen zeichnen im Grunde nur die mit dem Kommando gemeldeten Pins eines Wurfes 1:1 auf. Das ist trivial, so dass die ganze Last der Ergebnisberechnung bei der Query-Verarbeitung liegt. Die Minimall\u00f6sungen betreiben mithin eigentlich kein Event Sourcing, sondern eher ein Command Sourcing.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Bonuspunktl\u00f6sung verschiebt die Last zum Command-Handling. Bei der Query-Verarbeitung m\u00fcssen nur die Pins aus den Events f\u00fcr die W\u00fcrfe und die Bonuspunkte addiert werden. Das ist trivial - daf\u00fcr muss die Kommando-Verarbeitung allerdings vorher entschieden haben, wann ein Bonuspunkt-Event aufzuzeichnen ist.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Frame-\/Bonusw\u00fcrdigkeit-L\u00f6sungen vereinfachen die Logik der Query-Verarbeitung nicht weiter; die bleibt trivial. Die zus\u00e4tzlichen Events wirken sich vielmehr auf das Command-Handling differenzierend aus. Vielleicht w\u00e4chst die Logik dort noch ein wenig, vor allem scheint es mir aber einfacher, in der Kommando-Verarbeitung Verantwortlichkeiten zu trennen: festzustellen, ob\/ab wann ein Bonus gew\u00e4hrt wird, und einen Bonus zuzuweisen, sind eben zwei verschiedene Aufgaben.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Interessant finde ich, dass keine L\u00f6sung einen Event zur Anzeige eines Spielendes definiert.<sup><a id=\"ffn5\" class=\"footnote\" href=\"#fn5\">5<\/a><\/sup> Ist das kein Aufzeichnungsw\u00fcrdiges Ereignis? Oder war die Aufgabe so formuliert, dass alle angenommen haben, dass am Spielende der Eventstrom verschwindet? Dagegen spricht, dass einige L\u00f6sungen auch die Aufzeichnung einer Game ID vorgeschlagen haben. Da wurde augenscheinlich gr\u00f6\u00dfer gedacht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Oder war die Aufgabe unterspezifiziert insofern, als dass nicht angegeben war, was passieren soll, wenn ein Wurf \u00fcber die maximale Wurfzahl eines Spiels hinaus gemeldet wird? Damit war sozusagen das Spielende kein Thema in der Aufgabenbeschreibung? Hm\u2026\ud83e\udd14<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Diskussion<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Was tun mit einem Spektrum an L\u00f6sungen? Sind sie alle gleichwertig, gleich gut? Welches F\u00fcr und Wider gibt es? Genau um diese Erkenntnis ging es mir ja, als ich die Aufgabe gestellt habe.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Augenf\u00e4llig ist zun\u00e4chst der Unterschied zwischen den Minimall\u00f6sungen und den anderen in der Verortung der Logik. Die Minimall\u00f6sungen brauchen gewiss viel Logik w\u00e4hrend des Query-Handlings - wie viel sie im Command-Handling tun, ist eine Frage des Anspruchs an Validation\/Konsistenzpr\u00fcfung. Im einfachsten Fall ist dort im Grunde gar keine Logik n\u00f6tig.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das Argument der Vertreter dieses Ansatzes ist sehr simpel: \u201eEin Event reicht.\u201c Und das ist wahr. Aufzuzeichnen, dass ein Wurf gemacht wurde bedeutet, ein reales Ereignis in der Umwelt aufzuzeichnen. Das wird \u00fcber ein Kommando gemeldet und ist die einzige Anweisung zur Zustands\u00e4nderung. Wenn man sich das merkt, kann der Rest jederzeit daraus abgeleitet werden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wenn es so einfach funktioniert, warum sind dann aber 60% der Einreicher auf weitere Events gekommen? Ich denke, das liegt an der Abh\u00e4ngigkeit, die mit der Minimall\u00f6sung einhergeht: Ein bei der Query nach au\u00dfen gemeldeter Zustand ist vollst\u00e4ndig abh\u00e4ngig von Logik. \u00c4ndern sich z.B. die Regeln, k\u00f6nnen die Ergebnisse alter Spiele u.U. nicht mehr nachvollzogen werden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das mag ok sein, wenn eine solche \u00c4nderung nicht zu erwarten ist, weil die Dom\u00e4ne sehr stabil ist. Oder es mag ok sein f\u00fcr ein so kleines Beispiel mit angenommener Kurzlebigkeit. F\u00fcr \u201erichtige\u201c Software jedoch scheint mir da eine Gefahr fehlender Reproduzierbarkeit zu liegen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Event Sourcing L\u00f6sungen sind mehr von Logik abh\u00e4ngig als L\u00f6sungen, die Zustand in einem dauerhaften Modell aktuell halten, weil st\u00e4ndig Projektionen von Events auf tempor\u00e4re, grunds\u00e4tzlich fl\u00fcchtige Modelle stattfinden. Deshalb w\u00fcrde ich mich nicht auf nur den einen minimal notwendigen Event verlassen wollen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wie viele Events mehr sollen es dann aber sein?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Events repr\u00e4sentieren Weggabelungen in der Entwicklung der Welt. Wenn etwas passiert, dann kollabiert ein M\u00f6glichkeitsraum; ein Weg ist eingeschlagen worden. Vor dem ersten Wurf ist es noch m\u00f6glich, dass nach dem Wurf 10, 9, \u2026, 1, 0 Pins abger\u00e4umt sein werden; nach dem Wurf ist klar, dass genau z.B. 4 Pins abger\u00e4umt wurden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dasselbe ist der Fall bei Entscheidungen: Sie lassen einen M\u00f6glichkeitsraum zusammenschnurren auf genau eine M\u00f6glichkeit, n\u00e4mlich die, f\u00fcr die sich entschieden wurde. Vor einer Entscheidung ist es noch m\u00f6glich, dass z.B. beim Sturz eines Fu\u00dfballspielers nach Zusammensto\u00df mit einem anderen ein Fowl gepfiffen wird oder nicht. Der Schiedsrichter kann sich f\u00fcr oder gegen Fowl entscheiden und er kann sich sogar f\u00fcr ein Fowl mit oder ohne Vorteil entscheiden (wenn ich es recht erinnere). Mit der Entscheidung des Schiedsrichters erst schnurrt der M\u00f6glichkeitsraum zusammen auf genau ein Urteil; was passiert ist, ist dann ganz klar z.B. ein Fowl gewesen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Entscheidungen lassen nichts direkt passieren. Vielmehr deuten sie etwas, das passiert ist - und lassen als Ergebnis wieder etwas passieren. Ein Urteil, eine Entscheidung ist ebenfalls ein Ereignis. Mit jeder Entscheidung ver\u00e4ndert sich der Weg eines Systems, d.h. sein Zustand. Wer sich nach links wendet, ist in einem anderen Zustand, als h\u00e4tte er sich nach rechts gewendet.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Aufzeichnung des per Kommando gemeldeten Pins betrifft also quasi ein Ereignis 1. Ordnung, ein unmittelbares Ereignis. Das Programm \u201eerleidet\u201c dieses Ereignis, es kann nichts daf\u00fcr.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Einreicher von L\u00f6sungen oberhalb der Minimall\u00f6sung haben sich nun \u00fcberlegt, dass es hilfreich w\u00e4re, weitere Ereignisse aufzuzeichnen. Die nenne ich mal Ereignisse 2. und h\u00f6herer Ordnung. Sie repr\u00e4sentieren Entscheidungen der Spiellogik.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Bei @sebastian wird nur festgehalten, dass die Logik im Command-Handling erkannt hat, dass ein Wurf als Bonus f\u00fcr einen vorhergehenden Frame zu z\u00e4hlen ist. Das reicht aus, um die Query-Logik drastisch zu vereinfachen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Angriffsfl\u00e4che von Regel\u00e4nderungen auf die Berechnung eines Spielergebnisses ist damit deutlich kleiner geworden, w\u00fcrde ich sagen. Es muss zwar immer noch summiert werden, doch das liegt auf der Hand, w\u00fcrde ich sagen. Nur ein Spielende-Ereignis, in dem man das Ergebnis festschreibt, w\u00fcrde noch mehr Robustheit gegen\u00fcber Regel\u00e4nderungen versprechen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und was ist mit den dar\u00fcber hinaus gehenden Events der L\u00f6sungen von @phj und @ralfw? Sie dokumentieren auch Entscheidungen; oder ich k\u00f6nnte es auch Erkenntnisse nennen. Die Logik entscheidet, dass mit einem Wurf ein Frame abgeschlossen wurde. Die Logik erkennt den Abschluss eines Frame.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Warum diese Entscheidungen auch noch aufzeichnen? Die Ergebnisberechnung profitiert davon nicht mehr. Vielleicht wird es mit diesen Events aber einfacher, einen Bonuswurf zu erkennen? Das k\u00f6nnte sein. Dann w\u00e4ren es \u201efunktionale\u201c Events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Oder dienen sie nur der Dokumentation von Entscheidungen, damit die dauerhaft nachvollziehbar und f\u00fcr zuk\u00fcnftige Nachrichtenbehandlungen n\u00fctzlich sind? Dann w\u00e4ren es zun\u00e4chst \u201edokumentierende\u201c Events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>@phj hat sein Denken so erkl\u00e4rt:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>[M]it nur \u201croll made\u201d w\u00e4re ja nur eine nach events aussehende Fassade vor eine nicht wirklich event-orientierte L\u00f6sung gekommen. Das wichtige bei ES ist - und das habe ich versucht damit etwas herauszustellen - dass Logik nur in den Command Handlern, aber nicht in den Projektionen stattfindet. Die Entscheidungen, was ein Frame ist, wann ein Bonus erforderlich wird, etc. mussten damit vor dem Ver\u00f6ffentlichen von Events geschehen, und erfordern daher dann auch spezifische Events.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Etwas zugespitzt formuliert ist der f\u00fcr mich wesentliche Punkt: <em>\u201edass [Entscheidungsl]ogik nur in Command Handlern\u201c<\/em> steht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>@phj sagt weiter:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>dass in den Projektionen keine Entscheidungen [\u2026] getroffen werden d\u00fcrfen, [weil] die eventuell nicht dauerhaft in ihrer Struktur oder Parametrisierung sind. [\u2026] Ansonsten w\u00fcrde eine zuk\u00fcnftige Regel\u00e4nderung zu einer nachtr\u00e4glich anderen Interpretation von bereits durchgef\u00fchrten Spielen f\u00fchren. Also m\u00fcssen die Events die Struktur der Vorbedingungen und der Entscheidungsergebnisse der Gesch\u00e4ftslogik festhalten<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das deckt sich mit meinem Verst\u00e4ndnis; nicht umsonst sind wir auf sehr \u00e4hnliche L\u00f6sungen gekommen\ud83d\ude09<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Ergebnis<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Events zu finden f\u00fcr gegebene Kommandos und Queries l\u00e4sst Raum f\u00fcr Kreativit\u00e4t. Hier wie auch sonst in der Softwareentwicklung ist eine Balance zwischen dem unzweifelhaft jetzt Erkennbaren und dem m\u00f6glichen Zuk\u00fcnftigen zu finden. Auch beim Schneiden von Events kann man ansonsten wohl vorzeitig optimieren.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Allerdings scheinen mir lieber mehr als weniger Events tendenziell eine relativ harmlose und billige Optimierung im Hinblick auf zuk\u00fcnftige Nachvollziehbarkeit und Events als Ausgangsmaterial f\u00fcr weitere Nachrichtenverarbeitungen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sich beim einmaligen Schreiben etwas mehr M\u00fche zu geben, erleichtert sp\u00e4ter das h\u00e4ufige Lesen aus unterschiedlichen Blickwinkeln. Event Sourcing unterscheidet sich da nicht von der Programmierung, w\u00fcrde ich sagen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Kunst des Event Sourcing besteht dann wohl darin, schon aus den Anforderungen die wesentlichen, aufzeichnungsw\u00fcrdigen, zu stabilisierenden Entscheidungen herauszudestillieren.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Zu ber\u00fccksichtigen sind dabei Kommandos wie Queries. Und was man da an Entscheidungen findet, ist in Events zu gie\u00dfen, die beim Command-Handling generiert werden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dass ein Wurf stattgefunden hat, ist keine Entscheidung innerhalb einer L\u00f6sung. Aber wenn die Regeln von Frames sprechen, wenn es besondere Wurf-Kombinationen gibt und Boni zugesprochen werden\u2026 dann stecken dahinter Entscheidungen und die lohnen der Aufzeichnung \u201ef\u00fcr die Nachwelt\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dazu mag noch kommen, Begriffe der Dom\u00e4ne materialisieren. Wenn in den Regeln \u201eFrame\u201c, \u201eSpare\u201c, \u201eStrike\u201c, \u201eBonus\u201c als Begriffe vorkommen, dann liegt es nahe zu erwarten, sie in einem Eventstrom zu finden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das sind lohnende Erkenntnisse aus der \u00dcbung. Ein sch\u00f6nes Beispiel f\u00fcr <em>deliberate practice<\/em>. F\u00fcr mich hat sich die Challenge also gelohnt. Ich bin mir klarer geworden \u00fcber Prinzipien und Heuristiken des Event Sourcing. Damit werde ich in die n\u00e4chste Challenge gehen\u2026 Stay tuned!\ud83d\ude01<\/p>\n<p>\u00a0<\/p>\n<p>Endnoten:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li id=\"fn1\">Materialismus verstehe ich hier als Haltung, die annimmt, dass es au\u00dferhalb von Software eine Realit\u00e4t gibt, die es sich lohnt, 1:1 innerhalb der Software mit stabilen Datenstrukturen abzubilden.<br>Konstruktivismus hingegen macht f\u00fcr mich keine solche Annahme. Er konstruiert nach Bedarf immer wieder neue Repr\u00e4sentationen aus \u201erohen Wahrnehmungen\u201c, die nicht mehr und nicht weniger als n\u00fctzlich sind. Ob sie einer \u201eobjektiven Realit\u00e4t\u201c entsprechen oder nicht, ist ihm einerlei. <a href=\"#ffn1\">\u21a9<\/a><\/li>\n<li id=\"fn2\">Antifragil ist Software bzw. die Softwareentwicklung f\u00fcr mich, wenn sie \u00c4nderungsw\u00fcnsche begr\u00fc\u00dft. Dann tr\u00e4gt jede \u00c4nderung dazu bei, dass Software besser wird und sogar besser im besser werden. <a href=\"#ffn2\">\u21a9<\/a><\/li>\n<li id=\"fn3\">Auf eine CRUD-Aufgabe habe ich verzichtet, weil die wohl Naser\u00fcmpfen bei einigen Event Sourcing Freunden hervorgerufen h\u00e4tte. Die Meinung, dass Event Sourcing sich nicht f\u00fcr CRUD-Szenarien lohne, h\u00e4lt sich noch. Ich bin allerdings anderer Ansicht. Aber davon ein andermal mehr. <a href=\"#ffn3\">\u21a9<\/a><\/li>\n<li id=\"fn4\">Und das Ergebnis scheinen mir dann auch oft Dom\u00e4nenevents zu sein, die ich in CQNS <a href=\"https:\/\/ralfw.de\/command-query-notification-separation-cqns\/\">Notifications<\/a> nenne.<br>Dom\u00e4nenevents sind f\u00fcr mich Nachrichten, die zwischen \u201eAkteuren\u201c flie\u00dfen. Das bedeutet nicht, dass sie 1:1 in einem Eventstrom aufgezeichnet werden. <a href=\"#ffn4\">\u21a9<\/a><\/li>\n<li id=\"fn5\">Nur bei @sebastian gibt es eine Frame-Nummer, die implizit eine relativ leichte Erkennung des Spielendes erlaubt, weil jedes Spiel aus 10 Frames besteht. <a href=\"#ffn5\">\u21a9<\/a><\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>","image":"https:\/\/ralfw.de\/media\/posts\/138\/DraggedImage-3.png","author":{"name":"Ralf Westphal"},"tags":["Event-Orientation"],"date_published":"2019-12-17T18:44:22+08:00","date_modified":"2021-01-27T23:40:14+08:00"},{"id":"https:\/\/ralfw.de\/magically-predictable-software-production-for-projects\/","url":"https:\/\/ralfw.de\/magically-predictable-software-production-for-projects\/","title":"Magically Predictable Software Production for Projects","summary":"Do you remember the story about the magic black box transforming software requirements into release at no cost at all? I wrote about it in a previous article - and since then have received many questions about how it could be deployed in real software&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>Do you remember the story about the magic black box transforming software requirements into release at no cost at all? I wrote about it <a href=\"https:\/\/ralfw.de\/magically-predictable-software-production\/\">in a previous article<\/a> - and since then have received many questions about how it could be deployed in real software projects. Because what I described were simplistic scenarios with just single requirements.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Here\u2019s a short reminder of what this thing is, the magic black box:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Magic Black Box Recap<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Imagine you are a product owner. One day a black box appears on your desk with the promise to produce high quality software for your for free. Yes, for free! You just hook it up to a GitHub repository and feed it requirements as issues. The black box works on them one-by-one and drops the finished code as releases into the repository.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2762, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2762\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-24.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-24-2xl.png 1600w\"  alt=\"\" width=\"372\" height=\"145\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The only downside to the magic is, that you don\u2019t know how long it\u2019s going to take the black box to transform an issue into a new release.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But since the black box did not cost you anything you try it out and record the <em>cycle time<\/em> for some issues from start to finish. Some issues take 1 day, some 3 day, and there is even one with 10 days.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2751, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2751\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-1-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-1-1-2xl.png 1600w\"  alt=\"\" width=\"451\" height=\"247\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You realize there is some method to the magic. The black box is not at all useless to you, even though you cannot ask it in advance for an estimation of how long it\u2019s probably gonna work on an issue.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Instead of getting an estimate from it, you observe it and make your own forecast.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2753, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2753\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-2-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-2-1-2xl.png 1600w\"  alt=\"\" width=\"422\" height=\"283\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>For example: Based on the issues implemented so far the next one has a 84% chance of being finished in 7 days (or even less).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And if you update your log of cycle times with each issue done, your next forecast will be even more realistic. With three more issues implemented you see how the situation even changes towards the better. 6 days (or less) has moved up from 79% probability to 82%.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2752, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2752\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-3-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-3-1-2xl.png 1600w\"  alt=\"\" width=\"464\" height=\"323\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I think, this is a much more realistic information compared to some developer\u2019s gut feeling. The simple reason: this prediction is based on facts, on historical data. No wishful thinking, no invisible padding, no deadline-driven distortion. And you did not need to go through frustrating discussions with developers.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So much for a quick recap. Read the previous article for a couple of more details.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Single Black Box, Multiple Issues<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Forecasting the implementation time for a single feature is not bad. But it\u2019s not more than a start. Managers and customer are rarely asking \u201eHow long will only this one feature take?\u201c Rather they want to know how long it takes to get the next 5, 17, 31 features done.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>For example: What\u2019s your answer to \u201eHow long will 4 features take?\u201c if the answer to the single feature question is \u201eWith an 82% chance it\u2019s gonna take 6 days.\u201c? Do you just calculate 6+6+6+6=24 and say \u201eIt\u2019s gonna take 24 days with a probability of 82%.\u201c?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>No, that\u2019s not gonna work. Or: It works, but then your prediction (cycle time for 4 features) is worse than it needs to be and wrong (with regard to the probability).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Instead what you do is run simulations.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Monte Carlo Simulation<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>A single simulation looks like this: Sample the historical data 4 times (since you want to forecast the total cycle time for 4 features), i.e. pick 4 cycle times at random. This might result in these cycle times: (1, 1, 3, 7). The total cycle time would be 12 days.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then do it again: (2, 4, 5, 3)=14.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then do it again: (9, 1, 3, 7)=20.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And so on, and so on\u2026 Do it 1000 or 50000 times. That\u2019s called a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Monte_Carlo_method\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Monte Carlo Simulation<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then for each of the maybe 1000 total cycle times count how often it occurs, e.g. 5=4 times, 9=50 times, 14=98 times, 25=10 times\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Here are the results of 1000 such simulations for 4 features based on the latest historical data from above:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2755, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2755\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-4-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-4-1-2xl.png 1600w\"  alt=\"\" width=\"158\" height=\"490\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It\u2019s pretty clear that 4 features cannot be done in less than 2 days, since a single issue always took the black box at least 0.5 days. And it\u2019s clear that it cannot be more than 40 days, i.e. 4 times the maximum cycle time so far.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But as you can see from the above simulation both the minimum or maximum might not even happen. At least they did not happen during 1000 \u201etrial runs\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now look at the simulation data turned into a histogram. Interesting, isn\u2019t it?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2757, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2757\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-5-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-5-1-2xl.png 1600w\"  alt=\"\" width=\"567\" height=\"294\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The original distribution had two \u201ehumps\u201c (see above): one at cycle time 2, another at 9. But the distribution of total cycle times does not resemble the original distribution. It\u2019s close to a normal distribution. That\u2019s due to the <a href=\"https:\/\/www.thoughtco.com\/importance-of-the-central-limit-theorem-3126556\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Central Limit Theorem<\/a> and was bound to happen. But don\u2019t worry. No need to get deeper into math here.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And of what use is this to answer the question \u201eWhen will 4 features be done?\u201c? Like with single feature forecasts it\u2019s about percentiles again: How many simulation results are equal or less than a certain total cycle time?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>If you still think a bearable risk is 18% then 19 days are your forecast: 82% of all simulation results predicted 19 days or less for 4 features.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2761, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2761\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-6-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-6-1-2xl.png 1600w\"  alt=\"\" width=\"557\" height=\"315\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now you see, why 24 days where too much. 24 days, i.e. 4 times the 82% cycle time for a single feature, would offer you even 96% confidence!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s why the usual padding of estimations is so wrong: The manager asks developer A for his estimation of feature 1 and gets 10 days including a (unknown) 30% padding. She asks developers B, C, D for three more features each including a padding of 30%. Even these 4x30% padding are too much; they are the same as 24 for the simplistic total cycle time for 4 feature. But nevertheless she adds another 10% to be on the safe side. This decreases the risk, sure, but not explicitly. Receivers of the updated estimates don\u2019t know about it; it might be contrary to their risk attitude. It probably creates a prospect of higher costs than necessary.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But never mind. Those days of excessive padding are over. With forecasting and a black box the predictions are much more realistic: no hidden padding, no excess padding.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You see, predicting the development of multiple features is possible even if you\u2019re working with a black box you cannot ask for an estimation. The math is simple, the approach straightforward. It can be done in some 50 lines of logic in C# plus a bit of Excel for visualization. That\u2019s no rocket science.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Multiple Black Boxes, Multiple Issues<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So far the story about the Magic Black Box assumes you as a PO only get one. Since each Black Box probably works best on a single issue at a time, features get implemented in a sequential way.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s great for a single project. Work-in-progress is naturally kept to 1. All issues get implemented in the fastest way possible.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But if there are multiple POs working on parts of a larger project and each one was presented with a black box\u2026 How can a prediction for the whole project be done? Multiple black boxes surely are working in parallel. Releases get crunched out in parallel.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2758, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2758\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-7-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-7-1-2xl.png 1600w\"  alt=\"\" width=\"454\" height=\"99\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Maybe 3 POs with their black boxes are supposed to deliver 10 features. How long is that gonna take? For a single black box working sequentially simulation would deliver a result like this:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2763, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2763\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-8-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-8-1-2xl.png 1600w\"  alt=\"\" width=\"576\" height=\"314\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>10 features would take 44 days (or less) with a a probability of 82%.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But that does not take into account any work done in parallel. Working independently on multiple features at the same time sure should take less time. But how much less? How to forecast simultaneous work?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Throughput Instead of Cycle Time<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>When measuring the productivity of several resources the metric switches away from cycle time. When work starts on an issue K it\u2019s not clear if issue K is the next one to get finished (regardless of the cycle time). Maybe issue J or H is the next to be released.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Hence, what\u2019s more interesting than cycle time is <em>throughput<\/em>: How many features get finished in a period of time (e.g. a day or a week)?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You can get throughput data from your historical cycle time data if you recorded when a work item got fed to a resource (here: issues to multiple black boxes) and when it was \u201espit out\u201c finished:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2750, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2750\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-9-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-9-1-2xl.png 1600w\"  alt=\"\" width=\"321\" height=\"482\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In this excerpt from a cycle time log, for example issues A and B entered \u201eproduction\u201c on July 1st, but A left it on July 3rd and B on July 4th. Their cycle times were 3 and 4 days. Other features just took 2 days, e.g. D, others 10 (M). (Never mind that each day on the table seems to be a work day; no weekends included for simplicity.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Throughput is not interested in how long each issue takes from start to finish, but how many items get processed and leave the system in a given time period.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>As you can see, not every day issues got finished according to the above log. But on some days 1 was released, on others 2 or 3.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2760, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2760\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-10-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-10-1-2xl.png 1600w\"  alt=\"\" width=\"171\" height=\"110\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Throughput values like cycle time values thus have a frequency distribution:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2754, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2754\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-11-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-11-1-2xl.png 1600w\"  alt=\"\" width=\"357\" height=\"238\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Simulating Parallel Work<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To simulate the production multiple black boxes can achieve, the approach is slightly different. Frequency values don\u2019t get added, but subtracted. A single simulation looks like this:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Pick a throughput value from the list of historical data in the granularity of the relevant time period, e.g. days or weeks.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2759, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2759\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-12-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-12-1-2xl.png 1600w\"  alt=\"\" width=\"94\" height=\"597\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then subtract the value picked from the number of features to implement, e.g. 10 features, 2 got picked, the number of remaining features is 8.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Do this until all features are finished, e.g. for 10 features that could look like this: 2:8, 0:8, 1:7, 0:7, 0:7, 1:6, 3:3, 0:3, 0:3, 1:2: 0:2, 0:2, 3:-1.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The number of picks needed is the number of days required to accomplish the features, e.g. 13.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Repeat this a 1000 or more times. The result again is a table of frequencies. But this time they stand for the total number of days needed until completion of the features:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2756, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2756\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-13-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-13-1-2xl.png 1600w\"  alt=\"\" width=\"266\" height=\"383\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The resulting histogram also again looks almost like a normal distribution:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2764, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2764\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-14-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/137\/responsive\/DraggedImage-14-1-2xl.png 1600w\"  alt=\"\" width=\"556\" height=\"303\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And based on the percentiles from the table you can highlight the number of days you feel comfortable with for delivering multiple features with multiple black boxes at work. In this case it\u2019s 16 days for 10 features with a risk of 15%.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Please don\u2019t compare these 16 days to the above 44 days for 10 features with a single black box. Both are based on different datasets. They need to, since the above cycle times are just from a single black box. Multiple black boxes sure differ in their cycle time logs; and all those logs get merged. For a forecast it\u2019s not important which black box did what. Only the overall throughput is of interest. The customer does not care which PO with her black box actually works on a feature.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":1} --><\/p>\n<h1>Fin<\/h1>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Can you believe it? Black Boxes happily humming while implementing issues from Github backlogs, but mute, can still be used to deliver on time. You cannot ask them for an estimation - nevertheless you can make a prediction for when multiple features likely will be finished. (With \u201elikely\u201c being a probability you choose according to your risk attitude.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Think of all the time and energy saved by not arguing about estimations. Think about the blame avoided because nobody got the padding wrong.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Talking to developers about feature complexity is still worthwhile - but for a different reason. Don\u2019t get prioritization mixed up with prediction.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Talk with developers about complexity and categorization to help you with prioritization.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Don\u2019t talk with developers about estimations. They get it wrong 100% of the time, and everybody is feeling bad sooner or later.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Don\u2019t look into a crystal ball. Look at facts, look at historical data. Do your math! Calculate a probability distribution (or histogram) and pick a number according to the risk you are willing to take. That\u2019s entirely your choice (or whoever wants a prediction anyway).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And then <a href=\"https:\/\/ralfw.de\/steering-software-development-with-priorities-instead-of-deadlines\/\">don\u2019t tell the developers about your deadline<\/a>! That\u2019s crucial. Only that way they will deliver all qualities required: functionality, efficiency, sustainability.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You can even pick two numbers, if you like. The probability distribution is clear. That\u2019s an important improvement compared to any estimation you can possibly get. So pick a number to communicate to the customer, e.g. from the 95% percentile, and another number for internal use, e.g. from the 85% percentile.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>After that: Lean back and watch the development unfold\u2026 No, don\u2019t lean back. Walk around. Keep yourself informed about the progress towards your personal goal. Actively steer the development with ongoing re-prioritizations, scope reduction, impediment removal.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But don\u2019t take just my work for it. Read <em>the<\/em> book on it: <a href=\"https:\/\/leanpub.com\/whenwillitbedone\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">When Will It Be Done? <\/a>by Daniel S. Vacanti. There\u2019s more to \u201epredictable software development.\u201c<\/p>\n<p><!-- \/wp:paragraph --><\/p>","image":"https:\/\/ralfw.de\/media\/posts\/137\/DraggedImage-14-1.png","author":{"name":"Ralf Westphal"},"tags":["noestimates"],"date_published":"2019-09-23T23:55:50+08:00","date_modified":"2021-01-28T17:24:29+08:00"},{"id":"https:\/\/ralfw.de\/ueber-den-fundamentalen-zielkonflikt-in-unternehmen-und-in-der-schule\/","url":"https:\/\/ralfw.de\/ueber-den-fundamentalen-zielkonflikt-in-unternehmen-und-in-der-schule\/","title":"\u00dcber den fundamentalen Zielkonflikt in Unternehmen - und in der Schule","summary":"F\u00fcrs Leben lernen wir, nicht f\u00fcr die Schule. Und der Kunde steht stets an erster Stelle. So wird es doch immer wieder beteuert, oder? Das halte ich f\u00fcr fromme W\u00fcnsche. Denn es kann nicht funktionieren. Mein Argument ist aber kein politisches, sondern ein strukturelles. Ich&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>F\u00fcrs Leben lernen wir, nicht f\u00fcr die Schule. Und der Kunde steht stets an erster Stelle. So wird es doch immer wieder beteuert, oder?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das halte ich f\u00fcr fromme W\u00fcnsche. Denn es kann nicht funktionieren. Mein Argument ist aber kein politisches, sondern ein strukturelles. Ich m\u00f6chte ein Modell beschreiben, mit dem man so manche Verh\u00e4ltnisse erkl\u00e4ren kann, \u00fcber die man sonst nur ratlos den Kopf sch\u00fcttelt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das versuche ich mal mit einer Reihe von Bildern zu erkl\u00e4ren. Damit habe ich mich schon einmal <a href=\"https:\/\/medium.com\/gedankliche-umtriebe\/evolution-der-dysfunktion-teil-1-e376c90e0395\" target=\"_blank\" rel=\"noopener\">in einer Artikelserie<\/a> besch\u00e4ftigt, doch damals sah ich noch nicht den Zusammenhang zwischen Schule und Unternehmen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Beteuerungen sind naiv bis hohl, weil sie einen Zielkonflikt \u00fcbersehen (wollen), der der fundamentalen Struktur der Organisationen Schule bzw. Unternehmen zugrunde liegt. Der sorgt daf\u00fcr, dass nicht oder nur zuf\u00e4llig oder nur unter \u00fcberm\u00e4\u00dfigem Aufwand das beteuerte Resultat entsteht: ein allseits gebildeter Sch\u00fcler bzw. ein zufriedener Kunde.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und dieser Zielkonflikt entsteht so\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Bed\u00fcrfnisse motivieren<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Warum tun wir freiwillig, gar selbstst\u00e4ndig, was wir tun? Weil wir damit ein Bed\u00fcrfnis befriedigen. Das ist meine hoffentlich nicht zu simple Weltsicht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Unsere Bed\u00fcrfnisse reichen vom Biologischen bis zum \u201eIdeellen\u201c. Manche k\u00f6nnen wir nicht l\u00e4nger als Sekunden leugnen, andere aber ein Leben lang. Zwischen manchen l\u00e4sst sich die Befriedigung vereinbaren, zwischen anderen steht sie durchaus im Konflikt. Niemand hat gesagt, dass das Leben einfach sei.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wenn wir ein Bed\u00fcrfnis gen\u00fcgend stark empfinden, werden wir t\u00e4tig, um es zu stillen. Wir interagieren im einfachsten Fall mit der \u201emenschenleeren\u201c Umwelt. Indem wir auf sie M\u00fche aufwenden, ernten wir etwas als Lohn, der uns befriedigt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2738, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2738\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2xl.png 1600w\"  alt=\"\" width=\"295\" height=\"208\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wenn ich Durst habe, stehe ich auf und hole mir etwas zu trinken. Eine geringe M\u00fche f\u00fcr ein lohnendes Glas Wasser. In anderer Situation ist vielleicht kein Wasserhahn in der N\u00e4he, dann muss ich einen weiteren Weg zu einem Supermarkt zur\u00fccklegen. Oder in d\u00fcrregeplagten Weltgegenden m\u00fcsste ich wom\u00f6glich viele Kilometer bis zu einem Brunnen laufen, um etwas zu Trinken zu finden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Manchmal ist die M\u00fche sekundenkurz, manchmal sind Jahre n\u00f6tig, um den Lohn der M\u00fche zu ernten, der ein Bed\u00fcrfnis befriedigt (oder auch nur einen Wunsch erf\u00fcllt).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Selbstbestimmung bedeutet, dass ich w\u00e4hlen kann, welches Bed\u00fcrfnis ich befriedigen will und wie viel M\u00fche ich bereit bin, daf\u00fcr zu investieren. Ob es sich am Ende lohnt, mag ungewiss sein. Doch gerade in Selbstbestimmtheit nehmen Menschen auch Unglaubliches auf sich, um selbst bei geringer Erfolgsaussicht ein tiefes Bed\u00fcrfnis zu stillen. Man kann ihnen nicht vorwerfen, dass sie \u201eim Naturzustand\u201c faul oder unwillig seien. Nur muss eben die Motivation stimmen, d.h. ein Bed\u00fcrfnis stark genug sein. Dann ist ihnen kein Weg zu weit, kein Berg zu hoch.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Bed\u00fcrfnisbefriedigung in Interaktion<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>An diesem Grunds\u00e4tzlichen Willen \u00e4ndert sich auch nichts, wenn Menschen ihre Bed\u00fcrfnisse nicht direkt an der \u201emenschenleeren\u201c Natur stillen, sondern durch Interaktion mit anderen Menschen. Das geschieht zun\u00e4chst auch ganz nat\u00fcrlich direkt:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2736, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2736\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-1-2xl.png 1600w\"  alt=\"\" width=\"288\" height=\"175\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die M\u00fche des einen richtet sich hier auf einen anderen, der den einen daf\u00fcr entlohnt. Die M\u00fche kann sich in einem Haarschnitt ausdr\u00fccken und der Lohn in einem Blumenstrau\u00df. Oder die M\u00fche besteht darin, ein Geschenk zu basteln, und der Lohn in Begeisterung und einer Umarmung. Oder jemand macht sich die M\u00fche, einem anderen bei der Ernte zu helfen, und erh\u00e4lt daf\u00fcr Kost und Logis.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Etwas speziell wird es dann jedoch, wenn der Lohn der M\u00fche Geld ist. Denn Geld ist in unserer Gesellschaft das universelle Mittel, um ganz verschiedene Bed\u00fcrfnisse zu erf\u00fcllen, die man im Moment der M\u00fchsal wom\u00f6glich noch gar nicht sp\u00fcrt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2741, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2741\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-2-2xl.png 1600w\"  alt=\"\" width=\"381\" height=\"163\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Bei einer solchen Interaktion will ich den bed\u00fcrftig Bem\u00fchten <em>Produzent<\/em> und den belohnenden Empfangenden <em>Kunde<\/em> nennen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>F\u00fcr mich ist das im Grunde die Definition von Selbstst\u00e4ndigkeit in der Arbeitswelt: Wer ein Produkt genau an den liefert, der genau ihn mit Geld genau f\u00fcr das Produkt entlohnt, ist selbstst\u00e4ndig. Denn er kann entscheiden, wie er das Produkt gestaltet und welchen Lohn er daf\u00fcr angemessen findet, den er mit dem Kunden dann auch aushandelt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Vielschichtige Tauschbeziehungen<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Insbesondere in der Interaktion zwischen Produzenten und Kunden scheint es mir nun so, dass der Austausch nicht immer nur aus dem Offensichtlichen, d.h. Produkt bzw. Lohn besteht. Mehr schwingt und flie\u00dft zwischen den Menschen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die M\u00fche, des Produzenten, die sich in der Qualit\u00e4t seines Produktes \u00e4u\u00dfert, befriedigt wom\u00f6glich nicht nur ein materielles Bed\u00fcrfnis (z.B. Hunger) beim Kunden, sondern auch ein immaterielles (z.B. den Wunsch nach Respekt).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und der Lohn, den der Kunde dem Produzenten zahlt, befriedigt wom\u00f6glich nicht nur zuk\u00fcnftige materielle Bed\u00fcrfnisse, sonder auch immaterielle (z.B. den Wunsch nach Selbstwirksamkeit).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das, was zwischen den Parteien flie\u00dft ist also mehrschichtig, bunt - und das befriedigende Mischungsverh\u00e4ltnis kann sehr individuell und nicht unbedingt offensichtlich sein.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2737, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2737\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-3-2xl.png 1600w\"  alt=\"\" width=\"275\" height=\"234\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Bed\u00fcrfnisse der Menschen sind vielf\u00e4ltig, warum sollten die Interaktionen zu ihrer Befriedigung also nicht vielschichtig sein?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dennoch: prim\u00e4r ist, wenn es sich um Produzent und Kunde handelt, der finanzielle Lohn. Andere lohnende R\u00fcckfl\u00fcsse erg\u00e4nzen ihn nur oder kompensieren bis zu einem gewissen Grad, falls er geringer als gew\u00fcnscht ausf\u00e4llt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Unternehmen als Interaktionspartner<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Verh\u00e4ltnisse \u00e4ndern sich nicht grunds\u00e4tzlich, wenn Unternehmen die Interaktionspartner sind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2718, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2718\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-4.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-4-2xl.png 1600w\"  alt=\"\" width=\"516\" height=\"123\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Als \u201esoziale Organismen\u201c (oder Organisationen) haben sie ebenfalls Bed\u00fcrfnisse, die sie in Interaktion befriedigen wollen. Lediglich der Lohn f\u00fcr ein Unternehmen scheint mir hier reduzierter auf das reine Geld.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wie es mit den Menschen im Unternehmen aussieht, ist eine andere Sache. Dazu unten mehr. Zun\u00e4chst m\u00f6chte ich Unternehmen als Black Boxes betrachten. So treten sie auf dem Markt auf: B2B wie B2C.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Interaktionsstrukturen<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die \u201eInteraktionsatome\u201c sind die zwischen Begierigem\/Bem\u00fchtem und Entlohnendem, sei das \u201emenschenleere\u201c Natur, Mensch oder Organisation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2723, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2723\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-5.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-5-2xl.png 1600w\"  alt=\"\" width=\"423\" height=\"180\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Aus ihnen lassen sich allerdings beliebige gr\u00f6\u00dfere Strukturen zusammensetzen, in denen Beteiligte beide Rollen spielen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2729, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2729\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-6.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-6-2xl.png 1600w\"  alt=\"\" width=\"491\" height=\"330\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In ihnen gibt es dann z.B. Produktionsketten:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2724, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2724\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-7.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-7-2xl.png 1600w\"  alt=\"\" width=\"362\" height=\"112\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>oder es gibt Aggregations- bzw. Integrationsleistungen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2730, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2730\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-8.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-8-2xl.png 1600w\"  alt=\"\" width=\"272\" height=\"252\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Kunden k\u00f6nnen mehrere Produzenten entlohnen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2735, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2735\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-9.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-9-2xl.png 1600w\"  alt=\"\" width=\"278\" height=\"317\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>und Produzenten k\u00f6nnen mehrere Kunden bedienen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2725, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2725\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-10.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-10-2xl.png 1600w\"  alt=\"\" width=\"257\" height=\"320\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Entlohnung auf Augenh\u00f6he<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Egal wie Interaktionsstrukturen zwischen \u201eMarktteilnehmern\u201c aber aussehen, sie sind grunds\u00e4tzlich auf Augenh\u00f6he; alle Beteiligten sind selbstst\u00e4ndig. Kunde und Produzent stehen in direktem Austausch: der Produzent liefert an den Kunden, der Kunde entlohnt den Produzenten. (Das gilt auch, wenn die Leistung des Produzenten im Handel besteht. Ich verstehe Produktion hier sehr allgemein als Aufwendung einer M\u00fche gegen Geld. Handeln macht auch M\u00fche.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Produzent bekommt \u201eam Markt\u201c unmittelbares Feedback vom Kunden. Das kann in einer mehr oder weniger prompten oder vollst\u00e4ndigen Entlohnung bestehen. Oder es wird als zus\u00e4tzliche Schicht dem Lohnfluss hinzugef\u00fcgt. Der Produzent wird nicht nur befriedigt, sondern kann sein Produkt dem Kunden - d.h. dem Bedarf, der Nachfrage - anpassen. Will der Produzent weiterhin und mehr Gesch\u00e4fte mit Kunden machen, ist er gut beraten, dieses direkte Verh\u00e4ltnis auszunutzen. Sensibilit\u00e4t den Kundenw\u00fcnschen gegen\u00fcber und prompte, hochqualitative Produktion helfen, die eigenen Bed\u00fcrfnisse zu befriedigen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das unmittelbare Verh\u00e4ltnis auf Augenh\u00f6he zwischen Produzent und Kunde speist sich aus intrinsischer Motivation beim Produzenten. Zu beobachten ist das sehr sch\u00f6n auf jedem Wochenmarkt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Dies gilt auch f\u00fcr \u201eB2B\u201c-Interaktionen innerhalb von gr\u00f6\u00dferen Strukturen:<figure class=\"wp-image-2719\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage.tiff\" alt=\"\" \/><\/figure>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2745 size-full aligncenter\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/2019-09-11_13-28-47.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/2019-09-11_13-28-47-2xl.png 1600w\"  alt=\"\" width=\"366\" height=\"265\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Zwar hat der Produzent hier nicht mit dem Endkunden zu tun, sondern \u201enur\u201c mit einem weiteren Produzenten. Doch im direkten Verh\u00e4ltnis ist das einerlei. Dem Produzenten von Schn\u00fcrsenkeln ist ein Verkauf an Schuhhersteller prinzipiell genauso recht wie an Schuhk\u00e4ufer. Der h\u00f6heren Marge bei diesen stehen z.B. gr\u00f6\u00dfere Abnahmemengen bei jenen gegen\u00fcber. Das will abgewogen werden. Am unmittelbaren Verh\u00e4ltnis zu beiden \u00e4ndert das nichts.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Unternehmensstruktur<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So weit die Verh\u00e4ltnisse zwischen \u201eMarktteilnehmern\u201c. Sie sind alle unmittelbar und somit intrinsisch auf Produktqualit\u00e4t konzentriert, die zum Preis passt, so dass die Bed\u00fcrfnisse des Produzenten befriedigt werden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Fokus ist hier auf dem Produzenten, weil der durch seine Bed\u00fcrfnisse angetrieben wird, aktiv zu werden, d.h. M\u00fche aufzuwenden oder gar etwas zu produzieren und daf\u00fcr Kunden zu finden. Der Produzent investiert M\u00fche in Hoffnung auf Lohn. (Dass Produkte dann Bed\u00fcrfnisse bei Kunden befriedigen, wof\u00fcr die willens sind, zu entlohnen, ist eine genauso valide Sicht. Ich nehme sie hier nur nicht ein. Das Henne-Ei-Probleme gehe ich einfach mal von der Henne, dem Produzenten aus an.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Unternehmen verstanden als Organisationen, d.h. soziale Systeme bestehend aus mehreren Menschen zum Zwecke der Produktion gegen Geld, haben nun eine interessante interne Struktur. Die ist ganz bewusst anders gestaltet als Strukturen zwischen Marktteilnehmern.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Unternehmen bestehen mindestens aus zwei Funktionskategorien. Ich will sie F\u00fchrung und Operation nennen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2721, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2721\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-11.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-11-2xl.png 1600w\"  alt=\"\" width=\"339\" height=\"443\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Operation wendet die M\u00fche auf, um Kunden zu befriedigen. Und die F\u00fchrung definiert die Rahmenbedingungen daf\u00fcr. Vor allem aber ist die F\u00fchrung in meiner Betrachtung die Funktion, die das Geld des Kunden empf\u00e4ngt! (Nicht pers\u00f6nlich, aber stellvertretend f\u00fcr das Unternehmen.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>Das ist zentral: Die Operation leistet und die F\u00fchrung kassiert.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Von au\u00dfen ist das nicht sichtbar. Dem Kunden tritt das Unternehmen als Black Box entgegen. Er soll gew\u00f6hnlich nichts \u00fcber seine Struktur wissen. Solange das Unternehmen ein preis-wertes Produkt liefert, bezahlt er den Preis. Der Kunde sieht im Grunde keinen Unterschied zwischen einem Unternehmen oder einem Einzelunternehmer\/Freelancer, wo F\u00fchrung und Operation in einer Person zusammenfallen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2732, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2732\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-12.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-12-2xl.png 1600w\"  alt=\"\" width=\"268\" height=\"180\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Doch diese andersartige Struktur von Unternehmen intern macht einen gewichtigen Unterschied!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>Innerhalb von Unternehmen gibt es keinen Markt.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Bed\u00fcrfnisbefriedigung (vermittelt durch Lohn), gibt es nur grunds\u00e4tzlich gegen M\u00fche, also eine Leistung. Und die wird immer erbracht gegen\u00fcber dem Entlohner. Warum sonst sollte der auch entlohnen?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Genauer betrachtet sehen die Verh\u00e4ltnisse in Unternehmen daher so aus:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2727, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2727\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-13.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-13-2xl.png 1600w\"  alt=\"\" width=\"321\" height=\"338\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich m\u00f6chte fast sagen:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>Die Verh\u00e4ltnisse in Unternehmen sind systematisch \u201ewidernat\u00fcrlich\u201c.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die urspr\u00fcngliche Selbstst\u00e4ndigkeit ist verschwunden. Sie ist ja erkennbar an der unmittelbaren Produkt-gegen-Lohn-Beziehung. In Unternehmen existiert die jedoch nicht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>Lohn gibt es in Unternehmen nicht f\u00fcr Produkte! Lohn gibt es f\u00fcr die Einhaltung eines Arbeitsvertrags.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Im Arbeitsvertrag stecken zwar irgendwie die Produkte, aber mehr nicht, nur irgendwie.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Der, der M\u00fche aufwendet, bekommt daf\u00fcr keinen unmittelbaren Lohn vom Kunden. Die Feedbackschleife ist unterbrochen.<\/li>\n<li>Der, der entlohnt wird, hat daf\u00fcr nichts direkt geleistet. Die Feedbackschleife ist unterbrochen.<\/li>\n<li>Der Lohn f\u00fcr die M\u00fche der Operation kommt intern von der F\u00fchrung. Aber was bekommt die F\u00fchrung daf\u00fcr? Die Feedbackschleife ist unterspezifiziert.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Damit sollte klar sein, dass es interne Kunden in Unternehmen per definitionem nicht geben kann. Egal, was ein Angestellter f\u00fcr einen anderen leistet, nie zahlt dieser jenem einen Lohn daf\u00fcr.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Noch schlimmer werden die Verh\u00e4ltnisse, wenn die Unternehmensstruktur sich weiter ausdifferenziert, d.h. die Produktionskette l\u00e4nger wird und deshalb vermeintlich dar\u00fcber eine F\u00fchrungshierarchie aufgerichtet werden muss:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2739, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2739\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-14.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-14-2xl.png 1600w\"  alt=\"\" width=\"374\" height=\"240\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Positionen tiefer in der Hierarchie und weiter vom Kunden entfernt r\u00fccken von der grunds\u00e4tzlichen Produzent-Kunde-Beziehung immer weiter ab. Sie sind aus der nat\u00fcrlichen Feedbackschleife ausgekoppelt. Ihre Leistungsbeziehungen haben weniger und weniger mit dem Kunden des Unternehmens zu tun, sondern sind zunehmend rein intern. Selbstbesch\u00e4ftigung entsteht, die man B\u00fcrokratie nennen kann. Arbeit wird nicht horizontal auf das Produkt fokussiert, sondern vertikal auf die Hierarchie im Unternehmen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Intern flie\u00dft das Geld nicht mehr aus Richtung des Kunden zur\u00fcck durch die Operationsstruktur. Darin gibt es keine intrinsische Motivation in Bezug auf das Produkt, jedenfalls keine nat\u00fcrliche durch Geld motivierte. Denn das Geld kommt nicht \u201evon vorne\u201c, d.h. Operationseinheiten downstream zum Kunden hin. Das Geld kommt ausschlie\u00dflich von oben. Es gibt ja keinen Markt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und wof\u00fcr gibt es Geld von oben? In der F\u00fchrungshierarchie sitzen keine Kunden, die am Produkt interessiert sind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Gegen\u00fcber der F\u00fchrungshierarchie ist nicht die M\u00fche entscheidend, die ins Produkt gesteckt wird, sondern die M\u00fche, die gegen\u00fcber der F\u00fchrungskraft aufgewandt wird. Diese M\u00fche jedoch ist eine kategorial andere als die, die ins Produkt geht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das \u201eProdukt\u201c gegen\u00fcber F\u00fchrung ist nicht das Produkt, das zum Kunden flie\u00dft, sondern\u2026 Gehorsam: Gehorsam gegen\u00fcber Regeln - ausgesprochenen und unausgesprochenen - und Metriken.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>F\u00fcr Gehorsam wird Lohn an abh\u00e4ngig Besch\u00e4ftigte gezahlt.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Angestellte sind abh\u00e4ngig Besch\u00e4ftigte, weil sie eben keine Freiheit besitzen, ihre Leistung auf einem Markt anzubieten, sobald sie sich einem Unternehmen per Anstellungsvertrag verpflichtet haben; sie sind eben nicht selbstst\u00e4ndig. Das Produkt ihrer M\u00fche und die Empf\u00e4nger ihrer M\u00fche werden durch die F\u00fchrung vorgegeben; daf\u00fcr werden sie entlohnt. Angestellte sind also zuallererst Weisungsempf\u00e4nger der Unternehmensf\u00fchrungshierarchie.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Begriff \u201eGehorsam\u201c wird Ihnen aufsto\u00dfen. Ich habe ihn aber mit Bedacht gew\u00e4hlt, um genau dieses gedankliche Stolpern zu erzeugen. Er soll wachr\u00fctteln; er soll die Augen \u00f6ffnen f\u00fcr die wahren Verh\u00e4ltnisse innerhalb von Unternehmen. Wenn er Ihnen aber zu quer sitzt, ersetzen sie ihn durch \u201ecompliance\u201c; Englisch klingt das Verh\u00e4ltnis vielleicht etwas businessm\u00e4\u00dfiger, weniger deutsch-historisch beladen. Aber machen wir uns nichts vor: Solange von disziplinarischen Vorgesetzten gesprochen wird, geht es auch noch um Disziplin und Gehorsam.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es gibt unternehmensintern keine Kunden, auch wenn der \u201einterne Kunden\u201c noch so sehr beschworen wird, um irgendwie markt\u00e4hnliche Verh\u00e4ltnisse zu suggerieren.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es gibt unternehmensintern keine intrinsische Motivation, ein Produkt zu verbessern. Jedenfalls keine, die durch Geld vom Kunden motiviert w\u00fcrde. Es fehlt schlicht die direkte Beziehung zu ihm. Einzige Ausnahme vielleicht: der Operationsaspekt \u201eVerkauf\u201c. Deshalb gibt es dort auch durchaus erhebliche Provisionen. (Allerdings ist der Verkauf dann wieder von der Produktion entkoppelt. Das macht die Sache also nur vordergr\u00fcndig besser.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es gibt unternehmensintern lediglich die Motivation gen\u00fcgend zu tun, um als pflichtbewusst (aka gehorsam) beurteil zu werden \u2013 damit der Lohn weiterhin flie\u00dft.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Umso mehr gilt das aus meiner Sicht, je gr\u00f6\u00dfer die Unternehmensstruktur ist und je weiter innen Mitarbeiter in ihr angesiedelt sind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das bedeutet im Umkehrschluss: die Kunst der F\u00fchrung besteht in der Motivation der Mitarbeiter in einer Weise, dass deren M\u00fche Produkte von hoher Qualit\u00e4t herstellt, obwohl (!) das Hauptaugenmerk aller Mitarbeiter auf der Beziehung zur F\u00fchrung liegt und nicht auf der zum Kunden bzw. anderen Mitarbeitern downstream Richtung Kunde.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>Regeln und Metriken m\u00fcssen so gew\u00e4hlt werden, dass pflichtschuldiger Gehorsam preis-werte Produkte hervorbringt.<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und nicht nur das! Denn Produkte sind nicht die einzige Leistung von Mitarbeitern. Sie sollen dar\u00fcber hinaus auch noch etwas anderes herstellen: Ver\u00e4nderungen. Mitarbeiter sollen gerade heute ja auch innovativ sein und willig und f\u00e4hig, \u201eChange\u201c aller Art mitzumachen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das Kunstst\u00fcck von F\u00fchrung wird mit jedem Tag gr\u00f6\u00dfer, w\u00fcrde ich sagen. Geradezu unglaublich, dass Unternehmen \u00fcberhaupt so funktionieren. Ja, wie kann das sein?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich glaube, es liegt an der Vielschichtigkeit von Lohn. Abh\u00e4ngig Besch\u00e4ftigte empfangen nicht-monet\u00e4ren Lohn im Rahmen der Unternehmensstruktur und auch von au\u00dferhalb aus vielen Richtungen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2733, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2733\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-15.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-15-2xl.png 1600w\"  alt=\"\" width=\"417\" height=\"276\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Allerdings dort, wo es diesen inoffiziellen \u201elohnenden R\u00fcckfluss\u201c nicht gibt\u2026 da allemal droht mindere Produktivit\u00e4t durch Dienst nach Vorschrift, Unachtsamkeit und mangelnde Qualit\u00e4t oder gar Burn-Out.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und da, wo inoffizieller, unsichtbarer Lohn flie\u00dft, sind die Verh\u00e4ltnisse nur schwer zu kontrollieren. Denn wo ansetzen mit einer Intervention, wenn sich etwas ver\u00e4ndern soll? Die Situation ist gerade dann sehr komplex, weil die Motivationsverh\u00e4ltnisse unklar sind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In einer Tayloristischen Organisation, die nur \u00fcber Geld motivieren will, steckt also schon einige Weisheit. Nur funktioniert es nicht (mehr) so. Weil die Angestellten mehr wollen als Geld. Weil die Kunden mehr wollen, als die Qualit\u00e4t und die Reaktionsf\u00e4higkeit, die solche simplifizierten Unternehmen herstellen k\u00f6nnen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Der Zielkonflikt<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Zielkonflikt besteht zwischen den zwei Empf\u00e4ngern von M\u00fche, denen sich jeder Mitarbeiter gegen\u00fcber sieht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Soll er sich f\u00fcr den Kunden M\u00fche geben, sich downstream orientieren?<\/li>\n<li>Oder soll er sich f\u00fcr die F\u00fchrungshierarchie M\u00fche geben, sich orthogonal zum Produktionsfluss orientieren?<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das ist nicht dasselbe, auch wenn sich F\u00fchrung darum bem\u00fcht oder etwas anderes suggeriert. Es gibt den Winkel \u03d5 immer. Fragt sich nur, wie klein ihn F\u00fchrung machen kann.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2720, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2720\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-16.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-16-2xl.png 1600w\"  alt=\"\" width=\"584\" height=\"282\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Im Zweifelsfall siegt denn auch die M\u00fche gegen\u00fcber der F\u00fchrung. Die Oberhand wird im offensichtlichen Konfliktfall der Gehorsam haben. Helden sind einfach so selten. Gehorsam einen Kundenwunsch nicht zu erf\u00fcllen findet im Verh\u00e4ltnis mehr Akzeptanz (bei der disziplinarisch relevanten und belohnenden F\u00fchrung) als ungehorsam nicht belohnende Kunden zufrieden zu stellen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wann immer es hei\u00dft \u201eDa kann ich Ihnen leider nicht helfen, das ist bei uns so Vorschrift.\u201c sollte das sonnenklar sein. Beh\u00f6rden und gro\u00dfe Unternehmen sind daf\u00fcr bekannt. Aber auch bei kleinen Unternehmen kann man solche Antworten erhalten.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Aufgabe von F\u00fchrung besteht nun darin, w\u00fcrde ich sagen, den Winkel (\u03d5 f\u00fcr \u201eF\u00fchrungswinkel\u201c) zwischen den \u201eZielrichtungen\u201c m\u00f6glichst klein zu gestalten. Je weniger \u201ein Linie\u201c (aligned) die M\u00fche in Richtung Hierarchie mit der M\u00fche in Richtung Kunde (downstream) ist, desto weniger Energie kommt dem Unternehmensprodukt zugute.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2740, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2740\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-17.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-17-2xl.png 1600w\"  alt=\"\" width=\"587\" height=\"214\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das funktioniert umso besser, je mehr F\u00fchrung tats\u00e4chlich \u201ehinter dem Kunden steht\u201c. Poster an der Wand mit markigen Spr\u00fcchen, sind daf\u00fcr allerdings ungen\u00fcgende Lippenbekenntnisse.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Abteilungen vs. Prozesse<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Umso gr\u00f6\u00dfer ist das Gewicht des Gehorsams f\u00fcr die t\u00e4glichen Entscheidungen jedes Mitarbeiters, je vertikaler ein Unternehmen organisiert ist. Wo Abteilungen die vordringliche Organisationsform sind, wird schlicht informelles Feedback unterdr\u00fcckt. Und auch der Produktionsfluss muss immer wieder Barrieren \u00fcberwinden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2726, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2726\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-18.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-18-2xl.png 1600w\"  alt=\"\" width=\"562\" height=\"424\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Eine R\u00fcckkopplung entlang des Produktionsflusses ist hier schwierig. Eine Operation im Sinne kundenorientierter Prozesse existiert quasi nicht. Wie soll da auch noch immaterieller Lohn upstream schwimmen?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das ist umso schlimmer, je mehr die Produktion nicht nur \u201edurch W\u00e4nde\u201c arbeiten muss, sondern auch noch die Hierarchie entlang. F\u00fchrungskr\u00e4fte sind gern mal in Doppelrollen unterwegs als \u201eExpertenfachkraft\u201c plus F\u00fchrungskraft. (Verst\u00e4ndlich ist das, da ja oft F\u00fchrungskr\u00e4fte fr\u00fcher tiefer in der Hierarchie als operierende Fachkraft t\u00e4tig waren. Davon kann man sp\u00e4ter nur schwer die Finger lassen. Allemal scheint aber auch die Einmischung in die Produktion dem Bild nach oben zu dienen. Ist das nicht pflichtschuldiges Handeln, Dinge zu kontrollieren und anzuweisen?)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2722, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2722\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-19.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-19-2xl.png 1600w\"  alt=\"\" width=\"572\" height=\"338\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Anders ist das, wenn Produktionsprozesse im Vordergrund stehen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2734, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2734\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-20.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-20-2xl.png 1600w\"  alt=\"\" width=\"577\" height=\"299\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Hier hat immaterielles Feedback eine Chance, zu befriedigen und zu motivieren. Cross-funktionale, kundenorientierte Organisation hilft, die negativen Effekte von Hierarchien zu mildern.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And now for something completely different\u2026 (or maybe not)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Die Hierarchie des Lernens<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Nat\u00fcrliches, intrinsisch motiviertes Lernen findet unmittelbar gegen\u00fcber den Lerngegenstand statt:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2731, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2731\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-21.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-21-2xl.png 1600w\"  alt=\"\" width=\"330\" height=\"162\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Lohn der M\u00fche besteht in positivem Feedback. Neugierde wird befriedigt, Wissen wird gewonnen, F\u00e4higkeiten werden erworben.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Lernen ver\u00e4ndert sich jedoch grunds\u00e4tzlich, wenn der Lernstoff erstens nicht selbst gew\u00e4hlt ist und zweitens das Feedback in Form von Zensuren gegeben wird. Lernen in der Schule ist eine ganz eigene Sache:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2717, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2717\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-22.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-22-2xl.png 1600w\"  alt=\"\" width=\"337\" height=\"367\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wie beim abh\u00e4ngig Besch\u00e4ftigten ist hier das nat\u00fcrliche Verh\u00e4ltnis aufgebrochen: der Lohn f\u00fcr die M\u00fche kommt nicht aus der Sache, sondern aus einer anderen Quelle, dem Lehrer. Und es wird daf\u00fcr eine \u201eW\u00e4hrung\u201c eingef\u00fchrt: Zensuren.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die Verh\u00e4ltnisse \u00e4hneln denen in Unternehmen. Es gibt eine Hierarchie, die in die nat\u00fcrlichen, unmittelbaren Verh\u00e4ltnisse eine Indirektion einf\u00fchrt. Dort stellt sich dem Feedback F\u00fchrung in den Weg, hier der Lehrer.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und auch in der Schule stellt sich die Frage, was die M\u00fche des Sch\u00fclers gegen\u00fcber dem Lehrer ausmacht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Die M\u00fche des Sch\u00fclers besteht in angepasstem, zensurenoptimierendem Verhalten. Zensuren sind ja nicht nur das Produkt solider Kompetenz, wie die Schule es sich vielleicht w\u00fcnscht. Nein, Zensuren k\u00f6nnen optimiert werden durch spezielles Verhalten, das nichts mit der Beherrschung des Lernstoffs zu tun hat. Das kann explizit gegen\u00fcber dem Lehrer sein; das kann aber auch darin bestehen, mit dem Lernstoff in bestimmter Weise umzugehen. Wer f\u00fcr gute Zensuren lernt, der lernt anders als f\u00fcr \u201eLebenskompetenz\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Allemal wird diese Zensurenoptimierung plausibel, wenn man die Umwelt einbezieht, die in Zensuren belohnenswerte M\u00fche sieht:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2728, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2728\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-23.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/136\/responsive\/DraggedImage-23-2xl.png 1600w\"  alt=\"\" width=\"521\" height=\"376\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Der Zielkonflikt<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Der Zielkonflikt beim schulischen Lernen besteht im Lernen f\u00fcr gute Zensuren vs Lernen f\u00fcr\u2019s Leben, d.h. f\u00fcr echte Kompetenz und Retention.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Eine gute oder schlechte Zensur - allemal f\u00fcr einen nicht selbst gew\u00e4hlten Lernstoff - ist etwas anderes, als das unmittelbare Feedback, wenn man sich an einem selbst gew\u00e4hlten Problem versucht.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Das hat man in der Schule inzwischen auch durchaus erkannt. F\u00e4cher\u00fcbergreifendes, projektbezogenes Lernen nimmt zu, um die Motivation durch Steigerung der Relevanzempfindung zu erh\u00f6hen und das Behalten durch Vernetzung verschiedener Sinneskan\u00e4le und Themen zu f\u00f6rdern. Auch Zensuren scheinen hier und da auf dem R\u00fcckzug.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Einstweilen jedoch sind Zensuren noch das vorherrschende Mittel f\u00fcr Feedback, m\u00fcndliche wie schriftliche. Und damit befinden sich Lernende in einem irref\u00fchrenden und kr\u00e4ftezehrenden Zielkonflikt.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Aber vielleicht soll der sie auf die Unternehmenswelt vorbereiten?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Zusammenfassung<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Mir scheint das wesentliche Merkmal eines Marktes die Freiwilligkeit und Selbstst\u00e4ndigkeit. Austauschbeziehungen entstehen, wo Befriedigung m\u00f6glich erscheint. Qualit\u00e4t entsteht, um Befriedigung aufrecht zu erhalten.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Wird der Markt jedoch ausgehebelt und die darin herrschenden unmittelbaren Beziehungen gekappt, d.h. werden die Freiheit beschr\u00e4nkt und die nat\u00fcrliche Feedbackschleife unterbrochen, dann sinkt die Qualit\u00e4t der Produkte. Und nicht nur die Qualit\u00e4t sinkt, es sinkt auch die Motivation in Bezug auf die Produkte. Der Blick wendet sich ab vom Empf\u00e4nger der Produkte hin zum Belohnenden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es entsteht Verschwendung.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Statt die M\u00fche, d.h. die aufgewandte Energie wie einen Laser zu fokussieren, strahlt man sie in verschiedene Richtungen. Ohne \u201eMarktverh\u00e4ltnisse\u201c werden Menschen allzu leicht zu Gl\u00fchbirnen \u2013 die auch mal durchbrennen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Eine Gesellschaft, die ganz allgemein immer weniger Gehorsam als Wert hat, die diskursiv sein will, kann sich an solchen hierarchischen Verh\u00e4ltnissen nur reiben. Die Menschen und auch die Aufgaben im Rahmen komplexer Produkte sind nicht mehr so, dass per Gehorsam die Energie vor allem der Sache zugute kommen w\u00fcrde.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Solange die Not des Einzelnen gro\u00df ist und die Sache einfach, mag es funktionieren. Beides ist aber nicht mehr der Fall. Deshalb hat aus meiner Sicht die disziplinarische Hierarchie, allemal die gro\u00dfe, ausgedient.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Und was ist die Alternative?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Kleinere Einheiten. Unmittelbarere Verh\u00e4ltnisse. Aufgabe des Kontrollwahns.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Unternehmen wollen durch den Aufbau der internen Hierarchie etwas sparen und etwas gewinnen: weniger Transaktionskosten, die sie am Markt h\u00e4tten, mehr Kontrolle, die sie am Markt nicht h\u00e4tten. Das ist verst\u00e4ndlich und funktioniert \u2013 aber eben nur bis zu einem gewissen Grad.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Hier gespartes Geld und gewonnene Kontrolle werden dort bezahlt mit zunehmender Inflexibilit\u00e4t, abnehmender Motivation, sinkender Qualit\u00e4t, untreuer Kundschaft.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Ich glaube, da hilft nur ein Umdenken: Das, was man als l\u00e4stige Kosten am Markt ansieht, was man als Kontrollmangel empfindet, ist Schmierstoff, der flexibel h\u00e4lt. Und es ist nicht mehr Effizienz, an der es mangelt, sondern Flexibilit\u00e4t.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Es w\u00e4re sch\u00f6n, wenn Unternehmen wie Schulen sich wieder mehr auf die nat\u00fcrlichen, n\u00e4hrenden, motivierenden Beziehungen besinnen w\u00fcrden. Das sind f\u00fcr mich die, in denen der prim\u00e4re Austausch stattfindet: beim Unternehmen der mit dem Kunden, beim Sch\u00fcler der mit dem Lehrstoff.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Menschen sind willig zur Ver\u00e4nderung, wenn sie f\u00fchlen, dass das Sinn macht. Und Sinn macht, was erleichtert, Lohn zur Befriedigung der eigenen Bed\u00fcrfnisse zu erhalten. Das bedeutet f\u00fcr mich im Umkehrschluss: Ver\u00e4nderungen funktionieren vor allem in Bezug auf lohnenswerte M\u00fche. Wer Ver\u00e4nderungen bei anderen ansto\u00dfen will, muss sich daher erstmal im Klaren dar\u00fcber werden, welche Beziehungen die als lohnenswert empfinden \u2013 und ob das dieselben sind, die ver\u00e4ndert werden sollen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sind das nicht dieselben, besteht ein Konflikt, der Leistungen und Ver\u00e4nderungen am Ziel vorbeischie\u00dfen l\u00e4sst.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n","image":"https:\/\/ralfw.de\/media\/posts\/136\/DraggedImage-6.png","author":{"name":"Ralf Westphal"},"tags":["F\u00fchrung"],"date_published":"2019-09-11T20:10:52+08:00","date_modified":"2021-01-25T22:26:43+08:00"},{"id":"https:\/\/ralfw.de\/hamburg-style-tdd-bank-kata\/","url":"https:\/\/ralfw.de\/hamburg-style-tdd-bank-kata\/","title":"Hamburg Style TDD - Bank Kata","summary":"There are already a few different styles of TDD out there. Still, though, my feeling is something is missing in the realm of test-first or test-driven development. I tried to explain that in my posting introducing the \u201eHamburg style TDD\u201c. And then I showed what&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>There are already a few different styles of TDD out there. Still, though, my feeling is something is missing in the realm of test-first or test-driven development. I tried to explain that in my posting introducing the \u201e<a href=\"https:\/\/ralfw.de\/hamburg-style-tdd\/\">Hamburg style TDD<\/a>\u201c. And then I showed what that meant in practice in a second article <a href=\"https:\/\/ralfw.de\/hamburg-style-tdd-diamond-kata\/\">applied to the Diamond kata<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But knowing how hard it is to get the nuances (or even the obvious aspects) of a method across in writing (or with a video), I think I need to provide more examples of the application of Hamburg style TDD.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>As a second example I\u2019m choosing the kata Macro Emrich used to compare the established TDD styles: the Bank kata. If you like, check out Marco\u2019s code samples in <a href=\"https:\/\/www.dropbox.com\/s\/94k73jylzprcbss\/schools_of_tdd.pdf?dl=0\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this presentation<\/a> he did at the <a href=\"https:\/\/www.developer-week.de\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">DWX 2019 conference<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Following I\u2019ll share my version of the kata like I did with the Diamond kata. It differs from the Diamond kata in quite some aspects. Problem solving requires some breadth of approaches. Red-green-refactor + KISS is too simplistic.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Problem description<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This is what I\u2019ve distilled from descriptions of the Bank kata I found on the web. It\u2019s a bit more specific than usual, I guess. But I like it that way. Without specific requirements software development is bound to become even more complex.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>An excerpt from my in-project <code>.md<\/code> documentation of my \u201estream of consciousness\u201c while working on the problem:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:code --><\/p>\n<pre class=\"wp-block-code\"><code>A user should be able to deposit\/withdraw funds from a bank \naccount (object).\nAt any time a statement can be \"printed\" (requested) listing the \ntimestamped transactions and the updated account balance.\n\nExample:\n\n`\nDate       Amount  Balance\n1.7.2019    +1000     1000\n2.7.2019     -200      800\n3.7.2019     +500     1300\n`\n\nInteger amounts are sufficient as are transaction timestamps with dates only.\n\nNo transaction is rejected, even if it leads to a negative account balance.\n<\/code><\/pre>\n<p><!-- \/wp:code --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<p>\u00a0<\/p>\n<h2>1. Analysis<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With the problem description in hand I sit down and analyze it. I log my thoughts in a <code>.md<\/code> file. (The more I do that, the more I like it. It makes my thinking open for scrutiny.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:code --><\/p>\n<pre class=\"wp-block-code\"><code>## Analysis\nEssentially the problem is about an event stream for which a report \nis generated.\n\nThere are two commands:\n\n* deposit\n* withdraw\n\nAnd a single query:\n\n* print statement\n\nFor testing purposes and also as to not dilute the responsibility of \nthe account the statement should not really be printed \n(output to a device), but just generated as a data structure.\n\nFor the timestamp the current time is used, ie. a dependency to the \nsystem is needed.\n\nTransactions will not be persisted. An account's state will be limited \nto the lifetime of it's object.\n\n### 1. Functions\n\n#### Deposit command\n`\nvoid Deposit(int amount)\n`\n\n#### Withdraw command\n`\nvoid Withdraw(int amount)\n`\n\n#### Print statement query\n`\nStatement PrintStatement()\n`\n\n#### Classes\nThe request handling functions can be aggregated by a single class `Account`.\n\nMore classes are needed for the statement if access to the statement \ndetails is needed:\n\n`\nclass Statement\n    Transaction* Transactions\n    \nclass Transaction\n    DateTime Date \/\/ set by the Account class\n    int Amount\n    int Balance\n`\n\n### 2. Test Cases\n`\nInput  | State            || State'\nAmount | Date   | Balance || Balance'\n+100     1.1.19         0        100\n+200     1.1.19       100        300\n-50      2.1.19       300        250\n-300     3.1.19       250        -50\n`\n\nThis development of an account will be expressed in a growing \nstatement (output) after each transaction:\n\n`\nv1\n1.1.19,+100,100\n\nv2\n1.1.19,+100,100\n1.1.19,+200,300\n\nv3\n1.1.19,+100,100\n1.1.19,+200,300\n2.1.19,-50,250\n\nv4\n1.1.19,+100,100\n1.1.19,+200,300\n2.1.19,-50,250\n3.1.19,-300,-50\n`\n\n<\/code><\/pre>\n<p><!-- \/wp:code --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This time I came up with an acceptance test case of my own. It\u2019s exercising not just one function, though, but all functions I derived from the requirements. The acceptance test thus is more like a whole use case.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Also note that this problem leads to several classes. In the Diamond kata classes were of no concern. But here they are needed to aggregate functions and data.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But the modularization is straightforward. It\u2019s quite obvious, I\u2019d say, because it is directly tied to the user\u2019s needs. That\u2019s why I would not say the classes are a product of design. I\u2019m still in the analysis phase.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Maybe noteworthy is that I decided to not deliver a formatted textual account statement. Why should an account (object) care about report layout? It delivers a statement as a data structure some other part of a program can turn into a neatly layouted report.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finally I encode my understanding:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2698, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2698\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-18.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-18-2xl.png 1600w\"  alt=\"\" width=\"1002\" height=\"499\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>There\u2019s only one thing strange about this, I guess: why that kind of constructors on the <code>Account<\/code> class?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2703, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2703\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-1-4.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-1-4-2xl.png 1600w\"  alt=\"\" width=\"489\" height=\"93\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>During analysis I identified a dependency of my <em>system under test<\/em> (SUT, or system under development): It depends on the current date since the statement contains a date in each transaction, but requesting the transactions (<code>Deposit<\/code>, <code>Withdraw<\/code>) does not pass in a date.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>How could an automated test running on an arbitrary date have an expectation regarding transaction dates? Without making \u201edate acquisition\u201c configurable that would be hard. Hence the public ctor for production, and the internal for testing. The public one sees to that the current date is used; but the acceptance test uses the internal one to pass in a substitute function to deliver a date from a fixed set for each transaction.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That makes the test case a kind of whitebox test because it encodes an assumption about how many dates are required. But in this case that\u2019s not severe, I\u2019d say. Four transactions, four dates: that\u2019s pretty obvious.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>2. Design<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Starting from the analysis I do some design. That\u2019s not much, though. The problem is very simple. It\u2019s just that I stop for a moment to gather my thoughts\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:code --><\/p>\n<pre class=\"wp-block-code\"><code>## 2. Design\nThe `Account` class pretty much is an event stream with an \naggregator attached.\n\n* The commands add events to the stream. No checking is needed, all \namounts are ok. But the date is added to the tx.\n* The statement is an aggregation of the events in the stream where \nthe balance is constantly updated.\n\nThe main functionality is statement generation. And within that it's \nupdating the balance. That suggests a function (or even class of its own).\n\nThe event stream is a simple append-only list for (internal) transcactions.\n\n\/\/ Open question: What should happen if a negative amount is passed to \n\/\/ `Deposit()` or `Withdraw()`?\n<\/code><\/pre>\n<p><!-- \/wp:code --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>After that I feel comfortable to start the implementation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>3. Implementation<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Recording transactions<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This is an article about some form of test-first development. So what I\u2019m doing here when I start the implementation of the <code>Account<\/code> class might seem horrible to you: I write logic without a test. I start with production code right away.\ud83d\ude31<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But after my design recording transactions (functions <code>Deposit<\/code> and <code>Withdraw<\/code>) seems so simple that I don\u2019t see much of a danger therein.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2700, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2700\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-2-4.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-2-4-2xl.png 1600w\"  alt=\"\" width=\"637\" height=\"623\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>There really is not much to test anyway. And if I wanted to test the effect of each function I would need to look under the hood of <code>Account<\/code>; it would only work with more whiteboxing.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So I reason that in the end the correctness of transaction recording will show up immediately during statement production: If statement production is working, but delivers the wrong statements, then something must be wrong with recording transactions. In that case I would closer at the transaction methods.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>One word about the <code>Transaction<\/code> class inside of <code>Account<\/code>: It looks similar to the same named class inside of <code>Statement<\/code>. Why two classes for transactions? Because their \u201enature\u201c (or purpose) is different.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p><code>Statement.Transaction<\/code> is visible from the outside. It\u2019s a class used for interaction with the system under development (a DTO). It\u2019s subject to the user\u2019s whim at any moment. I expect it to change due to changing requirements quite often.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p><code>Account.Transaction<\/code> on the other hand is an event object. It\u2019s for recording what\u2019s happening to the state of an <code>Account<\/code> object. (Never mind that it\u2019s not phrased in the past tense.) This class is purely internal, an implementation detail. It\u2019s not under direct stress from user requirements. I expect changing requirements not to lead to changes there, rather more events will be needed.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Two classes with the same name is simply a matter of decoupling. That\u2019s a good architectural style. It\u2019s clean code in my view.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Or let me say it the other way round more bluntly: Clean code does not mean the least amount of code possible to implement some runtime behavior! Just because you see more code than you think is technically needed, does not mean it\u2019s smelling. The question always is: Why? Why more core than fore the bare functional necessity? And the answer has to show that future readers are kept in mind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Yes, future readers over future requirements. It\u2019s not that I don\u2019t value future requirements on the right, but I find concern for future readers more important.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Printing the statement<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Printing the statement is what the whole kata is about. It\u2019s the crucial part and I want to get it right. Also I want to be able to work on it straightforwardly and independently.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>If I wrote a test for just the <code>PrintStatement<\/code> function, though, I would need to open the <code>Account<\/code> class in order to gain control over its state; <code>PrintStatement<\/code> is relying on that.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To avoid this hassle I decide to switch to <a href=\"https:\/\/cumulative-hypotheses.org\/2011\/08\/30\/tdd-as-if-you-meant-it\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">TDD as if you meant it (TDDaiymi)<\/a> from Keith Braithwaite. That means I use tests as my sole development environment; I won\u2019t touch the production code until I\u2019ve finished the functionality.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Also I\u2019ll be moving forward with incremental tests since I\u2019m not really sure how to solve this problem.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":4} --><\/p>\n<h4>Iteration 1<\/h4>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Here\u2019s my first iteration: What should the statement look like if there are no transactions yet? It should be empty.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2702, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2702\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-3-4.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-3-4-2xl.png 1600w\"  alt=\"\" width=\"692\" height=\"144\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I know this code looks pretty stupid. But it \u201esimulates\u201c the situation in production: there are no transaction events (<code>new Account.Transaction[0]<\/code>). And the statement\u2019s number of transactions mirrors that.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>As simple as lines 13 and 14 might look, they are crucial and I expect them to stay the same in next test cases. They are like a seed to grow the solution from. There is a small insight encoded in them.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":4} --><\/p>\n<h4>Iteration 2<\/h4>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The next incremental test is about just one transaction event. I set that up with fixed data in line 23:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2705, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2705\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-4-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-4-3-2xl.png 1600w\"  alt=\"\" width=\"876\" height=\"233\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Line 24 is the same as 13 in the first test. But it\u2019s followed by a manual mapping of the transaction event to the statement transaction.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Line 28 is the only noteworthy line here: It could be reduced to <code>accountTransactions[0].Amount<\/code>, but by including <code>0  +<\/code> I make clear right away that I know the transaction\u2019s <code>Balance<\/code> is an accumulating value.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":4} --><\/p>\n<h4>Iteration 3<\/h4>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>When doing TDDaiymi I actually often create new test cases by copying previous test cases and only change the expectation first. That way it\u2019s immediately red and I\u2019m forced to solve the problem: adjust the test input data, then adapt the logic. This is what I\u2019m doing for iteration 3, too.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now it\u2019s two transaction events to \u201eprint\u201c. The expectations (58ff) and input data (40ff) are set up accordingly. Line 45 and 56 still match 13 and 14 of the first iteration as expected.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2701, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2701\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-5-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-5-3-2xl.png 1600w\"  alt=\"\" width=\"787\" height=\"447\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And in between I copy the mapping from the previous test and adapt the second copy by changing the indexes.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Plus I need to think about how to carry over the balance from the previous statement transaction (line 54).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":4} --><\/p>\n<h4>Refactoring 1<\/h4>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My impression is I\u2019ve solved the statement printing problem. I know how it\u2019s gonna work. Now I just need to generalize it. Currently the number of transaction events is hardcoded. This is along the lines of the <a href=\"https:\/\/blog.cleancoder.com\/uncle-bob\/2013\/05\/27\/TheTransformationPriorityPremise.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Transformation Priority Premise<\/a>, I guess: <em>(constant-&gt;scalar)<\/em> and <em>(statement-&gt;recursion)<\/em>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I refactor the hardcoded solution to a variable solution:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2704, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2704\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-6-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-6-3-2xl.png 1600w\"  alt=\"\" width=\"769\" height=\"434\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The basic mapping stays the same (lines 50 to 54), but I move the balance update up because I want to use a variable for it (line 49).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The loop around the mapping is trivial: for each transaction event a statement transaction is created. The same as before, just automatically done.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":4} --><\/p>\n<h4>Refactoring 2<\/h4>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With the refactored\/generalized logic still getting the test to green I extract it to the production code. I\u2019m confident it will work there, too:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2699, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2699\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/135\/DraggedImage-7-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/135\/responsive\/DraggedImage-7-3-2xl.png 1600w\"  alt=\"\" width=\"618\" height=\"246\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The only adjustment I need to make is changing the source of the transaction events to the <code>Account<\/code> class\u2019 global state <code>_transactions<\/code>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With <code>PrintStatement<\/code> filled in I check the acceptance test. It should be green now - if the implementation of the transaction functions was correct.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And indeed it is!\ud83c\udf89<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Problem solved.\ud83d\ude0e\ud83d\udd7a<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Refactoring<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What\u2019s left is to restrict the accessibility of functions and classes to <code>private<\/code> where necessary. The surface of the production code should be minimal.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s only affecting the <code>Account.Transaction<\/code> class which I set to <code>internal<\/code> while going through the TDDaiymi iterations.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now that it\u2019s hidden, however, the TDDaiymi test becomes flagged. The incremental tests cannot be compiled anymore. Their true nature is revealed: they were <a href=\"https:\/\/ralfw.de\/hamburg-style-tdd-diamond-kata\/\"><em>scaffolding tests<\/em><\/a> all along. That means they now have to be deleted.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The acceptance test remains as the only test. That makes me free to refactor the solution below the surface at any time without breaking tests targeting details.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Summary<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This problem required a somewhat different treatment compared to the Diamond kata: not writing tests for functions, doing TDDaiymi\u2026 That might feel new or uncomfortable to you. But I stand by my opinion: it\u2019s legitimate, it\u2019s even easier than sticking to one of the other schools of TDD.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In the end it\u2019s all about the result. How straightforwardly can you move towards functional and clean code? If ADC and TBC can help, then you should employ them.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But Hamburg style TDD actually is not in opposition of Chicago style etc. Rather it\u2019s embracing them all - and adding a twist. This twist is the recommendation to do explicit analysis and explicit design and to avoid functional dependencies. And that in turn leads to tests with no (or less) need for substitutes, i.e. less complexity.<\/p>\n<p><!-- \/wp:paragraph --><\/p>","author":{"name":"Ralf Westphal"},"tags":["TDD"],"date_published":"2019-07-25T14:53:21+08:00","date_modified":"2021-01-28T17:33:34+08:00"},{"id":"https:\/\/ralfw.de\/co-creation-at-work\/","url":"https:\/\/ralfw.de\/co-creation-at-work\/","title":"Co-creation at work","summary":"Last night I experienced live within 15 minutes an example of co-creation. What an unexpected treat from David who was the presenter at the weekly Business Growth event at Coworking Bansko. David, who talked about visual communication, asked us at the end to apply what&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>Last night I experienced live within 15 minutes an example of co-creation. What an unexpected treat from David who was the presenter at the weekly Business Growth event at <a href=\"http:\/\/coworkingbansko.com\/\" target=\"_blank\" rel=\"noopener\">Coworking Bansko<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2693, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2693\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/134\/DraggedImage-17.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-17-2xl.png 1600w\"  alt=\"\" width=\"628\" height=\"324\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>David, who talked about visual communication, asked us at the end to apply what we\u2019d heard to a simple task: create some \u201eicon\u201c or visual sign for the coworking space. We were to form small groups, come up with a topic, and quickly draw something on a piece of paper.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This was where it got really interesting on a meta-level I think :-)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Team gathering<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finding a group was easy. The group members gathered quickly around the tables. In my group we did not experience noticeable forming, storming or norming throes. We were able to get right to work.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I think that was, when groups turned into teams. Because there was a common goal for all group members they were supposed to achieve together. The exercise was not only about applying some visual concepts, but also about collaboration.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Phase 1: Taming chaos<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>However, working on the task in my team started in\u2026 chaos. No, we did not run around screaming and climbing over each other :-D Rather chaos was signified by a lack of alignment. There was no direction, no focus yet for what actually to draw.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sure we knew that we had to create some visualization. But within this overall task we were clueless. What should our topic be?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Other teams started right away with a fixed topic. They were able to get to work on drawings without discussion. Not us, though.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It took us a couple of minutes to bring order to our chaos. Suggestions for topics where thrown around. Some were new, others refined previous ones\u2026 Some were discussed for a moment, others were just ignored\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then, after a few minutes we pretty suddenly agreed on a topic. To me it\u2019s still strange how that happened. Why that and not another one? Maybe the topic had more of a general appeal to all of us? Or maybe it was more tangible than other ones?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Anyway, it pretty much just happened. There was no ruling by any group member.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Our topic was: Visualizations of the coworking room categories<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>\u201equiet space\u201c (no talking allowed)<\/li>\n<li>\u201esemi-quiet space\u201c (some low voice talking allowed)<\/li>\n<li>\u201esocial space\u201c (talking allowed, even doing phone calls or online sessions).<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With a topic in hand chaos had been tamed. We had drawn a line. Chaos to me is a state of dis-order, i.e. no clear-cut boundaries. In chaos right\/wrong, good\/bad and other dualities are missing. Dis-order equals dis-orientation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But now we knew what to focus on - and what not to consider anymore. That was the achieved duality. And it felt great to share this view with others. The team had found alignment.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Phase 2: Exploring the solution space<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Once aligned the real work of visualization began. How could those coworking space categories possibly be represented in a \u201euniversal\u201c way so that people from different cultures and with different levels of experience with coworking would immediately understand them?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>For that we stopped our discussion and each grabbed a pen and a piece of paper. All team members started sketching ideas. For a minute or two there was no interaction between team members. We were fanning out to explore the solution space individually; not physically, just mentally.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And then we got back together and put our visual ideas in the middle of the table. We discussed the pros and cons of our varied approaches to visualizing the categories. Some were discarded pretty quickly, others were greeted with more agreement.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In a second round some team members tried to build on what had been picked out as more promising visualizations. They went back to the solution space and explored further.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What they found was put before all team members for further discussion.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2692, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2692\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/134\/DraggedImage-1-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-1-3-2xl.png 1600w\"  alt=\"\" width=\"636\" height=\"294\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Although this might sound like a lengthy process if of course was not. It all happened in a matter of a dozen seconds.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It was after this second iteration that one team member had a crucial idea: Why not let all three icons look the same except for a delta representing the category.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That was our \u201eplot point\u201c when we entered the final phase\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Phase 3: Refining the product<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>One of the team members picked up this idea right away and started creating new icons. That way the suggestion manifested for the first time and it looked right.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The discussion now was able to focus more on details. One aspect was to be simplified, another to be emphasised.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2694, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2694\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/134\/DraggedImage-2-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-2-3-2xl.png 1600w\"  alt=\"\" width=\"641\" height=\"295\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With that information another team member drew a version of the icons which then was accepted and handed to David for the final presentation of all designs.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Summary<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Crammed into maybe around 10 minutes this collaboration was a great experience of focused team work. We co-created something I would not have dreamed of before.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2691, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2691\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/134\/DraggedImage-3-3.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/134\/responsive\/DraggedImage-3-3-2xl.png 1600w\"  alt=\"\" width=\"620\" height=\"445\" \/><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In fact I had been a bit reluctant to join a group because I was skeptical about what could possibly be achieved. But I was wrong and am glad for the opportunity to see how co-creation can work even in such ad hoc situations. Thanks, David, for challenging me!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n","image":"https:\/\/ralfw.de\/media\/posts\/134\/DraggedImage-3-3.png","author":{"name":"Ralf Westphal"},"tags":["Creative Process","Coworking Bansko"],"date_published":"2019-07-24T13:58:20+08:00","date_modified":"2021-01-25T22:26:43+08:00"},{"id":"https:\/\/ralfw.de\/hamburg-style-tdd-diamond-kata\/","url":"https:\/\/ralfw.de\/hamburg-style-tdd-diamond-kata\/","title":"Hamburg Style TDD - Diamond Kata","summary":"In a previous article I tried to explain why I\u2019m not satisfied with the existing schools of TDD: They are not really tapping the developers\u2019 capability to think. At least for my taste. Or to say it more bluntly: They are dumbing down developers. Sure,&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>In a <a href=\"https:\/\/ralfw.de\/hamburg-style-tdd\/\">previous article<\/a> I tried to explain why I\u2019m not satisfied with the existing schools of TDD: They are not really tapping the developers\u2019 capability to think. At least for my taste. Or to say it more bluntly: They are dumbing down developers.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sure, their motivation behind that is honorable. And they all assure us of still, no, hence getting to the best possible code result. Nevertheless I think this is doing productivity a disservice.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Mileage always varies with different approaches, but for me the mileage so far has been too low with the established TDD styles. That\u2019s why I came up with yet another one. I call it eclectic because it\u2019s drawing from all sorts of approaches. And I might even not call it a programming style but a problem solving style.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In my previous article I explained why I think TBC (Thinking Before Coding) and ADC (Analyse, Design, Code) are so important. But what does that mean when applied to concrete problems?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Here\u2019s a first problem I tackled to demonstrate this. I chose the Diamond kata because the originator of the Munich style TDD, David V\u00f6lkel, was mentioned <a href=\"https:\/\/twitter.com\/DataDuke\/status\/1151989878499897344\" target=\"_blank\" rel=\"noopener noreferrer\">in a recent tweet<\/a> teaching his style using this kata.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Let\u2019s start\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Problem description<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>First a problem description as I found it on the web:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:code --><\/p>\n<pre class=\"wp-block-code\"><code>Given a letter, print a diamond starting with \u2018A\u2019 with the supplied letter at the widest point.\n\nFor example: print-diamond \u2018C\u2019 prints\n\n..A\n.B.B\nC...C\n.B.B\n..A\n\n(The dots '.' are just placeholders for spaces ' ' to make the result more clear.)\n<\/code><\/pre>\n<p><!-- \/wp:code --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<p>\u00a0<\/p>\n<h2>1. Analysis<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The first thing I do when faced with a programming problem is\u2026 I\u2019m trying to understand it. Sure that\u2019s also advocated by other TDD styles. But exactly does that mean? What\u2019s the result of analysis?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Analysis is the activity which in my view is supposed to produce understanding. But how to document my understanding?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In the end there is no unambiguous understanding except when I\u2019m able to solve the problem (or very similar problems in the same problem class). That means any software I produce needs to be able to do the same. Otherwise I might have understood, but wasn\u2019t able to encode my understanding.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Translated into code that means analysis results in two things:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>examples of successful problem solving (aka test cases)<\/li>\n<li>functions that actually show the behavior as described in the examples.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I usually document my understanding in a file next to the code. In this case I used a <code>.md<\/code> file:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2679, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2679\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-16.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-16-2xl.png 1600w\"  alt=\"\" width=\"691\" height=\"545\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You see, first there is some text explaining what I gleaned from the problem description. An important aspect of that are terms of the domain language.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But then there is a function and test cases. They are the real expressions of my understanding.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The sample problem is so easy, however, I did not come up with my own test case. But if it\u2019s more complicated I will go beyond whatever has been presented by the client.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My analysis is complete once I really get my insights encoded as <em>acceptance tests<\/em> and the signatures of behavior delivering functions:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2667, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2667\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-1-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-1-2-2xl.png 1600w\"  alt=\"\" width=\"805\" height=\"302\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I don\u2019t need to know how to create the results. Just the surface of my \u201esystem under development\u201c needs to be clearly specified.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s easy in this case of course. But what if I had a hard time to come up with an interface? Isn\u2019t TDD supposed to help with that?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Well, my view is: As long as you don\u2019t know which functions should provide the requested services, you should not touch your production code. You\u2019re not even in a situation to write tests.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Lack of clarity of the interface is a clear sign of \u201echaos\u201c (in your head or the client\u2019s head). <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cynefin_framework\" target=\"_blank\" rel=\"noopener noreferrer\">And when in chaos the first thing to do is: act!<\/a><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In the case of programming that means whipping up a REPL or some other scratchpad and start \u201edrawing\u201c, start experimenting. Play around with interfaces all you want. Write a whole prototype, even.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But don\u2019t touch your production code! Not even backed by a test. Otherwise you\u2019ll later on be sorry because you have to go through much refactoring. And that\u2019s always putting strain on your codebase.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The remedy to cluelessness is not refactoring! As long as you don\u2019t have a clue how a system under development\u2019s surface should look like, you\u2019re clueless. You can\u2019t even come up with clear cut test cases.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It\u2019s time for a different mode. Not the test-first mode, but an experimentation mode outside production code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Luckily that\u2019s not the case for the Diamond kata, though. That means my analysis is complete.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Bottom line: For me TDD always means ATDD (Acceptance Test-Driven Development). Don\u2019t start work on production code before there is an acceptance test, i.e. a comprehensive test describing the required behavior.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>An acceptance test to me is a guiding light or a north start. Once the acceptance tests are going green I know my job is done. I don\u2019t mind them staying red for a longer while. I simply don\u2019t execute them all the time ;-)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>2. Design<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With the acceptance tests implemented I continue by TBC. I ask myself:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li>Can I partition the overall problem into smaller, complementary problems which I then solve independently?<\/li>\n<li>Are there simpler problems nested inside the overall difficult one? Can I find a list of incremental tests?<\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The second step is what TDD originally was about, I think. In my view, though, this only works well for very simple problems. It\u2019s a not to be neglected question, but in my approach is not the first one to ask.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My first step is to look for more or less obvious sub-problems which I can solve more or less independently - hoping that the solutions to the sub-problems later can be integrated into a solution for the overall problem. Each sub-problem again will be represented by a function responsible for some partial behavior.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019m using the good old \u201estepwise refinement\u201c approach, you could say. I\u2019m recursively descending a problem tree.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And why not? Just because it\u2019s an old approach doesn\u2019t mean it\u2019s not fit for the modern world.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But I\u2019m using it with a twist! And that\u2019s quite important for the clean code goal. My function hierarchies are free of functional dependencies. I\u2019m not distributing logic vertically all over the hierarchy, but lump it together in the leaf functions, called <em>operations<\/em> according to the IOSP (Integration Operation Segregation Principle). That\u2019s making a huge difference for understandability and testability!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Here\u2019s what I came up with as a design for the Diamond kata:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2670, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2670\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-2-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-2-2-2xl.png 1600w\"  alt=\"\" width=\"750\" height=\"254\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It\u2019s more precisely documenting my understanding of the problem and delivering a <em>model<\/em> for the implementation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The model consists of yet more functions, but in addition to that also relations between those functions.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>There is a hierarchical relation: The original user facing function, the root function of the function tree depends on the other functions.<\/li>\n<li>There are before-after or sequence relations: The partial functions will need to be called in a certain order.<\/li>\n<li>There is an implicit aggregation relation: All functions will belong to the same module (class).<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Noteworthy of this kind of design is the absence of loops! To declarative and on a high level of abstraction a model needs to be free of imperative loops. Looping will occur in the end, but in the model it\u2019s hidden.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This design process maybe takes me 10 minutes. The most effort goes into actually writing the results down for the purpose of this article.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Why should I not invest this short time up-front for design? It\u2019s easy, and it delivers starting points for further tests. I don\u2019t need to drive the implementation through the root function. That, to me, would feel artificial, and not simpler. And I would have to refactor more.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My design will produce clean code, I\u2019m confident. Because the implementation will follow the IOSP.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Growing logic by applying tests primarily to the root function (and later refactor) is like <a href=\"https:\/\/de.wikipedia.org\/wiki\/Williams_Christ\" target=\"_blank\" rel=\"noopener noreferrer\">growing a Bartlett inside a bottle<\/a>. I call that <em>pear programming<\/em>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2669, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2669\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-1.tiff\" alt=\"\"><\/figure><figure class=\"alignnone size-medium wp-image-2684\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/Williams_Christ_Obstbrand-172x300.jpg\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-xs.jpg 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-sm.jpg 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-md.jpg 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-lg.jpg 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-xl.jpg 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/Williams_Christ_Obstbrand-172x300-2xl.jpg 1600w\"  alt=\"\" width=\"172\" height=\"300\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Source: <a href=\"https:\/\/de.wikipedia.org\/wiki\/Williams_Christ\" target=\"_blank\" rel=\"noopener\">Wikipedia<\/a><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It can be done. It\u2019s a piece of art, maybe. But I find that hard. The harder the more logic this way should be developed. Because that way it\u2019s impossible to target pieces of logic with tests. All logic is always under test - unless you swap it out with <a href=\"https:\/\/martinfowler.com\/articles\/mocksArentStubs.html\" target=\"_blank\" rel=\"noopener\">substitutes<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Substitutes, though, to me are additional complexity I want to avoid! I\u2019m not saying they should not be used. But to base a programming approach on them is not my cup of tea.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>A KISS for design<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>One argument against my approach, I hear, is that I\u2019m not doing the simplest thing possible. Starting with a trivial test (even a degenerate test case) and then answering that with maybe only a singe line of production code would be much, much simpler. And it would immediately deliver a (small) value. And it would guarantee that no production code gets written without being covered by a test.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>By now you can imagine: I beg to differ.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In fact I think my kind of design is the simplest thing you can do. I\u2019m following the KISS principle to the letter.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Why? Because I don\u2019t even implement a single line of code (at first). What\u2019s simpler than writing code? Not writing code! That\u2019s faster, that does not produce waste which later needs to be refactored.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Designing by stepwise refinement, by dissecting large problems into smaller ones is so simple because it \u201eassumes\u201c that certain \u201eservices\u201c will be available. It does not care how they are going to be implemented. That\u2019s details to wreck your brain about some other time.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The above list of functions is a wish list. I\u2019m wishing for help: \u201eHow nice it would be to have a function that does X\u2026\u201c or \u201eWhat a relieve it would be to not worry about problem Y anymore because a function is taking care of that\u2026\u201c<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>If I cannot simplify a big problem by at least coming up with two partial problems which are smaller I guess I don\u2019t really have a clue about what\u2019s going on in the first place. Either I can solve a problem by writing the logic \u2013 or I can solve it by dissecting it into smaller, complementary problems.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With regard to the Diamond kata wishing for help could run like this:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>\u201eOh, there is a single input letter, but the diamond consists of multiple letters up until the input letter. I wish there was a function taking care of getting me this list. The rest then can be accomplished by another function.<\/li>\n<li>\u201eHm\u2026 given a list of letters I need to generate the layers of the diamond. Half of them are unique. It would be nice to have a function doing that. Another one could then take care of building a full diamond from them.\u201c<\/li>\n<li>\u201eNow that I have a list of letters the hard part is to generate a single layer with the right spacing. I wish there was a function for that. Generating layers for all letters then is simple based on that.\u201c<\/li>\n<li>\u201eThe most difficult thing about a layer is to get the number of leading spaces and separating spaces right. There should be a function calculating that for each layer. Arranging the letter in a layer based on that info then would be easy.\u201c<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I find this most simple. And if it\u2019s not then I need to double down on thinking the problem through or maybe go back to analysis. Not being able to come up with a \u201efunctional design\u201c to me is the first sign of cluelessness. I would not recommend to touch production code in such a state of mind.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>3. Implementation<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>After design all\u2019s prepared. At least that\u2019s true in this simple case. I know all the functions that will be needed. I\u2019ve a good feeling about this. If the problem was larger I would not have refined the whole function tree down to the last operation. Remember: I\u2019m all for iterative and incremental progress. TBC with ADC is not about a resurrection of the waterfall.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Backed by the acceptance tests I now implement the functions I \u201euncovered\u201c during design in any order. I could start with the seemingly simplest or simply with the first one. It pretty much does not matter.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Determine the layers<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The partial problem of determining the number of layers with their respective letters (layer names) I attack using\u2026 incremental tests. Inside my approach I\u2019m using pretty much Chicago style TDD. You see why I\u2019m calling it eclectic?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I come up with two tests growing in difficulty and implement the production code by going red-green-red-green.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2668, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2668\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-3-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-3-2-2xl.png 1600w\"  alt=\"\" width=\"815\" height=\"274\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>There is nothing to refactor after the first test and not even after the second test. The function is so focused, so small.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>You might find that the code to get the second red test to green does not seem simple. If so I say: To hell with simplicity! At that point I had a clear idea of how to solve the problem once and for all. Why not just write it down?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I could have used another test to drive out some pattern and refactor\u2026 but with this kind of small problem that seemed too much effort.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Or if you find the implementation lacking with regard to null boundary checks let me say: To hell with defensive programming! It\u2019s not the responsibility of this function to check if the seed is in a certain range. If so, it just fails. There is not even a requirement to behave in a certain way in such a case. Why should I implement a solution to a non-existing requirement?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Defensive programming, I have to say, often is a form of procrastination. It\u2019s applied to postpone solving the hard problems. It\u2019s applied to ward off \u201efriendly fire\u201c from code other team members might write. It thus is a substitute for the right thing to do: Doing real thinking about the real problem and drawing explicit trust boundaries during joint design sessions with other team members.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Calculate layer whitespaces<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My approach again changes with the second function I implement: I go for a \u201eone shot kill\u201c: first a red test on an acceptance test level (for a partial problem), then all the necessary production code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2672, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2672\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-4-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-4-2-2xl.png 1600w\"  alt=\"\" width=\"797\" height=\"215\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019m not trying to crawl my way to a full solution with incremental tests because the solution is sitting right in front of me in the design. I\u2019ve done \u201emy math\u201c in the design document already; it was part of understanding the problem. Why shouldn\u2019t I use that now?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And again: the operation is so small. The loop is following a pattern, the calculations are trivial. If the one test would fail it would be easy to detect the cause.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Of course the production code is benefiting from language features like <code>yield return<\/code>. No need to allocate a data structure to compile the results in. Also no need to define a data structure to carry both values for each layer. C# tuples as \u201ead hoc records\u201c are perfect for that.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Please note how only the number of layers is passed to the function. No need to let it know about the layer letters. That\u2019s decoupling in the small. It\u2019s made easier by designing the functions before implementation. Refactoring to this kind of decoupling later on would be harder.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Generate the unique diamond layers<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The third partial problem again is different from the previous ones. I now realize it\u2019s too difficult to solve right away or with incremental tests. So I revert to stepwise refinement once again.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The overall problem of generating the unique layers consists of the partial problem generating of generating just a single layer - and a remaining problem of doing that for all layer letters.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It\u2019s a typical \u201eN:1 problem\u201c. Or you could call it a mapping problem: the same thing is done for each item in a collection. However here it\u2019s two collections of the same length. The layer letters have to be \u201emerged\u201c with the layer whitespace calculations.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What I do in this case I use a bottom up approach: first I implement the nested function for generating a single layer. I do that again with two incremental tests, red-green-red-green.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2674, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2674\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-5-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-5-2-2xl.png 1600w\"  alt=\"\" width=\"1034\" height=\"245\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The first version of the production code might seem not really according to KISS. Why include the <code>if<\/code>? For the first test this condition was not necessary.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Well\u2026 I guess my attention slipped a bit. I indulged in some look ahead. I knew a second test was coming which would need the conditional statement.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>(While I was writing it I actually stopped for a second and mused about it\u2026 but I did not draw the right conclusion: not necessary right now, throw away.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Please note the strange letter passed into the function: Why a <code>*<\/code> which is not a valid layer letter? This is my way of making obvious that this function does not care about \u201ecorrect\u201c diamond characters. It\u2019s focused on the layout of whatever it gets.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>After I got the generation of a single layer working I move a one level up the function hierarchy. Doing one layer is integrated by a function for generating all unique layers:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2678, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2678\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-6-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-6-2-2xl.png 1600w\"  alt=\"\" width=\"1059\" height=\"178\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This one again is so easy, I just use a single test to drive its production code. I dare to do that because C# is offering powerful abstractions like Linq; there are no more loops to get right.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Build diamond<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finally I get to the function building the diamond from the layers. This again is so simple I just need one test:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2675, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2675\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-7-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-7-2-2xl.png 1600w\"  alt=\"\" width=\"882\" height=\"129\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>As you can see the function consists of two parts. The levels of abstraction of its logic are not even: line 50 is slightly more abstract than line 51f. I need a bit more mental effort to understand what 51+52 are doing than what 50 does.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But in the end it\u2019s such a small function I don\u2019t think more structure is needed. Or maybe this is a case where comments would help?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2680, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2680\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-8-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-8-2-2xl.png 1600w\"  alt=\"\" width=\"398\" height=\"167\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Crossing the finish line<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s it. All functions from the design have been implemented. They are doing their partial jobs. That means all \u201emusicians\u201c are ready, the instruments are tuned. It\u2019s time for them to come together as a band and play a concert.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I do this by calling the partial functions from the root function:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2666, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2666\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-9-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-9-2-2xl.png 1600w\"  alt=\"\" width=\"550\" height=\"133\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Calling functions is the root function\u2019s only responsibility. I call that <em>integration<\/em> (or composition) as opposed to <em>operation<\/em>. Operation is what the other functions are doing. They contain logic, they are the real workhorses of the solution.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>(With the exception of <code>GenerateUniqueLayers<\/code> which I also view as an integration due to its shortness and usage of Linq, even though it\u2019s not just calling another function but wrapping that.)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Coding the integration is easy by definition. It\u2019s so easy in fact, that intermediate integrations in an IOSP-based function hierarchy hardly need testing at all. It\u2019s the same as if you extracted a method during refactoring: you don\u2019t put that under test immediately.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With the root function, the function which the user\/customer is interested in, filled out I check the acceptance test cases from the beginning\u2026 And lo and behold they are both green!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019m done with solving the original problem.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Refactoring<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So far no refactoring seemed necessary. Due to TBC the code already is very clean, I\u2019d say: all functions are small, the integration gives a good overview of how the problem is solved, the SRP reigns.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now that I\u2019m finished, though, I step back and try to imagine how a future reader of the code (possibly myself) would experience it.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The first thing I notice is that <code>Print<\/code> still is kind of fraught with details. I decide to extract another function:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2677, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2677\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-10-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-10-2-2xl.png 1600w\"  alt=\"\" width=\"648\" height=\"256\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Now <code>Print<\/code> tells the story what a diamond production looks like in three easy \u201esentences\u201c: <em>First calculate the size of the diamond by determining the layers it should consist of. Then actually generate those layers, but only the unique ones. Finally build the diamond from the layers.<\/em><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>While reading this story no details of the processing steps are necessary to know. At first that\u2019s what some developers cannot really accept; they tend to read the code depth-first. However, my approach favors breadth-first reasoning.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And <code>GenerateUniqueLayers<\/code> is yet another integration which is focused on layer generation. It\u2019s hiding the details of that so <code>Print<\/code> can be shorter and more conforming to the SLA principle.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Although IOSP-based code is easy to understand due to many small methods and clearly visible processes, code sometimes cannot tell the full story. Why are things how they are, what do certain terms mean?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Even with this small example I felt that was the case. So I also added an introductory comment:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2671, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2671\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-11-2.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-11-2-2xl.png 1600w\"  alt=\"\" width=\"695\" height=\"399\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To me comments are not a code small per se. It\u2019s what the comments are used for that is important. Background information, documentation of decisions, some kind of glossary\u2026 all that and more can be valuable in code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Deleting tests<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finally, now that I\u2019m satisfied with my solution, a fundamental act of refactoring. It\u2019s almost unheard of, I\u2019d say, but I\u2019m doing it on a regular basis as part of my approach: I delete tests.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Yes, that\u2019s true. I delete tests which would make future refactorings harder.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To see which tests are of no longterm use I simply set the accessibility of all methods to <code>private<\/code> which haven\u2019t explicitly been ordered by the customer. Methods not used in acceptance tests are obviously not used and should be hidden as structural details.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>All methods of the single class of my solution except for <code>Print<\/code> thus go <code>private<\/code>. And all tests exercising these methods go red and are deleted. That\u2019s seven test functions.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The only remaining, stable, long term tests are the <em>acceptance tests<\/em>. Or more generally tests of methods which need to remain public on other classes I might have designed (or which were created during refactoring). Tests of methods on such classes which also haven\u2019t been requested by the customer and might vanish at any time I call <em>module tests<\/em>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And the tests which just got deleted to me are <em>scaffolding tests<\/em>. Like a scaffold on a building they were useful while building up the logic. But once the logic is complete they are torn down like a scaffold on a building. Otherwise they would impede future changes of the overall structure.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But isn\u2019t it a waste of time to write those tests in the first place if they get thrown away? I don\u2019t think so. They were of great help to develop logic function by function. They were like finely honed probes measuring some quality of my code at precise points. Also they can guide later decisions with regard to modularity: If I very much hesitate to delete a scaffolding test that might be a signal to extract a module on which the function under test is <code>public<\/code>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I would not have been able to drive my logic test-first at such detail and in such isolation only with tests going through the root function. \u201ePear programming\u201c to me is too inflexible, too cumbersome. I like fine grained control over my logic and tests. I like to build my ship outside the bottle before I shove it in and erect the masts.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2676, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2676\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-12-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-12-1-2xl.png 1600w\"  alt=\"\" width=\"389\" height=\"259\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Source: <a href=\"https:\/\/www.wikihow.com\/Build-a-Ship-in-a-Bottle\" target=\"_blank\" rel=\"noopener\">wikiHow: How to Build a Ship in a Bottle<\/a><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What I hear from developers trying one of the other TDD styles often is they feel trapped by all their tests. Refactoring becomes impossible without turning many tests red which then requires them to correct them.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019m suffering much less from such effects. Because I keep less tests around.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The most important and long living tests are the acceptance tests. They exercise the logic in a solid way.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Module tests complement acceptance tests; they knit the safety net more finely. But if they turn red due to refactoring I\u2019m very willing to throw them away instead of repairing them.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Summary<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Hamburg style TDD is about thinking before coding, the absence of functional dependencies (substitutes are comparatively rarely used), and also about the \u201eart of letting go\u201c. Don\u2019t attach yourself too much to your tests.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It\u2019s an outside-in approach to problem solving and programming.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<hr>\n<p>PS: You might be wondering if all this leads to overengineering. So many functions\u2026 isn\u2019t that much overhead?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Well\u2026 this is the alternative: The same logic sitting in just a single function.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2673, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2673\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-13-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-13-1-2xl.png 1600w\"  alt=\"\" width=\"605\" height=\"349\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Is that, what you like to see when asked to fix a bug? Multiply the number of lines by 2, 5, 10, 50 because that\u2019s how long functions in \u201ereal code bases\u201c usually are; even methods with 5000 lines of code and more are not unheard of.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Functions not following the IOSP tend to grow indefinitely. There are no boundaries to growth. And the general recommendation \u201ekeep your functions small\u201c is pretty fuzzy. What does \u201esmall\u201c exactly mean? And where to stop, what else to do?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The IOSP is a great guideline towards codebases with all small functions.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But the above function still is small. Why have more than one function? Reason no. 1: Because this is an exercise. Reason no. 2: Even small functions can contain logic that is hard to get right. Wouldn\u2019t you want to be able to check that easily?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But the above function is not what a classic TDD approach \u2013 aka \u201epear programming\u201c \u2013 would have led to. Fewer functions would have been extracted from the growing logic in the single function under test.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s true. But firstly refactoring is hard and easy to avoid. Secondly the result probably would have been a root function not conforming to the SLA: there would be a mixture of logic and function calls in it. That would not be easy to understand.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finally I find code refactored from functions with functional dependencies and driven by TDD often not easy to read because it\u2019s hard to extract responsibilities cleanly once they were entwined. Sure, not to refactor is no solution. But not having to refactor due to a clean design before coding leads to better results in my experience.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>\u00a0<\/p>\n<p>PPS: It\u2019s never over! Today\u2019s clean code is tomorrows dirty code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Cleanliness of code is subjective and relative to your understanding\/knowledge. If you gain new insights clean code you wrote yesterday will turn into somewhat dirty code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>A case in point the <code>BuildDiamond<\/code> function. I expressed some concern regarding it and even suggested comments to improve it. But just know I had another idea:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2681, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2681\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/133\/DraggedImage-14-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/133\/responsive\/DraggedImage-14-1-2xl.png 1600w\"  alt=\"\" width=\"425\" height=\"111\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This to me is cleaner. It\u2019s the same functionality, hence I call it a refactoring. But instead of extracting structures I redesign the approach to solving this partial problem and implemented it using more of the power of Linq. Now the function shows better SLA; no comments are needed.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I changed the logic even without the scaffolding tests being present anymore. I was confident the acceptance tests would catch any regression.<\/p>\n<p><!-- \/wp:paragraph --><\/p>","author":{"name":"Ralf Westphal"},"tags":["TDD"],"date_published":"2019-07-23T19:58:14+08:00","date_modified":"2021-01-28T17:45:28+08:00"},{"id":"https:\/\/ralfw.de\/hamburg-style-tdd\/","url":"https:\/\/ralfw.de\/hamburg-style-tdd\/","title":"Hamburg Style TDD","summary":"There are a number of \u201eTDD styles\u201c (or even \u201eschools of TDD\u201c): And I cannot identify myself with any of them. Not 100% at least. Recently I attended a talk by Marco Emrich who showed the above styles next to each other - and I&hellip;","content_html":"<p><!-- wp:paragraph --><\/p>\n<p>There are a number of \u201eTDD styles\u201c (or even \u201eschools of TDD\u201c):<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li><a href=\"https:\/\/8thlight.com\/blog\/georgina-mcfadyen\/2016\/06\/27\/inside-out-tdd-vs-outside-in.html\" target=\"_blank\" rel=\"noopener\">Chicago style<\/a><\/li>\n<li><a href=\"https:\/\/8thlight.com\/blog\/georgina-mcfadyen\/2016\/06\/27\/inside-out-tdd-vs-outside-in.html\" target=\"_blank\" rel=\"noopener\">London style<\/a><\/li>\n<li><a href=\"https:\/\/de.slideshare.net\/davidvoelkel\/fake-it-outsidein-tdd-xp2017\" target=\"_blank\" rel=\"noopener\">Munich style<\/a><\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And I cannot identify myself with any of them. Not 100% at least.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Recently I attended a talk by <a href=\"https:\/\/twitter.com\/marcoemrich\" target=\"_blank\" rel=\"noopener\">Marco Emrich<\/a> who showed the above styles next to each other - and I kept shaking my head. There was some usefulness to all of them, but none really convinced me.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then I saw a tweet by <a href=\"https:\/\/twitter.com\/davidvoelkel\" target=\"_blank\" rel=\"noopener\">David V\u00f6lkel<\/a> in which he mentioned doing the Diamond kata \u201eMunich style\u201c. That triggered me to do it, too - and also Marco\u2019s example from his talk, the Bank kata.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Styleguide<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But what am I doing differently? Am I doing some kind of TDD at all? What\u2019s TDD in the first place?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>My understanding of TDD<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>TDD is mainly characterized by a simple process with three steps:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li>Red<\/li>\n<li>Green<\/li>\n<li>Refactor<\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That means it\u2019s a test-first approach to programming: first write a not passing test (red), then write production code to make the test pass (green).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What takes it beyond test-first, though, is the refactoring step. By that TDD acknowledges that production code should not only pass tests, i.e. show some runtime behavior, but also be of a certain form (which is not relevant to its behavior).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Also TDD clearly states its process should be run through multiple times. TDD explicitly is an iterative approach to programming.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And then TDD urges you to let test cases increase in their difficulty from iteration to iteration. With each iteration a bit more value is added to the production code. TDD thus also an explicitly incremental approach to programming.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>There is little said, however, about how each step should be performed. But getting a test to green should only involve the simplest possible addition to the production code (application of KISS principle). And refactoring should eliminate duplication.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Since Kent Beck is the \u201einventor\u201c of TDD it\u2019s no small wonder that also his \u201e<a href=\"https:\/\/martinfowler.com\/bliki\/BeckDesignRules.html\" target=\"_blank\" rel=\"noopener\">for elements of simple design<\/a>\u201c are of relevance:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Passes the tests<\/li>\n<li>Reveals intention<\/li>\n<li>No duplication<\/li>\n<li>Fewest elements<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s pretty much it, I guess. That\u2019s TDD. Easily stated - but difficult to implement. The problems start, I think, when applying all this blindly. Rules seem to ask for obedience. And so developers are trying to obey - with very mixed results and quite some frustration.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>No small wonder, different \u201eschools of TDD\u201c emerged.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The matter is and the problems are too complex for a single set of rules and a single approach. On top of that there is probably an unknown amount of loss in communicating TDD: Kent Beck surely is the master of TDD - but does he (or even can he) convey everything he does\/think\/know in a book or several blog posts? I don\u2019t think so.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>When communicating one\u2019s own \u201ebeing\u201c much cannot be said explicitly. Much is falling through the cracks when preparing a descriptive document. Being can only fully be experienced by watching someone in a not prepared situation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What happens when a lossy communication is taken for something lossless? Confusion ensues. Applying the lossy content will not lead to the same results as for the originator. This leads to frustration, conflicts, lots of discussion, or worse.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This has happened for Agility in general and also for TDD as part of Agility, I think.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Only experience counts<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>From the inevitability of lossy communication (and before that reflection about one\u2019s actions) follows that adherence to rules cannot be the goal.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p><strong>Rules are nothing! The only thing that counts is success. If you consistently experience success without following certain rules, whatever you do is superior to the rules.<\/strong><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Rules thus are only suggestions for how to achieve results. Nothing more, nothing less. They are invitations - and can be declined.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Follow rules at your own peril.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Don\u2019t follow rules at your own peril.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To improve your results, your task is not to follow rules, but to evaluate your actions - and then adjust your approach if you find the results lacking some quality. You cannot offload responsibility for results to certain rules. The responsibility always is with you.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Kent Beck, Robert C. Martin, J.B. Rainsberger, David V\u00f6lkel, or Ralf Westphal are only reporting (personal) experiences and their humble reflections on why they think there might be causal connections between doing something and getting certain results.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>If you feel inspired by that and try to reproduce their results, stay alert. Lots of things can go wrong. And not all that was going on when they made their experiences has been\/could be reported.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Trying harder to follow whatever account you read to overcome some information loss thus is natural. Also it\u2019s natural to adapt whatever you\u2019ve heard to your situation. You\u2019re entitled to your own experiences and reflections. Maybe they just deviate from what you\u2019ve read, maybe they are in outright opposition.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Any result, any approach is ok. Just remember: reflect on it.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>My reflections<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s what I\u2019ve done: I reflected on why I wasn\u2019t satisfied with the results I got from applying TDD.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To make a long story short, what I found was: TDD was playing dumb.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>TDD is a problem solving tool. The problem being: conversion of requirements into code. And to be more precise: into logic plus structure. Logic to create the desired behavior at runtime, structure to keep programmer productivity high over an indefinite period of time. TDD is about functional and clean code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s great! I\u2019m all for this result.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But I beg to differ with regard to the approach.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Where I agree:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>I agree with the basic test-first approach of TDD.<\/li>\n<li>I agree with the importance of refactoring.<\/li>\n<li>I agree with revealing intentions.<\/li>\n<li>I agree with avoiding duplication.<\/li>\n<li>I agree with avoiding overengineering.<\/li>\n<li>I agree with the importance of passing all tests.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But there are a couple of points I don\u2019t agree with:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Refactoring is great. But even better is to not need to refactor. If I can come up with (pretty) clean code right from the start, why should I refactor.<\/li>\n<li>What to refactor to? TDD is barely making any statement about that, which is one of the reasons why many supposedly TDD based solutions I\u2019ve seen are\u2026 not clean.<\/li>\n<li>Overengineering sure is an evil to avoid. But something that might look like overengineering to the code author today might be a helpful structure to a code reader tomorrow. Where to draw the line? My feeling is, TDD users are carried away too often by the mentions of KISS and \u201efewest elements\u201c. \u201eElegance\u201c is still in high esteem, even though it\u2019s a twin of obscurity.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And finally: What\u2019s bugging me again and again when looking at TDD examples is the neglect of easily achievable insight. TDD proponents are dumbing themselves (and thus the process) down in a drive to\u2026 hm\u2026 to what? Maybe to avoid overengineering? Or to go faster while writing code?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Yes, I guess it\u2019s the will to be faster and to avoid BDUF. BDUF is costing time now and time later when it needs to get adapted to new information. BDUF is bad. We know that, right?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sure, BDUF is bad. By definition. It\u2019s evil because of the B. <em>Big<\/em> design is deferring feedback.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>DUF, though, is not bad in my experience. Designing a solution before coding is even inevitable. At least I need to think before coding. I need to make a plan before I create structures and arrange logic. Sometimes the thinking takes 10 seconds, sometimes 10 minutes or 30 minutes.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>TBC (Thinking Before Coding) to me is essential. It\u2019s a discipline of its own. It needs to be trained, it needs to be taught.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But TBC has vanished from curricula and is not visible in popular TDD examples.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019m not saying TDD proponents are not thinking before coding. What I\u2019m trying to get across is that such thinking is not made explicit. It has no form. It\u2019s not expressed in code or in any other way.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The incremental tests of TDD are no expression of such TBC in my view. Because test cases are only about understanding requirements, not designing a solution. Tests are no models.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Models, however, are badly needed, if coding is supposed to progress smoothly.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>The perennial cycle of software development<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I want to add another iterative process to TDD\u2019s red-green-refactor (RGR). It\u2019s simple, it\u2019s natural, it\u2019s even inevitable:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Analyze<\/li>\n<li>Design<\/li>\n<li>Code<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The ADC iterations are sometimes congruent with the RGR iterations, but sometimes not. RGR can happen inside of C.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In any case I find it important to emphasize these three step process because I think it\u2019s what software development is about, and not only software development if you replace \u201eCode\u201c with some other implementation discipline like \u201ePaint\u201c or \u201eCook\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>ADC is to be cycled through many times on different levels of detail. It\u2019s to be used iteratively and even incrementally if possible.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And, yes, the D sits right before the C. So it\u2019s design \u201eupfront\u201c, it\u2019s thinking before coding. Like it\u2019s listening and asking before designing.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In my \u201eschool of TDD\u201c \u201estudents\u201c are asked to first analyze requirements. That means they need to build a solid understanding of the problem. And they need to express this understanding in an unambiguous form open to scrutiny.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Only once understanding is clear they move on to create a model for a solution to the problem. A model is the result of the design step. But of course a model is not \u201ethe real thing\u201c, it\u2019s not the solution yet. A model is a more or less abstract description of an approach to solve a problem. It\u2019s declarative, whereas the solution, the logic is imperative.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And finally they implement their model using the means of a programming language. Implementation is guided by the model and thus produces less waste. To me implementation mostly is boring and a comparatively mechanical task. Designing the model on the other hand is exciting and highly creative.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My feeling is, design (and also analysis) are underrated steps in software development. And coding is an overrated step.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Making the ADC loop explicit is thus what I find important. It\u2019s more important than doing TDD the Chicago style or London style. Hence I\u2019d call my approach to TDD eclectic. It\u2019s drawing from all styles if that\u2019s what\u2019s needed to further the cause of creating correct code plus clean code.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>However, there\u2019s one main distinction which leads to a different stance regarding mocks and other substitutes: I believe that functional dependencies are to be avoided as much as possible. They make code hard to read and hard to test. What my design and then coding are striving for is adherence to the <a href=\"https:\/\/blog.ralfw.de\/2013\/01\/beispielhafte-nichtbeachtung.html\" target=\"_blank\" rel=\"noopener\">IOSP (Integration Operation Segregation Principle)<\/a> which I derived a couple of years ago from Alan Kay\u2019s definition of object-orientation.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But enough with all the theory. What does \u201eHamburg style TDD\u201c look like when applied? Check out the following articles for demonstrations:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<ul>\n<li><a href=\"https:\/\/ralfw.de\/hamburg-style-tdd-diamond-kata\/\">Diamond kata<\/a><\/li>\n<li><a href=\"https:\/\/ralfw.de\/hamburg-style-tdd-bank-kata\/\">Bank kata<\/a><\/li>\n<\/ul>\n<p><!-- \/wp:paragraph --><\/p>","author":{"name":"Ralf Westphal"},"tags":["TDD"],"date_published":"2019-07-22T16:35:36+08:00","date_modified":"2021-01-28T19:42:05+08:00"},{"id":"https:\/\/ralfw.de\/command-query-notification-separation-cqns\/","url":"https:\/\/ralfw.de\/command-query-notification-separation-cqns\/","title":"Command Query Notification Separation (CQNS)","summary":"CQS (Command Query Separation) is a well known principle for disentangling method responsibilities in OO software. I had known it for quite some time, but only recently actually have taken it to heart. And now I\u2019m really loving it. I cannot imagine doing without it.","content_html":"<p><!-- wp:paragraph --><\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Command%E2%80%93query_separation\" target=\"_blank\" rel=\"noopener\">CQS (Command Query Separation)<\/a> is a well known principle for disentangling method responsibilities in OO software.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I had known it for quite some time, but only recently actually have taken it to heart. And now I\u2019m really loving it. I cannot imagine doing without it. It\u2019s a great guidance when designing single classes or whole service processes.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And then there is <a href=\"https:\/\/martinfowler.com\/bliki\/CQRS.html\" target=\"_blank\" rel=\"noopener\">CQRS<\/a> which builds on CQS. I like that, too. It\u2019s been a great inspiration.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But <a href=\"https:\/\/ralfw.de\/food-truck-architecture-its-all-about-events\/\">then I felt the need to move beyond it<\/a>: CQS does not cover the \u201emessage reality\u201c I\u2019m encountering. And CQRS does deliver the flexibility I expected from giving up \u201ethe single model\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Code structure guided by CQS<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To distinguish between Commands and Queries is a great guidance for structuring code. It\u2019s a form of outside-in design, I\u2019d say: You\u2019re looking at the interactions of users (or more generally: the environment) with a system by sending\/receiving messages and from that derive a certain structure.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2656, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2656\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-15.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-15-2xl.png 1600w\"  alt=\"\" width=\"528\" height=\"222\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:image {\"id\":2647, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2647\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-1-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-1-1-2xl.png 1600w\"  alt=\"\" width=\"526\" height=\"248\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Example: A player makes a move in a Tic Tac Toe game application.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Technically that means a user sends a message to the application with data about the move and receives back a message telling her the new game state.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Or more specifically this is a request for a certain behavior expressed in a response plus a change to some internal state.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2649, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2649\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-2-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-2-1-2xl.png 1600w\"  alt=\"\" width=\"531\" height=\"250\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The frontend first is used as an editor for the request message. A player certainly does not want to type in a JSON document but rather would like to just click on a cell on some visual game board.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And then the frontend is used as a projector for the response message. A player certainly does not want to interpret a JSON document but rather would like to see the game state rendered as a visual game board.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2648, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2648\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-3-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-3-1-2xl.png 1600w\"  alt=\"\" width=\"651\" height=\"179\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The domain or game logic itself is encapsulated in the backend with which the frontend is conversing only through messages. <a href=\"https:\/\/ralfw.de\/sleepy-hollow-architecture-no-application-should-be-without-it\/\">Frontend and backend don\u2019t should share state, in my view<\/a>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So far so normal. A request is transformed into a state change plus a response. All the necessary logic is a big lump.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>However, when applying the CQS to this, the request-response message flow can be dissected into a command followed by a query:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>First the command orders the backend to execute the move; the internal state of the backend is changed. This order of course is only carried out if the move is valid and the state\u2019s consistency is not compromised.<\/li>\n<li>Then the query asks the backend for a description of its internal state.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:image {\"id\":2651, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2651\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-4-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-4-1-2xl.png 1600w\"  alt=\"\" width=\"652\" height=\"273\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What has been a single lump of logic now is two smaller lumps of logic. How cool is that? And all this without much creativity. The user\u2019s requirement guided the design. Software development just needs to listen.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The tangible outcomes of a CQS-guided analysis are:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>A command message (data structure)<\/li>\n<li>A query result message (data structure)<\/li>\n<li>A query message (data structure; maybe only for internal use)<\/li>\n<li>A command status message (data structure; maybe only for internal use)<\/li>\n<li>A command handler (function)<\/li>\n<li>A query handler (function)<\/li>\n<li>A request handler (function; optional for hiding the command and query handler from the frontend for less traffic between frontend and backend)<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I like this almost mechanically generated basic structure for my source code. It makes me focus more on the conversation with the user\/customer because it\u2019s from there I gain valuable first insights about the software design.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Message structure freed up by Event-Orientation<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>This is, what CQS does already. It\u2019s a great help, but still leaves something to be desired.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What I found quite difficult for a long time was \u201emessage design\u201c. How should messages look like, what structure should they have? How should this structure look like compared to the internal domain model?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>CQS does not have an answer to that. CQRS on the other hand suggested to take it easier: there could be two models, one for commands and another one for queries.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But still I felt compelled to find the one model for handling commands, and the other one model for satisfying queries.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>It took me a while to let go of that restriction.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Today, with <a href=\"https:\/\/ralfw.de\/food-truck-architecture-its-all-about-events\/\">Event-Orientation (EO)<\/a> I don\u2019t feel any restriction anymore. And I don\u2019t feel I need to get \u201eit\u201c right anymore \u201eonce and for all\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The internal state of an application is not kept in a single (or two or three) data models anymore. I allow myself to program \u201emodel free\u201c or \u201eschemaless\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>The model is dead! Long live the model multitude!<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Each and every message is handled individually and is supported by the best model I can think of for that single purpose. With EO I feel free to let message structures be preliminary. They can be honed for consumption by the frontend; the backend then is a true service by catering to the needs of its client. Or message structures can be more palatable for the backend; the frontend then is more of a \u201eslave\u201c to the provider of the core application behavior, the backend.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I remember how discussions about message structure took up quite some time during modelling sessions. Not anymore. Because there is no question anymore about how much a message model might couple frontend and backend.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>There simply is no domain model anymore in the backend. There cannot be any coupling. Whatever a message carries is a projection or something that needs projection. It\u2019s not some form of copy or part of a domain model.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Message structures are freed up by EO to look how they want. The internal state of an EO-based backend is something completely different: a stream of events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2652, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2652\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-5-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-5-1-2xl.png 1600w\"  alt=\"\" width=\"441\" height=\"463\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To change the state through a command it has to be translated into a collection of events.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And to query the state the events in the stream have to be aggregated and projected into a result.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The proposition of EO is that such translations and aggregations\/projections are all separate. By default they don\u2019t share anything. No coupling, no dependency between them - except for the one event stream.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2655, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2655\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-6-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-6-1-2xl.png 1600w\"  alt=\"\" width=\"597\" height=\"403\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That makes message processing in both directions cheap. And it allows for independent development. EO slices an application not only into services but into message processing pipelines each catering to just a single message.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Deciding today that the TicTacToe game state query result should look like this, and tomorrow changing the decision to let it look like that is comparatively easy. It has no impact on some comprehensive domain model relevant to many messages.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The contract between message pipelines are just event data types. They are the core representation of the domain. <strong>Look at the events and you know what the domain is about. Events are telling a story about what is happening, what is deemed important, what the causal sequences are.<\/strong><\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>And this <a href=\"https:\/\/ralfw.de\/event-sourcing-for-constructivist-software\/\">can be interpreted in a million ways<\/a>, or at least as many ways as there are incoming message types to handle.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Notifications as ambient messages<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>CQS primarily distinguishes two kinds of messages: commands and queries.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>That\u2019s incoming messages. How about outgoing ones? I\u2019d like to make explicit also two respective outgoing messages: command status and query result. Command status messages might be quite simple and generic (success vs failure), but query results surely are of very different form and need careful design.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>However, in my experience there is a fifth message type. It\u2019s particular because it\u2019s not a request. Commands and queries stand for bidirectional message flow: a client sends a request (command or query) and expects a response (command status or query result).<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sometimes, though, messages are not produced with a certain expectation for a behavior of another (part of) a system. Sometimes messages are just \u201eutterances\u201c of a system broadcast \u201eto whom it may concern\u201c.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I call such messages <em>notifications<\/em>.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Usually the name for them is \u201eevent\u201c with a prefix or suffix (like \u201edomain event\u201c). But that clashes with the data stored in an event stream inside of a system. I don\u2019t like such homonymes.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>\u201eNotification\u201c is a term everyone is familiar with: we are notified about emails arriving in our inboxes or new messages in a Slack channel or of an overdue backup etc.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>A lot of applications are broadcasting notifications to inform us about something that has happened\/changed. And we are free to subscribe to such notifications. Some we are interested in, some not.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>If we receive a notification we might react, eg. open the mail client to check our inbox. But the broadcasting application did not request such a reaction.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Notifications are one way messages. Software broadcasts them through some channel\/medium as outgoing notifications. And other software might subscribe to a channel\/medium to receive notifications from other software as incoming messages.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2653, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2653\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-7-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-7-1-2xl.png 1600w\"  alt=\"\" width=\"498\" height=\"263\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I call notifications <em>ambient messages<\/em> because they \u201efloat around in the environment\u201c and are not directed. They have a source, but no destination.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>From that follows there is no guarantee that a notification will be handled at all. Notifications thus cannot carry requests. Their purpose solely is to inform about something that happened. They make a statement about the originating system - for others to possibly care for.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Notifications might be more relevant in distributed systems. Nevertheless I think they are a very general concept and thus should be included in the CQS principle. Hence I propose to expand it to:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:quote --><\/p>\n<blockquote class=\"wp-block-quote\">\n<p>CQNS: Command Query Notification Separation principle<\/p>\n<\/blockquote>\n<p><!-- \/wp:quote --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The form of notifications is considerably different (being one-way messages). And their processing is different, too, I think.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li>Notifications do not query state, because there would be no receiver for a query result.<\/li>\n<li>Notifications do not change state; that\u2019s what commands are for.<\/li>\n<li><strong>The single responsibility of incoming notifications is to cause commands to be executed inside a receiver.<\/strong> However the command status messages generated by the triggered commands are not delivered to the originator of the notification.<\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So much for incoming notifications.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But where do outgoing notifications come from?<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li><strong>Outgoing notifications are generated during command processing.<\/strong> Only commands change state, and notifications are signalling state change.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Notifications help to further structure code from the outside-in:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Handling incoming notifications requires logic to translate them into commands.<\/li>\n<li>Command processing consists not only of\n<ol>\n<li>model generation,<\/li>\n<li>command validation,<\/li>\n<li>event generation,<\/li>\n<li>but also of generating outgoing notifications.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>That, to me, makes requirements analysis yet easier and delivers more input for further software design.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>In a gaming scenario there could be two services: one for playing a game like TicTacToe and one for keeping a score board.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Both services could be connected in a request\/response manner, for example, for registering the score of a finished game: the TicTacToe service could send a command to the score board service to inform it of another finished game and who has won. But why couple the services so tightly? The TicTacToe service would now depend on another service, it could not do its job without the other.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Instead a notification can be used to more loosely couple both service. With a notification they would not even know of each other.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>The TicTacToe service would broadcast a notification when a game finishes, e.g. by writing it to a queue hosted by some infrastructure.<\/li>\n<li>The score board service would subscribe to \u201egame over\u201c notifications arriving in a queue hosted by some infrastructure.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>One service\u2019s outgoing notification is another service\u2019s incoming notification.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2657, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2657\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-8-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-8-1-2xl.png 1600w\"  alt=\"\" width=\"618\" height=\"390\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Anatomy of a backend<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To me the beauty of CQNS + EO is a very straightforward and generic basic software structure. And in that it\u2019s easy to independently focus on (comparatively) small functional units.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Message-oriented requirements analysis<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Designing software is helped by applying this pattern. But also analysis is helped because it\u2019s guided by the message hierarchy:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>Messages\n<ul>\n<li>Incoming\/outgoing\n<ul>\n<li>Request (outgoing) -&gt; Response (incoming)\n<ul>\n<li>Command -&gt; Command Status<\/li>\n<li>Query -&gt; Query Result<\/li>\n<\/ul>\n<\/li>\n<li>Notification\n<ul>\n<li>Incoming: Notification -&gt; Commands<\/li>\n<li>Outgoing<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Event (internal)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>My approach to software development is outside-in: I start at the surface of a software system and ask \u201eHow do users want to interact with the system?\u201c Requests with their responses are the primary answer to that.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Next I ask to what the software system should react in addition. Incoming notifications are the answer to that.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Then from command requests I derive the internal events to be stored in the event stream.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Next I try to balance the events found with what query requests might deem helpful to get from the event stream.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>(If you\u2019re a fan of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Event_storming\" target=\"_blank\" rel=\"noopener\">Event Storming<\/a> you might prefer to start with events and work your way \u201eup\u201c to incoming\/outgoing messages. That\u2019s fine for me, too. That\u2019s serving the same goal. If you find it easier that way around, why not?)<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Finally I\u2019m concerned with outgoing notifications generated by command request processing.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>What I\u2019m not really interested in anymore, though, is \u201ethe one\u201c internal domain data structure. I\u2019m not trying to figure out how the domain can be represented in a comprehensive data model.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>For a long, long that had been my primary concern. I was fixated on \u201ethe one\u201c domain data model. I wanted to represented \u201ethe world\u201c in software.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>But those days are gone now!<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:heading {\"level\":3} --><\/p>\n<h3>Coloring the design blueprint mandala<\/h3>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Once I\u2019ve gotten the messages down I can work on them one by one. It\u2019s like eating a pizza slice by slice.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2646, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2646\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-9-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-9-1-2xl.png 1600w\"  alt=\"\" width=\"577\" height=\"414\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Each slice being a message handling pipeline. And the pizza crust being a tranceiver which receives incoming messages from the environment and sends\/broadcasts outgoing messages to the environment.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>The structure of all the pipeline slices is the same; each consists of three segments (and is attached to the event store at the center):<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2654, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2654\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-10-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-10-1-2xl.png 1600w\"  alt=\"\" width=\"477\" height=\"292\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>So for each message I can design the following step by step:<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":true} --><\/p>\n<ol>\n<li>Define the message context, i.e. all the relevant events<\/li>\n<li>Design the message context model<\/li>\n<li>Design how the message context model should be loaded and queried before message processing<\/li>\n<li>Design how the message should be processed in light of the message context model\n<ul>\n<li>Command\n<ul>\n<li>Design how to generate events from the message in light of the message context model<\/li>\n<li>Design how to generate outgoing notifications from the message<\/li>\n<\/ul>\n<\/li>\n<li>Query\n<ul>\n<li>Design how to generate the query result from the message context model in light of the message<\/li>\n<\/ul>\n<\/li>\n<li>Notification\n<ul>\n<li>Design how to generate commands from the message in light of the message context model<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Design how the message context model should be updated<\/li>\n<\/ol>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>To me that feels very guided, almost like a meditative activity (if not a boring one). It\u2019s like coloring a mandala area by area\u2026<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:image {\"id\":2650, \"align\": \"center\"} --><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><figure class=\"wp-image-2650\"><img loading=\"lazy\"  src=\"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-11-1.png\" sizes=\"(max-width: 48em) 100vw, 768px\" srcset=\"https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-xs.png 300w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-sm.png 480w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-md.png 768w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-lg.png 1024w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-xl.png 1360w ,https:\/\/ralfw.de\/media\/posts\/131\/responsive\/DraggedImage-11-1-2xl.png 1600w\"  alt=\"\" width=\"545\" height=\"768\"><\/figure><\/figure>\n<\/div>\n<p><!-- \/wp:image --><\/p>\n<p><!-- wp:heading {\"level\":2} --><\/p>\n<h2>Summary<\/h2>\n<p><!-- \/wp:heading --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Refining the CQS to CQNS and being grounded in Event-Orientation really helps me progressing through software development in a very straightforward manner.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Sure, there are still challenges to master. Sure, especially processing messages still can be tough.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>With CQNS + EO, however, I\u2019m relieved of a lot of confusing stuff around that. I find it much, much easier to focus on the important things.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:list {\"ordered\":false} --><\/p>\n<ul>\n<li>I\u2019m not wasting energy on asking myself \u201eHow to start development?\u201c<\/li>\n<li>I\u2019m not wasting energy on \u201egetting the one model right\u201c.<\/li>\n<li>I\u2019m not wasting energy on designing structures which should not differ from software to software anyway.<\/li>\n<\/ul>\n<p><!-- \/wp:list --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>Yes, I believe there is a basic anatomy to all software. Like there is a basic anatomy to all animals. And that basic anatomy is more fine grained than the usual architectural pattern suggest. And it still leaves room and freedom for all the incredibly complicated stuff you have to implement, don\u2019t worry.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n<p><!-- wp:paragraph --><\/p>\n<p>I\u2019d even say: By giving software a basic anatomy we\u2019re set free to focus on the really important things much more. CQNS and EO, to me, are part of that anatomical blueprint.<\/p>\n<p><!-- \/wp:paragraph --><\/p>","image":"https:\/\/ralfw.de\/media\/posts\/131\/DraggedImage-11-1.png","author":{"name":"Ralf Westphal"},"tags":["Event-Orientation"],"date_published":"2019-07-16T22:31:33+08:00","date_modified":"2021-01-28T19:44:16+08:00"}]}