Rule 6: Every well-intentioned rule will be bastardized and used to justify horrible code. Foo: "Hey, this 10000-element collection, which we do repeated lookups on... why are we using a list and not a HashSet?" Bar: "Because lists are so much simpler than a HashSet. Let's just KISS" Foo: "But... doing repeated lookups on a 10k sized list is so much slower than just using a HashSet!" Bar: "Oh really? Have you profile…
Rob Pike’s Rules of Programming (1989)
31–40 of 122 posts
Re: Rob Pike’s Rules of Programming (1989)
#32Earlier quoted context omitted.
If they don't need order, a hash set is indeed more simple conceptually.
A set , the abstract interface, is simpler conceptually than a list. A hash set, the particular implementation of a set, is more complex.
Re: Rob Pike’s Rules of Programming (1989)
#33It's just a cycle: procedural programming -> data oriented programming -> object oriented programming -> functional programming procedural programming -> 'I hate all these imperative sequences ("flowcharts"), it's all about the data anyway !' data oriented programming -> 'I hate keeping all these data relationships in sync, can't the data do that itself ?' object oriented programming -> 'all this behavior is too comp…
>.. there are many things that are complex and can't be made simpler without destroying the functionality of the program. This is because we haven't figured out how to make them simple yet. I believe all problems can be made simple, once we come up with the proper system. Maybe we don't have the correct abstractions yet or just haven't figured out the best data layout. We've only been collectively programming for a f…
Maybe with powerful AI and Holodeck-like programs we can make it simple for humans to tell the computer to do anything they want easily, but short of that, I'm not seeing why every program would be simple to build.
However, the more powerful your tools, the more complex buildings and programs you're able to create. Programming hasn't necessarily gotten easier with more powerful abstractions, rather we create more complex programs now.
Re: Rob Pike’s Rules of Programming (1989)
#34Earlier quoted context omitted.
A set , the abstract interface, is simpler conceptually than a list. A hash set, the particular implementation of a set, is more complex.
Fortunately there are many languages which will provide a generic abstraction for you, so you don't have to deal with any of the complexity of implementing a hash set and you can just treat it like a set.
Re: Rob Pike’s Rules of Programming (1989)
#35Re: Rob Pike’s Rules of Programming (1989)
#36Rule 6: Every well-intentioned rule will be bastardized and used to justify horrible code. Foo: "Hey, this 10000-element collection, which we do repeated lookups on... why are we using a list and not a HashSet?" Bar: "Because lists are so much simpler than a HashSet. Let's just KISS" Foo: "But... doing repeated lookups on a 10k sized list is so much slower than just using a HashSet!" Bar: "Oh really? Have you profile…
things.Get("key")
?
Re: Rob Pike’s Rules of Programming (1989)
#37Re: Rob Pike’s Rules of Programming (1989)
#38Earlier quoted context omitted.
A set , the abstract interface, is simpler conceptually than a list. A hash set, the particular implementation of a set, is more complex.
Fortunately there are many languages which will provide a generic abstraction for you, so you don't have to deal with any of the complexity of implementing a hash set and you can just treat it like a set.
Re: Rob Pike’s Rules of Programming (1989)
#39I put 2007 above because it's the earliest year at https://web.archive.org/web/20070210233739/http://users.ece.... , but if someone has a better date for this we can change it.
Re: Rob Pike’s Rules of Programming (1989)
#40Rule 6: Every well-intentioned rule will be bastardized and used to justify horrible code. Foo: "Hey, this 10000-element collection, which we do repeated lookups on... why are we using a list and not a HashSet?" Bar: "Because lists are so much simpler than a HashSet. Let's just KISS" Foo: "But... doing repeated lookups on a 10k sized list is so much slower than just using a HashSet!" Bar: "Oh really? Have you profile…
Incidentally, Plan 9 was just 6 upside down.