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

It strikes me that some people think in data, others in processes.

Personally, I need transparency and understand everything step by step. But there are those that threat a function/process like a blackbox and just build pipes based on some defined axiomes. The latter also seems to do quite well in math.



I like OOP precisely because you can just treat any object like a black box. You don't need to fully understand what the object does at all times.

The way my brain works is by turning all problems into spatial problems. Programs take the form of a large graph with a function or other operation at each node. Generally, I'm modeling data flow through the graph. I can keep a fair amount of detail associated with any node, but it takes effort. There's a lot of information floating around.

OOP just kind of naturally falls out of this kind of thinking. By collecting parts of the program into discrete objects that do their own thing, large parts of the graph can be collapsed into a single node. Data flows into an object, data flows out. No need to spend the mental effort of knowing what happens inside the box. I can just simply trust that I wrote an object to do what it says it does.

Of course this approach often fails and I have to be much more thorough. If I can focus on a small section of the program, the graph becomes almost an arbitrary syntax tree. The past couple of weeks I've been way in the weeds with a microcontroller. At some point I've started modeling parts of the program in terms of assembly instructions and CPU implementation details.




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

Search: