There's a great section in The Practice of Programming where the book describes how you should structure your code to not just be structured nicely now, but to plan for the future; to structure it so that changes are easy, organized, and don't break anything. It's not exhaustive but it's a powerful general idea and I always like introducing developers to it for the first time.
Code doesn’t have to be a mess
11–20 of 190 posts
Re: Code doesn’t have to be a mess
#12There's a great section in The Practice of Programming where the book describes how you should structure your code to not just be structured nicely now, but to plan for the future; to structure it so that changes are easy, organized, and don't break anything. It's not exhaustive but it's a powerful general idea and I always like introducing developers to it for the first time.
Re: Code doesn’t have to be a mess
#13Would be curious to know what strategies other people apply in order to keep complexity down over time!
Trust your tooling, and your repository. It's safe to delete if you still have a record of the way the code was before. Too often I see code that doesn't need to exist because someone is afraid to remove it. Modern IDEs are excellent at showing dependent code, and GIT and other source control tools are excellent at giving you freedom to remove things. Oh, and have good testing in place to make sure you aren't breakin…
Re: Code doesn’t have to be a mess
#14Would be curious to know what strategies other people apply in order to keep complexity down over time!
What's a good name? I love the phrasing from _Elements of Clojure_ by Zachary Tellman [1]
> Names should be narrow and consistent. A *narrow* name clearly excludes things it cannot represent. A *consistent* name is easily understood by someone familiar with the surrounding code, the problem domain, and the broader [language] ecosystem.
Re: Code doesn’t have to be a mess
#15Earlier quoted context omitted.
Unit Tests. If you can't write a unit test for it, it's too complicated and it's going to snowball quickly into a giant mess.
I love unit tests, but admit I have absolutely seen unnecessary complexity including complete classes and namespaces solely to enable testability in many cases. It's a justifiable trade off for me, but I don't pretend that unit testing reduces complexity.
Re: Code doesn’t have to be a mess
#16Would be curious to know what strategies other people apply in order to keep complexity down over time!
Re: Code doesn’t have to be a mess
#17Ah the Unix philosophy. `man ssh' gives `ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-J destination] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] destina…
`man ssh` gives me detailed descriptions of all flags.
Re: Code doesn’t have to be a mess
#18We should stop seeing microservices as a technical problem / solution they are how to divide a "business domain" up into account the smallest constituent parts according to vat business view in the domain
Re: Code doesn’t have to be a mess
#19Would be curious to know what strategies other people apply in order to keep complexity down over time!
I'm a big fan of the "IO Sandwich". This is where you keep complex computation as pure functions as much as possible. And push the IO to the edges of the system. So you might have read-compute-write. This keeps the computation functions testable and composable.
Re: Code doesn’t have to be a mess
#20Would be curious to know what strategies other people apply in order to keep complexity down over time!
Unit Tests. If you can't write a unit test for it, it's too complicated and it's going to snowball quickly into a giant mess.