3 ms·
Beautiful code looks like a directed, acyclic graph -- a tree with small nodes (high cohesion) and minimal dependencies (low coupling). Narrow interfaces are th
by wellpast 12y ago
Beautiful code looks like a directed, acyclic graph -- a tree with small nodes (high cohesion) and minimal dependencies (low coupling). Narrow interfaces are the last piece, but I'm not sure how you visualize that -- perhaps with the width of the edges; the narrower, the more beautiful.
Of course, "beauty" is a hard sell. What you really get with maintaining code with these "beautiful" qualities is massive productivity and choice.
- jowiar 12y agoDrawn as a graph, it ends up minimizing: - Node size (think small functions and objects, not big ones) - Degree (minimize dependencies. Also, an O(m+n) many-to-few-to-many is probably easier to reason about than an O(mn) many-to-many), - Overall number of nodes (DRY, also, less code is generally better than more code). Of course, the prioritization between these three is up in the air.