Live data from Hacker News

Ask HN: What is the most enlightening concept that changed how you program?

news.ycombinator.com

11–20 of 33 posts

Re: Ask HN: What is the most enlightening concept that changed how you program?

#12
Compression-oriented programming [1]. It is not something that "totally changed the way I approach programming", but more like something I was doing intuitively and reading about it made a lot of sense and provided a framework for why it is appealing. Also, keep in mind that I am not a real programmer in a sense that I mostly write scripts for data analysis.

The gist of it: you program procedurally without thinking too much about the code and only add "compressions" when the need for them arises. The compressions can take various forms like encapsulating data types within objects, behaviour within functions, extracting often-repeated operations into separate libraries and then loading and referencing them when needed, etc.

[1]: https://caseymuratori.com/blog_0015

Re: Ask HN: What is the most enlightening concept that changed how you program?

#13
post #9

YAGNI and WET - You Ain't Gonna Need It and Write Everything Twice - Copied code leads to simple bugs; premature abstraction leads to heartbreak.

> premature abstraction leads to heartbreak Could you please elaborate on that? I'm not sure to understand.

The devastation of realizing that the days you spent working out the perfect class hierarchy or other complex design to handle every case was a complete waste of time and what you made is an over complicated mess that no one else can understand or use, and you could have just copied a method from one place to another and added a couple of ifs or arguments

Re: Ask HN: What is the most enlightening concept that changed how you program?

#14
Defining data structures first and then the rest of the program as operations between those data structures. If possible using types, and keeping as much as possible pure (no side-effects). Makes it easier to reason about, and to check for correctness.

Re: Ask HN: What is the most enlightening concept that changed how you program?

#17
post #9

YAGNI and WET - You Ain't Gonna Need It and Write Everything Twice - Copied code leads to simple bugs; premature abstraction leads to heartbreak.

> premature abstraction leads to heartbreak Could you please elaborate on that? I'm not sure to understand.

Buisness world startup equivalent would be know your market audience.

Start out to broad and wind up wasting resources that could be put to better use.

Start out to narrow focus without knowing where need/$$ to keep going is and wind up wasting resources. Idealy, the narrower focus permits getting to the 'wasting resources' point faster.

Hiding the details via abstraction when details are still in development/need to be viewable & readily available defeats the purpose of abstraction making things simpiler/easier.

Re: Ask HN: What is the most enlightening concept that changed how you program?

#18

the most mind blowing concept was realizing everything I have learned during my 10+ years of coding will be rendered obsolete by an AI in next 2 years :)

yes, but it'll still take until tomorrow to realize what was needed the day before.

Re: Ask HN: What is the most enlightening concept that changed how you program?

#19
Kevlin Henney - "when you introduce concurrency into a non-concurrent environment what you do is you change the laws of physics of your program, you change the nature of time"[1]

This is a profound insight. It totally changed how I think about the nature of multithreaded and multiprocessor based programming.

Also from Kevlin - Refactoring to immutability[2], which showed me exactly why you would want immutable "variables"

[1] https://www.youtube.com/watch?v=Hi6ICEVVRiw

[2] https://www.youtube.com/watch?v=APUCMSPiNh4

Re: Ask HN: What is the most enlightening concept that changed how you program?

#20
Minimising complexity by reducing the number of paths (branches, nested loops etc.) through your code.

Thinking of the stupidest way we can get it done and then ruthlessly refactoring until the resulting algorithm / system is as simple as possible.

Edit: point 1 comes from A Philosophy of Software Design. One of my fave programming books of all time.

Post reply on HN