Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah "simple" is one of the most abused words. Everyone agrees simple = good when it comes to programming, but what does it actually mean? Often is means "easy to understand", but what is easy to understand depend on prior knowledge.

For example plus(a, b) is simpler in the sense it doesn't special-case arithmetic and reqiore fewer language primitives, but a + b would seem simpler to most students.



The best definition of simple I've found is "one that takes the least cognitive load to use/comprehend."

With programming it's actually hugely complicated, because are you trying to lower the mental effort to read, or the mental effort to write?

a + b is simple to write because it reminds you of high school mathematics.

However, I'd argue

  from operator import add, mul
      def square(x):
          return mul(x, x)
 
      def sum_squares(x, y):
          return add(square(x), square(y))
 
      result = sum_squares(5, 12)
Is an excellent way for newer programmers to read code, and learn what is happening.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: