Skip to main content


When companies ask you to write things like a sort function... you know I have to ask... why? I haven't had to do that myself literally ever. Every programming language worth using has a sort function. Even fucking *C* has qsort(). Yes, fucking *C* has a sort function. What the fuck.
in reply to disaster preparednes lesbian

True software engineers would say to use the standard library instead of rolling your own.
in reply to disaster preparednes lesbian

writingnsort function shows your knowledge.
This means than you not only can call some APIs and use tons of libraries, but write real code...
in reply to mittorn

@mittorn So I have a hot take about this

The novice programmer uses the sort function and doesn't care how it works

The intermediate programmer writes their own sort function, believing it is superior to all alternatives or the standard one

The advanced programmer uses the sort function, and doesn't care how it works

The latter of course, does so because they know if they're using a competently designed library, it isn't their problem. Someone solved the problem for them.

in reply to disaster preparednes lesbian

but what if case they need something that not was done by someone? Sort function can be easily checked. If company asked for something unusual, it would be difficult to check if solution is correct.
in reply to disaster preparednes lesbian

fucking C does not have radix/merge/heap sort functions in windows crt and fucking glibc.
Quick sort may be shit in some cases.
Plus some projects required to avoid standard library usage.
in reply to nekonomicon

qsort() is not always quicksort; the spec specifically says it doesn't have to be.

This is also why C is awful

When I need to implement these things, I use a library. I just steal tree.h or or queue.h from BSD, they figured this out ages ago and I don't have to debug it.

If I have to implement a data structure more sophisticated than that, I consult the literature.

The last thing I want to do is write yet another data structure library when people have done this a billion times. It's wasted effort for no reason. Time is not free. It's code I have to maintain myself.

This entry was edited (8 months ago)
in reply to disaster preparednes lesbian

@nekonomicon Mind, I KNOW how to do this. I have written sort functions, I have written my own trees, etc. It's how I know I don't want to do this, and why the knowledge is not useful.

I would rather solve useful problems, not solve useless problems and do busywork for no reason. Why do I want to solve the same problem everyone else has? Wow, another sort implementation, that's what the world needs.

This is why I argue knowing how to implement sorting is useless. Only a fool would waste their time. Half of the stuff I learned from data structure theory had to be discarded anyway (linked lists are cache miss generators, no one should ever use a binary search tree that's not self-balancing like a red-black tree or AVL tree, and things like block/slot allocators which are actually very useful in C are rarely covered).

This is why I think mid programmers revel in making data structures; they have just enough knowledge to do it, and yet not enough knowledge to know they probably can't do it better than an implementation that's had years of work put into it. 🤷‍♀️

⇧