by msluyter · 5y ago · 0 comments
This reminds me of the famous Rob Pike quote:
"Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming."
I've often found that if I'm coding something and the code starts looking increasingly gnarly, that rethinking the data structures / data model will clean up the code.
I can see not electing to have databases as a course for masters though. Masters is to allow you to specialize and be more choice driven.
I'm saving this quote.
> I've often found that if I'm coding something and the code starts looking increasingly gnarly that rethinking the data structures / data model will clean up the code.
I've faced this over and over again. Writing algorithms is hard when the underlying data is not optimal. It simply invites writing complicated code and workarounds.
This is actually one of the reasons I am moving more and more to functional programming for myself. I find that modeling the data as just data makes it easier to find a good representation. And that it usually results in simpler algorithms.
Can we unify this to simply "data structures are essential to algorithms". It's really weird to put these in opposition, when algorithm with no data and data without algorithm make no sense.
Data structures are encoded with use cases in mind, those use cases at least at the very low level are their algorithms.
Put differently:
> Data structures are encoded with use cases in mind, those use cases at least at the very low level are their algorithms.
As you've lampshaded, it's the use cases that are most fundamental. The data model should be designed to serve those use cases. The data structures and algorithms reflect the physical reality of the logical data model.
The strength of the relational model is it is separated from any specific algorithm.
So if we see data and algorithms disconnected, we're just thinking about different architectural layers.