Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How To Write Unmaintainable Code

How To Write Unmaintainable Code

How do I write code that is as "good" as possible? What does that even mean? I have been working on large open source frameworks for around 20 years. In that time, I have produced a lot of code that I would never write in the same way today - and from which we can learn a lot together. I will critically discuss principles such as extensibility and DRY, show what mistakes I have made when developing frameworks and show which principles we can use to write "better" code (whatever this means) :-)

The whole thing will be an entertaining journey into large codebases which might change the way you look at code.

Sebastian Kurfürst

May 31, 2024
Tweet

More Decks by Sebastian Kurfürst

Other Decks in Technology

Transcript

  1. Bene fi ts we prevented lots of security issues (SQL

    Injection, CSRF, ...) Drawbacks "Magic" - di ff i cult to follow extensible, but not extensible
  2. Less Lines of Code explicit Code Self-Documenting Code Documented Code

    Work with Objects Immutable & Functional Patterns
  3. calculateLabel(Node) Node Pure Functions no side e ff ects deterministic

    (same input => same output) result a() b() c() d()
  4. Complexity = all parts making it di ffi cult to

    understand software or to change it. Root Causes of Complexity = Dependencies + Obscurity
  5. Dokumentation "Why" DESIGN COMMENTS ... The design comment basically states

    how and why a given piece of code uses certain algorithms, techniques, tricks, and implementation. It is an higher level overview of what you'll see implemented in the code. With such background, reading the code will be simpler. Moreover I tend to trust more code where I can find design notes. At least I know that some kind of explicit design phase happened, at some point, during the development process.