Live data from Hacker News

The Ball-of-Mud Transition, or how software gets complex

akvo.org

21–30 of 35 posts

Re: The Ball-of-Mud Transition, or how software gets complex

#21
I do my best to keep in check high level stuff, like asking developers to try to delete a library if they add one, to try to "buy-back" their added lines of code in their changesets (ie. try to refactor to delete as much as they added), to get the cardboards down to the trash etc.

I think I have knack for seeing and caring about that. I see complexity arising (even if I can't always prevent it, I mean we have to ship too).

Re: The Ball-of-Mud Transition, or how software gets complex

#22
This is a neat thought experiment, but it seems to me it's looking at a different part of the curve than software complexity. The "phase transition" the author discusses occurs between 0 and 1 threads/button. In a software project, you wouldn't bring in a new component unless it served some use to the existing pieces, so software projects start at 1 "thread/button," and unless you've got orphaned code, the "cluster size" is always 100%.

Software complexity strikes me as a graph-coverage problem: given a graph of N vertices and M paths (i.e. software components and dependencies), how many vertices and paths do we need to traverse (i.e. understand) in order to make a change to component X? How does that parameter scale with different forms of graph -- linear, n-ary tree, DAG, cyclic (yikes!)?

Or is there a homomorphism between the two problems?

Re: The Ball-of-Mud Transition, or how software gets complex

#23
post #12

What he studied experimentally with the buttons and threads is know in graph theory as the "Giant component" threshold and is exactly known. https://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_...

That's true, but I'm unaware of much work being done on the error bounds for small N (for some concept of small). I started on this during my PhD, but rapidly moved onto other problems that seemed more tractable, and never really returned to it. The results of Bollobás, Erdős, Rényi, and others, are mostly asymptotic. They do, however, seem remarkably good even on graphs of small size (under 10^6 vertices).

Those names make me wonder if mathematicians are arranged in series - Erdos, Erdós, Erdős, ...

Re: The Ball-of-Mud Transition, or how software gets complex

#24
The following is a tangent.

When designing something, there are often many choices. If they interact, it quickly becomes intractable. It's tempting to try to keep them in mind, and work out the answer, but with exponentially increasing complexity, your limits are quickly reached (no matter how smart you are). Enhancing your intelligence, e.g. by offloading information onto paper, also has limits.

One solution is the scientific experiment: hold all variables constant, and see the effect of changing just one design choice. Holding them constant means you have made a design choice for that aspect that is almost certainly not optimal.

Ideally, you can do what is suggested in the article - create modules that are largely independent, and experiment within one module in isolation. Because there are fewer variables per module, they are less complex, and it takes fewer experiments to understand how each works.

The deep problem with this is if you don't know what those modules would be - i.e. you don't know which aspects are independent because that's the very thing you're trying to find out! Of course, you can probably have a guess, and certainly use your initial experiments to check those guesses, and maybe with the information gained, improve your guesses.

EDIT a specification is a module, in that it separates out some design choices.

Re: The Ball-of-Mud Transition, or how software gets complex

#25
The author is measuring largest cluster-size vs threads/button.

In any software, everything is going to be connected, otherwise there's unreachable code. So the largest cluster is always 100%, so I don't get why his argument about the sudden phase transition is relevant to software?

Re: The Ball-of-Mud Transition, or how software gets complex

#26
post #25

The author is measuring largest cluster-size vs threads/button. In any software, everything is going to be connected, otherwise there's unreachable code. So the largest cluster is always 100%, so I don't get why his argument about the sudden phase transition is relevant to software?

I think the answer to your question is in the missing directions on the threads. The goal of modular software is to have the arrowheads point in the right directions.

Uncle Bob was talking about this in his keynote about how Rails is not your application.

http://confreaks.com/videos/759-rubymidwest2011-keynote-arch...

http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-arch...

https://vimeo.com/21145583

Re: The Ball-of-Mud Transition, or how software gets complex

#27

Picking up on adrianN's comment[0], when you have a collection of nodes and start connecting them at random, initially they are all disconnected (obviously) and any two that you pick are likely not to have any edges. This in the early stages, your graph is isolated nodes and isolated edges. After a while, by chance, you happen to join an existing edge to a node. That component now has three vertices, and is 50% more…

This is very close to the "percolation problem." [0]

According to Robert Sedgewick, this particular problem has no known mathematical solution, and the threshold (for a given N) is only obtained through, e.g. a Monte Carlo simulations where you randomly open sites until the grid percolates (akin to the adding of threads). The whole thing is a good application of the union find algorithm.

The threshhold for N > 2 is about 60%. Not sure how that applies to software complexity, but it's interesting to think about.

Thanks, Coursera!

[0] http://en.wikipedia.org/wiki/Percolation_threshold

Re: The Ball-of-Mud Transition, or how software gets complex

#28

Picking up on adrianN's comment[0], when you have a collection of nodes and start connecting them at random, initially they are all disconnected (obviously) and any two that you pick are likely not to have any edges. This in the early stages, your graph is isolated nodes and isolated edges. After a while, by chance, you happen to join an existing edge to a node. That component now has three vertices, and is 50% more…

Transitive closure and connected components are not expressible in first-order logic, but maybe you are thinking of Fagin's 0-1 law for finite relational models[1]:

For a given first-order sentence s, as n -> infinity, the fraction of models of cardinality n that satisfy s approaches either 0 or 1.

[1] http://researcher.watson.ibm.com/researcher/files/us-fagin/t...

Re: The Ball-of-Mud Transition, or how software gets complex

#29
post #14

What he doesn't emphasize is the directionality of this phase transition. It's really easy to add one more string, but staring at the resulting button-thread agglomeration it's very difficult to know what string to cut. This is why there is a never ending stream of new projects started to solve the same problems over and over. Their authors covet the opportunity to make progress during the honeymoon period, before th…

I agree completely - once you're on the wrong side of the transition, it is hard to go back

More importantly, it's not worth going back. At a certain point, it becomes actually less work to start over than to try to cut that Gordian Knot.

The problem then is when business logic is encapsulated in the mud.

Re: The Ball-of-Mud Transition, or how software gets complex

#30
post #25

The author is measuring largest cluster-size vs threads/button. In any software, everything is going to be connected, otherwise there's unreachable code. So the largest cluster is always 100%, so I don't get why his argument about the sudden phase transition is relevant to software?

I think the answer to your question is in the missing directions on the threads. The goal of modular software is to have the arrowheads point in the right directions. Uncle Bob was talking about this in his keynote about how Rails is not your application. http://confreaks.com/videos/759-rubymidwest2011-keynote-arch... http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-arch... https://vimeo.com/21145583

I was wondering about this too. I don't quite get how this random assignment of connections between components correlated to software complexity. Software isn't randomly connected (I know, sometimes you see stuff which flies in the face of this statement). And the directions of the connections are very important. You can create something that has a single component at the top connected to 100 other components. threads/buttons = 100/101 and the biggest cluster = 100%. I'd wager it would probably be a simple program to reason about. I guess I'm confused about the leap from cluster size to complexity to reason about.
Post reply on HN