The Best Ways To Simplify Your Code? (dice.com) 197
Nerval's Lobster writes: Technical debt arises for many reasons—whether moving goal posts, pressure to get code tested and released, high programmer turnover, and lack of documentation. Over time, it can also render code a spaghetti-like mess. But how to deal with it? In a new column on Dice, developer David Bolton offers some suggestions, ranging from refactoring to using compiler inference to increase readability and shorten declarations. While those techniques are straightforward, it's clear that a lot of developers let their code get out of control, and trying to plan beforehand doesn't necessarily prevent the work from getting overcomplicated. It seems like every developer has a go-to technique (or four) for keeping things a little more streamlined. What are yours?
How to simplify your code... (Score:2, Funny)
Re:How to simplify your code... (Score:5, Insightful)
Think more. Write less.
Writing less code has many benefits:
Ideas that involve writing a ton more code to do X always backfire, the latest being TDD/IOC. That stuff is nearly impossible to read and maintain.
KISS (keep it simple, stupid)
Re: (Score:2)
I would agree to this sentiment within the classes as the methods, but in terms of an overall enterprise application I think there is a lot of value in "going wide" so to speak.
In our application a lot of the cruft that built up was due to new services being built out at a fast pace within the framework of other code designed to do slightly different things for slightly different people. The result is that we have gigantic stacks of code trying to figure out what came from where and what it needs in return
Re: (Score:2)
Since your code is shorter, other people can read and understand it easier
Some Perl maintainers would like a word with you.
Re: (Score:2)
Think more. Write less.
Totally agree but you can also overthink a problem. I've been caught doing this myself. A strategy I've been using is to identify the maintainability requirements. That's how I decide how much work will go into the structure and it's ability to expand for the future.
Writing less code has many benefits
I'm going to assume you mean modularize you code because less code is not necessary easier to read or more efficient on the IOs. I can overcomplicate a simple if statement by using a series of NOT, AND, XOR, OR operations but that doesn't mean i
Re: (Score:2)
I find them equally easy to read. You should just get some more experience with ?: constructs. They're not the same as IF's, which gives you added feedback that only one thing happens (a value is guaranteed assigned), where as in a IF I can do other things, with no guarantee anything was assigned.
Re: (Score:2)
I tend to put too many lines in my conditionals when it would have been better to split it out into a function; if the conditional doesn't fit on a single screen, you should seriously consider shortening up the code.
Re: (Score:2)
Ever see "A River Runs Through It"? Sometimes I harbor a thought that every programmer needs to have the dad as their programming mentor, especially from the scene where the kid is turning in his writing assignment.
"Again, this time half as long."
"Again, this time half as long."
"Again, this time half as long."
"Good. Now throw it in the trash."
Re: (Score:2)
Cut and paste.
Don't try to do too much in one program (Score:4, Insightful)
.
And then there is always this old chestnut... The Big Ball of Mud. [laputan.org]
Re: (Score:2)
Re: (Score:2)
How to deal (Score:5, Funny)
It seems like every developer has a go-to technique (or four) for keeping things a little more streamlined. What are yours?
The mess is just part of coding. Deal with the mess. Accept the mess. Live with the mess. Join with the mess. Speak with the mess. Hear its answers whispered into your head. Nod assent as the mess intones its instructions. Welcome the mess in and let its tendrils throw through your veins. Understand the mess's greater plans and become its corporeal servant on this earth. Hail the mess. Hail the mess. All hail the mess. HAIL!
Re: (Score:2)
No, no, no... You ABSTRACT away the mess by making sweeping generalizations which with introspection leads you to a way to implement the mess. Remember, there is a METHOD in the madness.....
Re: (Score:2)
Then take all of of your glorious abstraction and stuff it into a FRAMEWORK that is so simple, anyone could effortlessly use as soon as they learn all the rules of using the framework properly.
Then have different programming teams start stuffing stuff into different frameworks and this famous quote comes to mind,
"Frameworks that Eat Frameworks don’t like it when you Customize the Frameworks they Eat"
When you get to this point, large modular software starts looking very supportable.
Re: (Score:2)
Re:How to deal (Score:5, Insightful)
Re: (Score:2)
Re: (Score:2)
If you are working in a section of code, spend a little time clean it up, since you'll have to test it anyway. Make sure you understand the implications of every line you change (yeah, that's slow). Over time, the sections you work with a lot will becom
In complement, assume you do NOT understand it (Score:3)
> Make sure you understand the implications of every line you change (yeah, that's slow).
A complementary technique I used recently was to make sure I did NOT understand the code. I could understand the implications of changes, avoid any side-effects, by not trying to understand what the code did and instead applying mechanical transformations. I got a new job, working on a code base I'd never seen before. I made some significant improvements by refactoring code while making sure I didn't understand anyth
Re: (Score:2)
Re: (Score:2)
This line of thinking implies that one never improves
No. Please read the part where I wrote, "Learn to think clearly."
Re: (Score:2)
I contend that one can always learn to think more clearly, and if one is constantly doing so then one's code will constantly be less clear than one is capable of writing.
You are right, but there's a point where you are 'good enough'. Let me give an analogy:
Traffic going onto the freeway can be bad, and if it gets too bad, then suddenly there is a slowdown, or even traffic jam. If the traffic is clear, then you can go the speed limit. The traffic can become more clear, but there is a point where it's "good enough."
Of course, you should ask, "When is it 'clear enough' in software development?" I think Jim Shore has the answer [jamesshore.com]. When your code is clean enough that you can o
Re: (Score:2)
And lets not forget Logic Programming. Did I miss any?
Stack based programming, table oriented programming, probably more lol
Personally, I think Smalltalk does a nice job of finding the balance between the various methodologies.
Re: (Score:2)
Common Lisp covers imperative, object-oriented, and functional programming nicely, as well as C++-style generic programming with actual readable syntax. If you find another form of programming, you can make it support it (I've seen a module for logic programming). The downside is that you have to forego almost all syntax, and write code like a parse tree generated in a compiler, using parentheses to show the structure.
Re: (Score:2)
Don't mess with code from Texas.
Re: (Score:2)
https://duckduckgo.com/?t=lm&q... [duckduckgo.com]
Step 1 - Don't (Score:5, Insightful)
Instead - black box it. Interface it off. Make your new code structured, shiny and gleaming. Do black box-style testing (inputs vs outputs, almost like futzing) against the old code's API and make sure your interfaced version produces the same. Unit test the hell out of your new code.
Over time, should you actually find a genuine need to, you can then start to look at the black box. Can it be made into a series of smaller black boxes? Can you interface those off too, independently? Cool - do it, one at a time, and use the same approach you used before. Eventually you'll either be left with nicely restructured code or, more likely, nice code that changes often and gnarly horrible stuff that doesn't change ever, but that's hidden behind an interface/library/<insert abstraction methodology here> and works.
Should always weigh the operational risk of changing ugly-but-known-quantity against shiny-but-unknown-quantity. The path of what to do will be different for every case.
Re:Step 1 - Don't (Score:5, Insightful)
Yes this.
It seems there is always that programmer that decides "I'm going to refactor this bit of code here to make it smaller, faster and cleaner". The actual result is things break (often not immediately) and it winds up taking up even more of said developers time as well as others that use or rely on that code.
If someone says "I'm going to refactor this bit of code here to make it smaller, faster and cleaner", and they can not give a very good reason to the question "why?", don't let them do it.
Re:Step 1 - Don't (Score:4, Insightful)
The programmer that decides I'm going to refactor some working bit of code to make it smaller and faster without first having the working version saved in the main code repository is an idiot.
There is absolutely nothing wrong with refactoring code that is working to make it better, as long as you approach the task incrementally - don't try to do too much in one go, and test and retest each change to ensure that you haven't broken anything. If you do, revert and try to figure out what you did wrong. The time it will save you in the long run when the code is more readable will pay for the time spent refactoring it by more than an order of magnitude.
Re: (Score:2)
That make a lot of sense pragmatically, but it would be much less likely to happen if the codebase wasn't in serious need of refactoring. unanticipatable side-effects is a sure sign of speghetti-code, often sprinkled with GOTOs.
Re: (Score:2)
What if you don't really know the expected behavior? What if you can only figure that out by refactoring until you can actually think about the code?
Re:Step 1 - Don't (Score:5, Insightful)
Let me offer a counter point: abstracting, wrapping, deferring, and hiding those black boxes can often lead you to building abstractions and interfaces which promise more than the underlying code can deliver, or which are outright not compatible with it.
If you run screaming from your real code so you can add a layer of code which allows you to pretend like you know what code you have, sooner or later you do something monumentally STUPID.
And the more you add layers of pretty on top of layers of ugly, the sooner it will bite you in the ass.
I've seen (on more than one occasion) someone taking old and ugly code, building a few layers of shiny on top of it, and then start passing around code which explicitly says "WARNING, THIS IS NOT THREAD SAFE" or "DANGER, DON'T EVER DO THIS", and then pass it into stuff which violates those assumptions right up until the code fails spectacularly.
And then of course people look as far as their abstraction and say "looks good here, we won't check down where the dragons are because our abstraction is awesome and perfect".
There are dragons, and if you don't understand it well enough to deal with the dragons, you may not be qualified to build a wrapper around the dragons. Because dragons are sneaky and always looking for a way to bit you on the ass.
I'm not saying don't clean up old code where you can. But if you think piling layers of bad assumptions on top of something you don't understand is a good solution, you're just waiting to get burned.
Or bit in the ass by a dragon you though was no longer a threat.
Re:Step 1 - Don't (Score:4, Insightful)
Let me offer a counter point: abstracting, wrapping, deferring, and hiding those black boxes can often lead you to building abstractions and interfaces which promise more than the underlying code can deliver, or which are outright not compatible with it. If you run screaming from your real code so you can add a layer of code which allows you to pretend like you know what code you have, sooner or later you do something monumentally STUPID.
You are right, and the GP is also right. The reality is, people who write bad code will write bad code, no matter what 'strategy' they use (and those people will typically use the wrong strategy, too).
When programmers aren't asking themselves, "how can I write readable code?" then you can be sure their code won't be readable, even when they follow all the guidelines.
Also, if the programmers on your team are writing bad code, you either need to teach them to do better or leave the company because it doesn't matter how brilliant you are, you can't clean faster than the other programmers make a mess.
Re: (Score:3)
Diving into old code just to tidy it up brings its own set of risks, and they may simply outweigh any 'niceness' advantage.
This is where unit tests come in. Refactor and test is a good way to clean up code.
Re: (Score:2)
That's lovely if you already have *comprehensive* unit tests available, and is one of the big wonderful reasons to create them as you work.
If you're not so lucky though, say coming in on a big project where the previous maintainers weren't 100% committed to creating and maintaining a comprehensive unit test suite, then you first need to have a comprehensive understanding of *every* way in which the module is used, everywhere in the program, in order to create the missing tests. That can be a major undertaki
Re: (Score:2)
Also, some software is not well suited for a comprehensive unit test suite. I work on stuff that has a GUI, which I can't unit-test with the tools we have, and it spits out gcode for CNC mills, which I also can't unit-test. When a serious test of some functionality requires that the operator load something into a CNC mill and run it, it really can't be unit-tested.
Re: (Score:2)
The best thing that can result in this type of divide and conquer approach is when you realize a thousand lines of code is pretty much necessary for doing one thing and there is a one line code solution for that functionality. That feels good and it has happened to me more than once... with other people's code of course.
The most important keys on the programmers keyboard are backspace and delete keys. Followed closely by or preceded by Ctrl-a.
Fuck dice (Score:4, Insightful)
The best way is likely by not reading a Dice article.
Re: (Score:2)
fuck off dice (Score:2, Insightful)
But seriously, the main problem is that many developers don't give a shit about the quality of their work and no one notices or does anything about it. It's not a matter of learning a technique.
If there's no rigor around what you write or how it gets tested, software will turn out shitty. If the development issues can't be fixed, it's often easier to just lie to the client or use hacks and workarounds to hide problems.
The fault for this lies with management. You need to police your developers but also treat
technical debt vs. simplification - wha? (Score:3)
Are you sure you know what those terms mean? (e.g., Fast but simple solutions often create technical debt.)
When your question gets closed by SO (Score:5, Insightful)
Frankly, if your code is constantly getting out of control and becoming unreadable, you are not doing professional work, you are doing amateur work (and yes, I know that there are plenty of paid professionals who do amateur work. We've seen stories from Trend Micro programmers here recently on Slashdot).
It's not a set of rules to follow. If there were a mindless algorithm to follow, then a computer could do it. Instead, when you are about to write code, always ask yourself, "How can I write this in a way that future programmers can understand it?"
Re: (Score:2)
And a set of rules if it did exist would not apply to everyone. The way to do things when writing web code is not the same way to write a Java application, versus a C++ application, versus code for an embedded system, etc. Some of the good techniques in some domains are really awful ideas in other domains.
Re: (Score:2)
Some of the good techniques in some domains are really awful ideas in other domains.
As a Python programmer, I used to disagree with you, but lately I've found my C++ code is much more flexible since I added some braces.
Re: (Score:2)
Why, were its pants falling down?
Re: (Score:2)
The Peter principal says that all 'professional' programmers will be asked to do things more and more complicated.
Donald Knuth discussed this, and said that you keep doing harder and hard things, things you've never done before, and that is why you can't write perfect code.
The upside is, your skills keep getting better, and that's what keeps programming fun.
In practice, you'll probably just end up writing yet more web services.
Re: (Score:2)
The Peter principle is only applicable here insomuch as a developer is not capable of learning from mistakes.
Everyone makes mistakes... But if they overcome those mistakes and learn from them, then they may continually take on challenges of ever-increasing complexity and not cap out on their skills until retirement.
Goto (Score:5, Funny)
has a go-to technique
How did they know my technique!?
Number 1 way to simplify your code: (Score:3)
Understand the problem it addresses better.
And in related news... (Score:4, Funny)
Developer David Bolton has moved on from Dice and the remaining authors have been left scrambling trying to pull his notes and articles etc together to generate new content. They report having difficulty understanding how he cobbled together the disparate information into existing articles and have advocated just rewriting the articles from the ground up so they would be easier to maintain going forward.
Re: (Score:3)
Narrative debt arises for many reasons - whether moving goal posts, pressure to get articles edited and posted, high writer turnover, and lack of organization of source material. Over time, it can also render workflow a spaghetti-like mess. But how to deal with it?
In a new column on Dice, developer David Bolton offers some suggestions, ranging from restructuring to using natural language inference to increase readability and shorten sentences. While those techniques are straightforward, it's clear that a lo
YOU WIN THE INTERNETS. (Score:2)
YOU WIN THE INTERNETS. That is all.
Seriously, funniest thing I have seen in days!
Best way to simplify? (Score:2)
Re: (Score:3)
Also don't do any string validation from user input.
All that stuff is just extra cruft that gets in the way of clean looking code.
Re: (Score:2)
Just check anything like a textbook. You'll find that almost all, if not all, of the code examples follow these simple rules.
Stop, Dice. (Score:3)
MIne were all blocked by Sarbaynes Oxley (Score:2)
Basically, I used to refactor constantly whenever I maintained code.
When sarbaynes oxley was passed, every change had to be approved by lower, then mid, then upper management in a series of 6 meetings. Doing anything except exactly the enhancement they wanted was virtually impossible. There is never a good cost/benefit for cleaning code when you think that way. Any change outside exactly what was approved would get you written up.
I went into management. Programming ceased to be engaging. it was easier
Top piece of advice... (Score:2)
Don't get a development team larger than the task really calls for. I've seen so many chunks of code that really has not much to do be horribly convoluted because they split up the work amongst more developers than it makes sense to have working on it.
Answer is not in the code (Score:3)
It is in having detailed requirements and performing proper testing. Good requirements will lead to good tests which will detect most of code defects. Doing structural coverage will also find not needed code.
Re: (Score:2)
Instead of click-bat here are some real sources... (Score:4, Insightful)
These books provide much better information on the topic and deserve a place on your shelf alongside the GoF's Design Patterns.
Do we want to? (Score:2)
Do you think that lawyers sit around lamenting the complexity of the legal system that means cases take years and thousands of hours of work to decide? Or that accountants sit around wishing the tax code was simplified to the point where a regular small business owner could prepare their returns themselves?
It may be a good thing for humanity if programmers create less work for themselves, but it is certainly not a good thing for the programming profession in the money-go-round that is banker-capitalism. It
Two things (Score:5, Interesting)
One of the checks I do is to have a non-programmer just READ my code. If they can make any sense of it (Think variable and function names) then I continue. If not, I rewrite until it reads like English (with extra stuff in the middle :-)
I also have SHORT (as in a single line or perhaps two) comment block at the start of anything that isn't immediately obvious. This adds to readability.
I have code blocks that are more than 10 years old, that I still refer to and which I can make out the intent and the execution without issue because of these two very simple techniques. '$a' doesn't tell me anything. '$account_name' does. Stop trying to limit your typing load.
Other thing I do, which I find missing from a a great many things; Check your inputs and your return values. As much as this is Programming 101 level stuff, it is remarkably absent from so much code. How is it that SQL injection works at all?
Re: (Score:2)
One of the checks I do is to have a non-programmer just READ my code. If they can make any sense of it (Think variable and function names) then I continue.
That's a really good idea.
Re: (Score:2)
Re: (Score:2)
The code tells you what the code does. The comments tell you why.
Re: (Score:2)
Really, is it the tendency for comments to be deprecated by evolving code that is the fundamental problem.... because the compiler rarely checks comments for accuracy, there is nothing to stop a programmer from leaving a deprecated comment in the code that may go undetected for weeks. Another new programmer comes along and r
Re: (Score:2)
Have good code reviews too. However sometimes on my team I feel like I'm the only one that really does this. Others do code reviews but they mostly just say "looks good, check in in" rather than actually inspecting the code in any depth or providing constructive feedback. I'll see some code with incredibly obvious bugs and wonder how it managed to slide past the code reviewer... It seems the code review is treated as just another check box to get done fast rather than something that's important to do.
modules, boxes, refactor (Score:2)
1. refactor
2. while you do that, divide up the code into modules that is a black box from outside
3. refactor those boxes as needed (split into more as needed)
and don't be afraid to do that before your program is finished, if it seems needed.
The time you save on a refactor is often quite a lot, so you shouldn't be too afraid of doing it.
Also making boxes like that helps testing.
But then again, I thought that was already what most projects did.
It's kind of a central point in most programming paradigms (both f
Keep it simple (Score:2)
Don't be clever. Most of us aren't paid to be clever. Follow the KISS principle. Be kind to the maintenance programmers and keep classes and methods short and to the point. After all the maintenance programmer might be you. Methods more than 1 screen in size are suspect. Avoid lasagna code.
Just a few rules I try to use.
Best way to code in C++ (Score:2)
Re: (Score:2)
Stupid (Score:2)
The fifth suggestion was the one that was just plain stupid. Using auto/var for declaring variables is the intellectual equivalent to Visual Basic's, Option Explicit Off. Sure you could do it but why?
Re: (Score:2)
There are cases in which "auto" is pretty much necessary in C++ code. There are cases where writing the type yourself would be cumbersome and error-prone. After that, those that work here start getting into disagreements.
Really, sometimes you don't care about the type, if it's suited to hold the value.
Rewrite it (Score:2)
Refactor strategy (Score:2, Informative)
When I want to refactor code, I first make sure we're working in a programming language that is suited for refactoring. That usually means it must be Java... nothing comes close in refactorability. It certainly rules out anything that isn't extensively checked by a compiler (eg. Javascript) -- there's always code paths that aren't covered in tests, and you rely on the compiler to warn you of potential problems in those.
Second, I make sure there are good tests available, not just unit tests but also integr
Implement first, optimize later... (Score:2)
Dice hate aside... (Score:2)
Dice hate aside, it really is a pretty lame click-bait article that could have been written by a bot. It's not bad to spark a discussion on Slashdot though so I'll bite. The first thing that comes to mind is DRY. Knowing when you are RY isn't always easy though, and there are some interesting tools out there that claim to be capable of detecting patterns via static analysis. I have to confess I haven't used them though. I'm wondering how big an obstacle to reduction is found in the "prestige" of "manag
Don't Put Extra Crap in It (Score:2)
"Tis a fine barn, but is no pool," Early Simpsons. Does you thing really need a blah--just because everyone else is doing it. Do we really need a internet connection for a notepad application? How much work is the "Managers" and now, the "Centers" doing?
Just don't put useless crap no one needs in your software.
Re:Dice sucks dick. (Score:4, Interesting)
I think spotting these issues, and giving the developer enough time to re-visit the bad section of the code is ESSENTIAL to maintain a relatively clean code base.
Code reviews can help, but the project deadline pressure-cooker usually prevails. My
Re:Dice sucks dick. (Score:5, Insightful)
When I take shortcuts because I am in a hurry, I try to leave breadcrumbs. I put comments that start with the string "FIXME" and then write a quick sentence or two explaining how I would do it if I had more time. Then later, when I do have time, I can just grep for "FIXME" and find a list of things that need to be fixed. Those comments save me a lot of time, because I have an explanation from when it was still fresh in my mind, preventing many "WTF moments".
Re: (Score:2)
What you suggest is the right way to do it, but it depends on having time allocated to doing it the right way and a manager who gives a crap about anything but squeezing out more features faster.
Otherwise, you become just that guy who never meets the deadline. Shortly after, you become the former occupant of cube 230B.
Re: (Score:3)
What you suggest is the right way to do it
It is almost never the right way to do it. Specs change, or are incomplete, or don't even exist. So it is better to hack up something quick, make sure it is what the customer (or your boss) actually wanted, and then go back and do it "right". It is silly to waste time making code "perfect" when it most likely will be thrown out.
Re: (Score:2)
That also depends on management. If the management is any good, they'll make it clear when a spec should be treated as final or tentative. They'll also give you time to do go back and re-do it right if/when it becomes final.
Otherwise, you have no idea if it is fixed or not and you will NOT get a chance to replace the spit and baling wire later.
Re: (Score:3)
"What you suggest is the right way to do it, but it depends on having time allocated to doing it the right way and a manager who gives a crap"
On one hand, you already have been told that's not usually "the right way to do it" since allowing for features to go along and see, once they are tested in real world, which ones will stay and which ones will not is usually the best way to go.
On the other hand, unless your manager is both a micromanager *and* technically competent, don't think about what your manager
Re: (Score:3)
Or just write it correctly the first time? I know it may be harder and more time consuming, but you'll get further in your career if you do.
Depends, in R&D I write an awful lot of throwaway code - maybe as much as 80% (depending...) but, at the outset, I can't tell you which 20% will be kept and used in the product and which 80% ends up being "investigatory."
Sure, you could just rewrite the 20% from scratch and "do it right," but that's not as efficient as reusing the proven test mules - which usually aren't in too bad of shape, if you trim off the FIXME: and TODO:s.
In my career, being able to show working code, quickly and easily, is impor
code reviews (Score:3, Informative)
I agree about code reviews: in fact I consider them essential in a team environment and wouldn't want to work in a code base where they will not be consistently held, at least going forward. Then the team can agree on some kind of standards and I recommend that the team develop a checklist for things the reviewer should check, where near the top of the list is: "Would I want to maintain this, and could I understand it easily if I came back to it years from now?". Also somewhere on the list is: "How was th
Re: (Score:2)
but during non-peak times (like the week between Christmas and New Years) when stuff is slow
Best week of the year because no one is there, and you can work on whatever you want.
Re: (Score:2)
Best thing I think, which will never happen, is to keep the work load light so that the team has actual time to spend making the code better in the first place as well as time to go back and rewrite older code. But too often everyone's on a death march to meet deadlines, you can only add features and fix bugs and any redesign or rewriting isn't assumed to help the bottom line. A lot of bad code I see is not because the programmer is bad but because they're being forced to add the code quickly and move on
Re: (Score:3, Insightful)
+4 insightful? Is everyone with moderation points 14 year old?
Re:Dice sucks dick. (Score:5, Funny)
+4 insightful? Is everyone with moderation points 14 year old?
Apparently, and it ignores the simple fact that Dice probably sucks small and medium dicks as well.
So, in keeping with the thread topic, I'll simplify the original statement: Dice.com sucks dicks.
Re: (Score:2)
Re:Dice sucks dick. (Score:2)
Dice.com sucks big dicks.
I'm guessing that Dice then is making someone or some people quite happy. A lot of guys seem to devote considerable effort towards getting their dicks sucked, so I don't really see how it's a bad thing
Re: (Score:2)
Just finished "Hello World" then eh? Good for you, time for the next example in the tutorial...
Re: (Score:2, Interesting)
Re: (Score:2)
Nice work in keeping the first product just below 2^63 - 1, and avoiding undefined behavior that way. However, it looks like it will only work in a little-endian environment.
Re: (Score:2)
Re:I don't understand. (Score:5, Insightful)
I think what everybody is hating on is the undisclosed relationship. Nerval's Lobster is a shill account. This is not ethical business practice.
Re: (Score:2)
Obviously, but if computer programs are written by humans, who are, unfortunately imperfect, and make mistakes. Sometimes we don't think of everything right away, and a better solution may simpl