-
Website
http://avdi.org/devblog -
Original page
http://avdi.org/devblog/2009/10/29/simplicity-is-complicated/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
bryanl
5 comments · 3 points
-
David Recordon
1 comment · 4 points
-
gambling
3 comments · 2 points
-
'n ddrylliog
4 comments · 1 points
-
joegrossberg
2 comments · 2 points
-
-
Popular Threads
-
RightAWS and SSL Certificates
3 weeks ago · 3 comments
-
Debugging Rule 1: It’s your fault
2 weeks ago · 1 comment
-
RightAWS and SSL Certificates
Granted, that's defined in ActiveSupport, but it's probably something that's used common enough.
times.sum { |t| t.to_time }
A question for you: what does your choice to use ActiveSupport say about where you prefer the complexity to be?
accidental complexity is introduced when the programmer made a design error, or implemented, or decided to use the wrong framework to solve the problem at hand. square peg in a round hole so to speak.
Thanks for the comment!
Second, I see the issue more as one of readability, and simplicity is part of this, because human beings can only hold so many things in their mind at once. Your first example may be easy for a Java programmer to grasp, but may actually be harder for a Ruby programmer to grasp, and vice versa for the second example. This is because each language has its own idioms, and moving outside of those idioms (while not to be totally avoided) should be done with caution.
I have a problem with people writing "Java code" with Ruby, and writing "Ruby code" with Java. That is what creates readability problems, and perhaps complicates someone's attempt to understand the code.
More here:
http://paul.stadig.name/2009/10/simplicity-and-...
I have pretty strong opinions about the the virtues of different styles of coding - I tend to agree with you, for instance, about staying within the idioms of the language. I tried to keep my opinions out of this article, however. The intent was to provoke reflection on what our definition of simplicity is says about our preferences regarding where the complexity belongs.
I'll definitely check out your article!
You can get a handle on "complex" by counting the number of moving parts: variables, operators (including "."), etc. You can have very simple code that is cryptic or simple code that is clear.
Clarity is about communicative power, and that depends on shared experience with the target audience. This is a tough goal, but you can find some further commentary here: http://agileotter.blogspot.com/2009/03/simple-a...
Another problem with "clear" is that it depends on how much the context can be taken for granted. If the complexity is hidden away, but you must interact with it "just so" then you have smaller code (simple=less complex) but it has a great "implicity" (having prerequisites to understanding). There are a great many ways to be unclear. I think that is a separate concern from "simple".
The other thing about "simple" is that others confuse it with "easy to write". As you mention, sometimes the easiest change to write is not simple at all, but introduces complexity in moving parts and unclarity by having more modes of failure and modes of misunderstanding.
Here is a conversation from a while back:
http://blog.objectmentor.com/articles/2007/06/1...
I think that we need simple (fewest moving parts) and clarity (fewest modes of misinterpretation) but I don't have a good way to measure the latter.
I love the word "implicity", I'm going to use that in future.
Thanks for the links, I'll check them out!
I love this line.
One of my previous employers was distrustful of 'programmers' due to previous experience. When we would be defining a program and its scope 'simple' is the term that would be used frequently in keeping the scope of the custom software limited. This seems perfectly reasonable until you realize that by keeping the program simple we were shifting complexity to the user.
Instead of a task based UI that was cognizant of the business rules, we would have a data based system were those business rules must be known by all users (and consequently fixed by the Help Desk when they made a mistake). But the software *was* simple.
My personal goal was to build software that was easy to use even if it was complex.
It is like the Zen of Python:
Simple is better than Complex.
Complex is better than Complicated.
A pick-list of states is certainly "simpler" from the programming side but it imposes an additional cognitive burden of complexity on the user side.
Whether the 2nd example is more readable is subjective. I definitely agree with the comments about having fewer moving parts, and few points of misinterpretation.
If you're doing proper TDD/BDD you should only have the minimum amount of code required to pass each test anyway. Coding standards are a great way of getting your team on an even grounding. Using .Net we can enforce it with StyleCop and have intellisense suggestions in Visual Studio as you type. Pairing is another good way of making sure you and others will understand the code.
When there are fundamental principles being used to express something concisely then things are simple. Having to learn about those principles is necessary though, but many confuse having to learn those concepts with complexity in the solution that uses them.
Thanks for the comment!
When there are fundamental principles being used to express something concisely then things are simple. Having to learn about those principles is necessary though, but many confuse having to learn those concepts with complexity in the solution that uses them.
Make things Complicated is Simplistic, make things Simple is Complex ;)
Complex = Reduce to the most simple things as possible but not less (paraphrasing $Einstein: make things simple but not simpler).
Complicated = SmokeScreen which hides the Simplicity.
While these words express only relative concepts (something cannot be simple or easy on its own, but in comparison to something else), most people hear them as absolute and interpret them to mean that the work will be done quickly or cheaply.
Words like "straight-forward" more accurately express the intent almost every time.
Making your code straight-forward is a matter of making it understandable and malleable by the expected audience. You have to expect the others to have a certain skill level and write to that level, even if it is "simpler" than your own. That's how teams work.