While it's usually less of a problem in C, in my Java days I saw any number of functions with names like solve or act. These functions were usually overloaded, so that solve meant one thing for integers and a wholly different thing for strings.
Post some time during the day (I had a
As anyone with some experience can attest, Lists are generally highly inefficient data structures. Locating any given object is an O(n) operation, and sorting is at best O(n log n). However, there are two implementations of lists that are superior to all others: stacks and queues.
Imagine a tower of blocks, like we use in
I'm traveling today, so I'll save the content for tomorrow.
Hooray! I've been blogging for 100 full posts (actually, this is 103).
That's more than the average blogger ever puts out, because it takes a degree of focus to make this happen.
Ah. Basking in the glow of success.
Okay, back to
In 99.9% of cases, programmers spend most of their planning and initial coding creating the program that they want. They then spend twice as much time adding error-handling code to the original program, because they forgot that things can (and often do) go wrong.
This is happy path programming, or success oriented code.
I don't know how many hundreds of functions I've dealt with with either a void or boolean return type. While a boolean return type at least tells us whether the function ever completed properly, a void return carries absolutely no meaning. Where's the debugging or error-handling value in that?
Constructor functions take a number of
Some patterns are more obvious than others. This is one of the more obvious patterns, but it's violated often enough to deserve enunciation.
Just about every program out there uses an iterator for one reason or another. Without them, we can't build for loops, and more than a few while loops require iterators as
Most modern languages are designed around the object oriented design principles. They contain syntactic elements that codify and require these principles for code implementation.
Unfortunately, as is common with modern minds, we leave everything up to the computer. This results in a gigantic block of generalities, the result of which is slow code that is
Encapsulation is a key aspect of the Object Oriented Programming model, and for good reason. We have an easier time grasping units which do one thing than hundreds of independent operations and objects that can do a number of things. While C does not contain the class descriptor found in C++ or Java, we
When you commit to a set of documentation, you are telling all the users how your code will work and how they should use it. This has a trickle-down effect, such that any changes to the documented features can destroy entire suites of programs.
Violation of the Rule
Suppose you provide documentation for an early-release form