Hacker News new | past | comments | ask | show | jobs | submit login

Higher level languages / code and abstractions.



This is correct, but this stuff is particularly hard. I would even say it's the hardest part of our profession. Some people try to invent reusable abstractions, small (map, fold, zip) and big (AbstractFactory, Command, Composite), but to attack this problem really efficiently you need to be able to come up with your own ones, preferably those that are less leaky and have limited and well-defined surface area.

I remember doing one of the Project Euler's problems, something in the vein of "you are given a 20x20 matrix, find an element for which the sum of the elements around it is maximum". Nothing complicated, right? You just iterate over rows, then over columns, then throw in a check for zero index and the max boundary index, then do this for both x and y, etc. When I was done with the problem (nested for loops, five if checks inside), I found someone else's solution in Haskell on Project Euler's forums. A point-free one-liner with bunch of smart folds.

That's the power of abstraction.




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

Search: