Slashdot Mirror


Ask Slashdot: What Are Some Bad Programming Ideas That Work? (infoworld.com)

snydeq writes: Cheaper, faster, better side effects -- sometimes a bad idea in programming is better than just good enough, writes InfoWorld's Peter Wayner: "Some ideas, schemes, or architectures may truly stink, but they may also be the best choice for your project. They may be cheaper or faster, or maybe it's too hard to do things the right way. In other words, sometimes bad is simply good enough. There are also occasions when a bad idea comes with a silver lining. It may not be the best approach, but it has such good side-effects that it's the way to go. If we're stuck going down a suboptimal path to programming hell, we might as well make the most of whatever gems may be buried there." What bad programming ideas have you found useful enough to make work in your projects? Don't be shy or ashamed, we all want to hear your responses!

99 of 674 comments (clear)

  1. Denormalize by tomhath · · Score: 5, Insightful

    I won't even call it a "bad programming idea". I've seen more problems from over normalizing a database than from under normalizing.

    Maybe the bad idea is trying for fourth normal.

    1. Re:Denormalize by sexconker · · Score: 5, Insightful

      CNF2 is good. CNF3 is sometimes better. CNF4 is usually worse.

    2. Re:Denormalize by Derekloffin · · Score: 4, Insightful

      Yeah, that. It is often a real pain in the neck to deal with a heavily normalized DB, where a few simple pieces of denormalized data would help you out immensely. "Bad" idea, but definitely works at times.

    3. Re:Denormalize by Anonymous Coward · · Score: 5, Insightful

      If it is stupid and it works, it is not stupid.

      I learned the above in the military, and I have seen no reason to unlearn it in 32 years working as an IT professional... Yeah, I'm no longer a programmer, but I still reach for my favorite hammer when I see a nail. Two years ago, I embedded Assembly Code into something that operated on Terabytes of transaction data. It wasn't stupid.

    4. Re:Denormalize by SpaghettiPattern · · Score: 5, Insightful

      CNF2 is good. CNF3 is sometimes better. CNF4 is usually worse.

      Sorta. First you analyze your model to be 3NF or 4NF. Then you denormalize in a controlled way. Logic before optimization.

      Accidental 2NF usually means the problem wasn't well analyzed. And that most likely there will be problems ahead caused by bad abstraction.

      --

      I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
    5. Re:Denormalize by Big+Hairy+Ian · · Score: 2
      I don't have to come up with bad programming practices that work!

      I have outsourcers who do that for me!

      --

      Build a Man a Fire, and He'll Be Warm for a Day. Set a Man on Fire, and He'll Be Warm for the Rest of His Life.

    6. Re:Denormalize by K.+S.+Kyosuke · · Score: 2

      Then you denormalize in a controlled way.

      That sounds very much like something that optimizing compilers are for. Perhaps this means that the toolchains and/or abstraction levels are deficient?

      --
      Ezekiel 23:20
    7. Re:Denormalize by luis_a_espinal · · Score: 2

      If it is stupid and it works, it is not stupid.

      I learned the above in the military, and I have seen no reason to unlearn it in 32 years working as an IT professional... Yeah, I'm no longer a programmer, but I still reach for my favorite hammer when I see a nail. Two years ago, I embedded Assembly Code into something that operated on Terabytes of transaction data. It wasn't stupid.

      Define "work". I've seen reports that prints the correct numbers but that are built (I shit you not) with cartesian joints executed in loops, over and over, per row.

      A more extreme example (I'm not making this shit up) - a reports server that makes a web service call to a "reports composer" service, one call per page, and for each page, the "reports composer" service makes multiple database queries per row (like not one of the a-holes who created this knew how to make SELECT SUM(somefield) FROM table GROUP BY whatever).

      Or how about this (truly, I'm not making this shit) - an internal web app A that used JMS to call another internal app B so that it makes a database query on its behalf. But internal app B instead would delegate that to internal app C to talk to the database - internal app C would do all the sins of people who don't know how to use proper SQL and batch statements, like iterating over a relation with a fucking for-loop, each iteration a database call to get a value, to be added to a counter (again, complete ignorance of SQL aggregate functions.)

      Then after internal app C shitted on the poor database (who btw, lacked indexes and had tables with fields named tmp1, tmp2 and tmp3), internal app C would return its payload to internal app B in free-form, totally flat, malformed xml, returned btw via JMS because it's enterprisey and hard-core and loosely-coupled (beasts who wrote this system wouldn't know what coupling meant anyways.)

      Are you still with me (trust me, I'm truly not making this shit up), finally internal app B would take the shit-flat malformed xml and parse it (it was so bad you couldn't even use xlst to massage it), so it had to traverse the fucking DOM... to produce untyped hash tables of lists containing hash tables and more lists - hash tables and lists all the ways, like turtles in ancient cosmologies.

      Then the hashtables-of-lists-of-hashtables-and-lists would be passed, again, via JMS, to internal app A, which would then pass the monstrosity to JSP pages containing thousands and thousands of lines of Java code to render that shit into a pretty HTML page.

      It worked... never mind that the company needed to run like, I don't remember, a dozen web servers to make that shit run when all that was truly required (if the system had been built properly) was one server for the application and one for the database.

      So yeah, "work" is not enough. I needs to work efficiently and be built for maintainability in mind. The thing that breaks projects is not to print the wrong numbers, but to cost so fucking much in operations that a company is forced to pull the plug.

  2. pop by Anonymous Coward · · Score: 5, Funny

    using assembly language to code a web page because the boss wanted it to be fast

    1. Re:pop by Joce640k · · Score: 2, Funny

      using assembly language to code a web page because the boss wanted it to be fast

      The bad idea was using JavaScript/PHP/whatever in the first place.

      Languages designed by clowns.

      The moment they should have given up was when they realized they needed to add an extra '===' operator because they messed up the '==' operator so badly.

      (and all the rest of the bad ideas they had around the same time they were implementing '==')

      --
      No sig today...
    2. Re: pop by s122604 · · Score: 2

      And the notion that C++ is some kind of magic language that is always, without exception, faster, better, more "real", and robust than all other languages is nothing but parroted bullshit

      I personal worked on a rewrite of a hard real time implementation that was rewritten from C++ to java using a real time JVM, and the java version performed better in every way imaginable..

      this isn't 1996..

  3. Goto by jomegat · · Score: 5, Insightful

    Goto. I use that (in C) for error handling all the time, and frankly, it is about the cleanest way to do it I have seen.

    --

    In theory, practice and theory are the same. In practice, they're not.

    1. Re:Goto by Anonymous Coward · · Score: 3, Insightful

      I also used to do this all the time in C. Code looks a lot cleaner this way.

    2. Re:Goto by lordlod · · Score: 4, Interesting

      Sure, C gotos are the cleanest solution in a few specific cases and sometimes I get frustrated in higher level languages that lack it.

      However I still demonise gotos when teaching coding because it should be use carefully and sparingly. New programmers often see it as a versatile stick that can solve all their problems, and while it can make the code "work" we moved on from spaghetti code for a reason.

      My personal rule is that a goto should only ever go down the code and never into new blocks.
      (except for implementing a try/catch system using longjump, every rule has an exception...)

    3. Re:Goto by Darinbob · · Score: 4, Insightful

      I've seen code that avoids this, or avoids multiple returns from a function, and the result was very difficult to understand. Either lots of misc state variables, or extreme indentation, etc.

    4. Re: Goto by HornWumpus · · Score: 2

      Once you get down to microcode everything is 'load program counter'. Doesn't mean 'load program counter' belongs in a high level language.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    5. Re:Goto by fahrbot-bot · · Score: 5, Funny

      Goto. I use that (in C) for error handling all the time, and frankly, it is about the cleanest way to do it I have seen.

      One little goto. How bad can it be?

      --
      It must have been something you assimilated. . . .
    6. Re:Goto by HornWumpus · · Score: 2

      Get a better IDE. They scroll right and left just fine.

      You might also consider breaking your functions into smaller chunks.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    7. Re: Goto by TheRaven64 · · Score: 2

      NASA is one of the largest users of Ada, so I'd dispute your claim there.

      --
      I am TheRaven on Soylent News
    8. Re:Goto by truedfx · · Score: 2

      My personal rule is that a goto should only ever go down the code and never into new blocks.

      My personal rule is simpler: if the transition would make sense in a flowchart of what the code is meant to do, then it makes sense in the code. If the only way to write that transition is through the use of a goto statement, then it makes sense to use a goto statement. This generally allows a bit more than your personal rule, but requires the person writing the code to be capable of creating intelligible flowcharts. One thing your personal rule allows that mine doesn't is using goto to break out of an outer loop from within an inner loop in languages that have a break statement that supports this directly. I hope you agree that using goto in that case would not be the best approach.

    9. Re:Goto by bluefoxlucid · · Score: 2

      I can scan vertically pretty easily; panning left and right is a complex visual operation.

    10. Re:Goto by Joce640k · · Score: 2

      Extreme meaning nested 8 deep, so that the inner loop is off the edge of the window, and if you resize or scroll it then it's still to confusing to read.

      You could try using an editor that lets you set TAB to 2 characters instead of 8.

      --
      No sig today...
  4. 90% of "modern" software by nadass · · Score: 3, Insightful

    Every new software, platform, framework, library, protocol, language, compiler... is rife with shortcuts (by design or accidentally) which are, relatively speaking, considered 'bad programming ideas' from generations of folks who did not prioritize them previously. So every modern program basically sucks for the same reason.

  5. HTML by Anonymous Coward · · Score: 5, Insightful

    While it's great for reporting, It will never be a good fit for real applications. When I say real, I mean the ones that you use to actually get work done and not browse kitten videos. Modern use of HTML/JavaScript is the worst example of shoving a square peg into a round hole that I've ever seen... and yet, with enough effort, we make it work.

    1. Re:HTML by xevioso · · Score: 3, Informative

      Applications? HTML was never meant for "applications". It was meant for web *pages*. Websites.

    2. Re:HTML by glenebob · · Score: 4, Insightful

      Yeah, I think that's the point. We've managed to take something meant for web pages and figured out how to embed fucking operating systems into it.

    3. Re:HTML by Noah+Haders · · Score: 2

      Those are kitchen videos...

  6. Re:well by wernercd8122 · · Score: 2

    I'll take that and raise you VB6... or VB in general, old and new.

  7. Sub-optimal code. by Derekloffin · · Score: 3, Insightful

    Frequently run into it, where I have a data set that is small, but difficult as hell code in such a manner as to go through efficiently. So, I can spend many hours trying to get the efficient code right, or just use the much simpler more brute force approach which will still get the task done just a quickly to the user's perception.

  8. Bad, you want bad: by geoskd · · Score: 4, Insightful

    C++ Template Metaprogramming FTW.

    For when it absolutely positively has to squeeze every last instruction cycle, and screw the next guy...

    --
    I wish I had a good sig, but all the good ones are copyrighted
    1. Re:Bad, you want bad: by Darinbob · · Score: 2

      Unused cycles are wasted cycles!

    2. Re:Bad, you want bad: by geoskd · · Score: 5, Interesting

      And tbh it's not that efficient anyway, but the programmer who wrote it doesn't know because he didn't time it........

      Yes it is, and yes we do. Our programs run against massive data sets (anywhere from a couple hundred MB to tens of TB) on a single machine. Our inner loops run billions of iterations per pass, and response time is absolutely critical. A single extra instruction in an inner loop can cost many seconds of real response time. Cloud solutions are not an option, and neither are large server farms. This thing has to run on somebodies desk.

      Short of assembler, there are not many ways to improve on what we are doing, and even there GCC and MSVC++ both produce some damn fast and highly efficient code when fed the right diet of templated inline functions. In the few cases where the final assembled version has made me do a WTF, it turned out to be instruction re-ordering to take advantage of (or work around) quirks of the x86 machines in common use today. I have been very hard pressed to beat the compiler for most functions compiled from good TMP. Some of the things we do with it simply cant be done anywhere else but assembler. Even C has its limitations.

      As an exercise, try to figure out how to get a C program to compile down to a dynamic set of functions, all in-lined into a single function. In TMP, I can do it. The templating spreads out the function into as many versions as it takes to cover all the possible variations, each of which is a fully in-lined version containing only the desired "calls". I have been programming in C a long time, and the best I have ever seen was someone try to implement the same thing by actually implementing all the different variations of the in-lined function by hand, and then creating a jump table to pick the right one. It was thousands of LOC and prone to typos, as opposed to the TMP version which was 50 LOC, and either worked or didn't, no place for small corner case errors to hide.

      --
      I wish I had a good sig, but all the good ones are copyrighted
    3. Re:Bad, you want bad: by phantomfive · · Score: 3, Insightful

      Yes it is, and yes we do.

      Well, if you timed it, then you know.

      --
      "First they came for the slanderers and i said nothing."
  9. Empty set by Excelcia · · Score: 4, Insightful

    There aren't any bad programming ideas that work.

    1. Re:Empty set by internerdj · · Score: 4, Interesting

      Most bad programming ideas are bad programming ideas because they don't scale. They work fine in a small code base with sufficient documentation. They probably work fine sparingly in a large code base with good documentation. The problem is that if we teach bad programming ideas are routinely OK if we are careful, then we rely on them and when scope grows and we inevitably hit a moment in the project that doesn't allow for solid adherence to good software engineering practices then it blows up in our face spectacularly.

  10. Bad Ideas by MightyMartian · · Score: 5, Insightful

    Coding in Javascript, PHP and VB6.

    --
    The world's burning. Moped Jesus spotted on I50. Details at 11.
    1. Re:Bad Ideas by JustAnotherOldGuy · · Score: 2

      Coding in Javascript, PHP and VB6.

      There's nothing wrong in coding something in JS when it's appropriate. Some page effects can't be done any other way, and Ajax has allowed the creation of full-featured web apps that are the rival of many desktop apps. It's one tool of many in the box and it has its place.

      PHP is full of warts but I love it. It's made me a boatload of money over the years and I've never regretted learning and using it. It makes my house payment (and more) every month. Hard for me to complain about that.

      VB6...yeah, that one is heinous, no argument there.

      --
      Just cruising through this digital world at 33 1/3 rpm...
    2. Re:Bad Ideas by ZecretZquirrel · · Score: 4, Insightful

      Specifically, so-called "web" interface programming using client-side Javascript on the DOM.

    3. Re:Bad Ideas by Anonymous Coward · · Score: 2, Interesting

      > VB6

      Yet, there are plenty of nice things about it, for example:

      Debugger: you can skip the execution point forward/backwards. You can edit code _live_ whilst debugging, or execute custom code in the same context as what's being debugged, and you can debug that as well. Can your favorite language's debugger do this?

      = operator that makes sense: how many beginners fall over the = vs == confusion? In VB6, you'll never accidentally assign a variable in an if condition.

      With statement actually works well, unlike implementations I've seen in other languages.

      As a language predominantly aimed at beginners, it works reasonably well. It somewhat verbose and won't be as expressive as some experienced programmers may like (for example, you can't assign in an If condition), but I think it achieves its aim reasonably well.

    4. Re:Bad Ideas by whoever57 · · Score: 2, Informative

      I think that you forgot Perl

      --
      The real "Libtards" are the Libertarians!
    5. Re:Bad Ideas by hcs_$reboot · · Score: 2

      At least in JS and PHP, you have basically the same syntax as C, giving you the opportunity to write clean code. Again the problem is not the language, that's the person using it.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    6. Re:Bad Ideas by Z00L00K · · Score: 2

      Not only VB6, any VB.

      But you forgot Delphi these days - the company behind it is falling apart since lead developers on the compiler have dropped off.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  11. Using !important in css by xevioso · · Score: 4, Insightful

    There's a lot of cases where you end up doing something that is considered not "best practice" and is frowned upon, but it gets the job done, is not likely to cause headaches for future developers, and is the most efficient way to solve a problem. It's not programming, but using !important to force a style when you absolutely have to or to override a bad implementation of bootstrap is a surefire way to solve an issue.

  12. FORTRAN 77 by stoicio · · Score: 2

    and Matlab ....ffffffFFFFFFFFUUUUUUUU..........!

    enough said.

  13. Working 80+ hour weeks by Anonymous Coward · · Score: 2, Insightful

    Seems terrible because you become less productive, but with the overhead of communication with a larger team, it's still much more efficient than hiring more people.

  14. hierarchical filesystems by OrangeTide · · Score: 2

    Or really file systems in general, but most of the modern ones has directories. File systems try to seem like a general purpose database abstraction, but using a filesystem to access data is really fraught with peril.

    --
    “Common sense is not so common.” — Voltaire
  15. enum values by Anonymous Coward · · Score: 4, Interesting

    I've occasionally relied on enumerations being particular values, as a shortcut. Makes me feel icky, tho.

  16. Put the business logic in the database by gfody · · Score: 2

    Or rather forget about what's business logic and what's not - if it can be done in the database, do it there.

    --

    bite my glorious golden ass.
    1. Re:Put the business logic in the database by guruevi · · Score: 3, Interesting

      Bad programming ideas: separating "business logic" from the rest of your program. Not sure what the difference is between 'business logic' and the rest of your programs that run your business but a lot of people seem to want to separate them out.
      Any database implements a turing complete language, it's generally a really bad idea to do anything there. Although to save time, I've often implemented SQL triggers and the like to do clean up that I didn't want to figure out in the program.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    2. Re:Put the business logic in the database by GodelEscherBlecch · · Score: 2

      separating re-usable "business logic" from the vendor-specific language of your data repository

      ftfy, make more sense now? Not everybody delivers (or stays) on the same RDBMS all the time. Not to mention how miserable it is to debug programs that live half in the middle tier and half in triggers. Or better yet, autonomous transactions in triggers - aren't those fun? You may want to look into interception frameworks.

  17. Shying away from OOP(s) by shellster_dude · · Score: 4, Insightful

    Few programs are more hellacious to write and maintain than code that has been overly-factored into classes, that inherit from other class, that implement some abstract that was inherited from other abstract, that isn't even called directly because it is actually a event handler or intent for yet another inheritance mess. OOP makes sense if used sparingly, if not, it makes GOTO spaghetti look sane.

    1. Re:Shying away from OOP(s) by Shados · · Score: 3, Interesting

      I came here to actually say OOP.

      Its an absolutely terrible idea that tries to make software work the way we think it should, not the way we think.

      It never ends well, and every time it goes to hell, people say "Oh, but if it had been done right in the first place..."

      Though somehow people actually make it work, and right now superior functional patterns aren't taught, so if you implement them everyone thinks you're crazy. So for now, OOP is a terrible idea that "works", that many know is wrong, but that we still use for historical reason to make working software, for now.

    2. Re:Shying away from OOP(s) by quietwalker · · Score: 4, Informative

      I had to work under a lead who had "Design Pattern Prejudice". Every class had to be named based on the pattern it took after, and everything had to come from factory factories that worked off interfaces to abstract parents at every step, everything had to be immutable, and in any given review, he'd point to a section of code and ask what design pattern this followed. If you couldn't specify one, he'd fail the review, and if you could, he'd want you to rewrite it to use at least 2 or 3 more patterns.

      Granted, he'd spend a whole week writing code, fail to complete any of his issues, and check in around 40 new classes & interfaces, but not one of them had any business logic in them at all, and then demand everyone refactor their code to use his new architecture.

      We only got things done when we started ignoring him.

    3. Re:Shying away from OOP(s) by dgatwood · · Score: 5, Insightful

      Likewise. OOP is an interesting design pattern, but not when taken to the extreme. Far too often, people use inheritance where an "if" statement in a couple of methods and an initialization-time flag would have sufficed, and the result is invariably unholy.

      I don't agree, however, that functional programming is an improvement. Functional programming is a migraine. In my experience, it usually causes things that are relatively trivial in procedural programming to turn into mounds of code. Everything that's bad about OOP is also bad about FP, just in different ways.

      The goal should always be to produce less code, to the maximum extent possible, and both of these paradigms tend to do the opposite—particularly in the hands of beginners, but not exclusively so.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    4. Re:Shying away from OOP(s) by hcs_$reboot · · Score: 3, Insightful

      Don't forget to include (C++) operator over-overloading.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    5. Re:Shying away from OOP(s) by Darinbob · · Score: 3, Insightful

      Bad programmers are bad programmers no matter what language or paradigm they use.

      I think some of this arises from someone doing busy work and getting the feeling that they're making progress. Ie, create lots of classes, draw lots of lines between them, and it sort of looks like a design. Now you spend the next few months implementing the skeleton of all those classes, and then every time you go home it feels like you put in a good solid day at work, your boss looks at lines of code and you seem productive so you get a nice raise. If your fingers get sore from all that typing, then you just call a few meetings to start debating the merits of class naming, which patterns are missing that should be added, how to improve the whole process, and so on.

    6. Re:Shying away from OOP(s) by AuMatar · · Score: 3, Insightful

      I actually think you're completely backwards. Most programmers think in terms of basic OOP and procedural programming. Nobody thinks in terms of functional programming- that's why no functional language has ever been a major commercial language.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    7. Re:Shying away from OOP(s) by Darinbob · · Score: 2

      It depends upon how people think about it. Some try to have each class be a real "thing" instead of being something more abstract, it's the way a lot of textbooks try to teach OOP. A file is a thing and so gets a class; a semaphore is a thing; a window is a thing that you can actually see so definitely it's a class. But a behavior, yuck, it's not a thing, so it starts to trip people up. But if you think of classes as an abstraction to tie data and behavior together, then you can look at it differently. There have been abstractions around data and behavior since before we had electronic computers, so OOP is just a way to organize it. Every abstract data type is just rudimentary OOP. Functional programming is just a different way to organize data and behavior.

    8. Re:Shying away from OOP(s) by Dutch+Gun · · Score: 4, Informative

      It could definitely be an anti-pattern if used incorrectly, but honestly, I've been programming in C++ for about twenty years, and do you know how many times I've seen co-workers abuse operator overloading? Precisely ZERO. Seriously... never seen it. Apparently, I work with people who weren't stupid to flagrantly abuse operator overloading for no good reason, even among those who didn't exactly produce the cleanest or more elegant code.

      On the other hand, this is the type of code I typically work with:

      Vector3 posDelta = position - lastPosition;

      Or this:

      Matrix m = m1 * m2;

      Overloading operators is best done in an absolutely literal sense. For instance, if you're doing matrix multiplication or subtracting two positions to get a delta value, the intent and what's happening in the code is 100% clear to everyone.

      I chuckle sometimes at how C programmers believe that there's some evil overloaded operator lurking behind every multiply or addition. Uh, yeah... you can also obfuscate the crap out of your C programs too (pretty sure I've heard about some sort of contest too *cough*), but you just don't do that.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    9. Re:Shying away from OOP(s) by Alomex · · Score: 4, Interesting

      Some of us are old enough to have gone through a generation of "overload everything" which was a disaster.

      Only much later did people learned to use overloading sparsely and with good effects.

      This is similar to OOP which is also overused. Heck in Java you can't even have a variable or a function living on its own. Everything must be an object (except native types, sometimes).

    10. Re:Shying away from OOP(s) by geoskd · · Score: 4, Insightful

      The goal should always be to produce less code

      Absolutely not, the goal should be to write the simplest code. Simplest being defined as easiest to understand that gets the job done. Simple code has fewer bugs, is generally easier to write, even if it is longer sometimes, and is far and gone easier to maintain.

      Many code abbreviation techniques actually make code harder to understand, like some of the sketchier if constructs in C, in-line class definitions in C++, etc... And before you start talking about in-line class definitions being faster, modern compilers have been able to handle whole program optimization including cross-source in-lining for many years now, there is no longer any benefit to having any code in headers, and for readability, lots of good reasons to never have code in headers. Keep each class in its own files (header and source pair), and nobody gets hurt.

      --
      I wish I had a good sig, but all the good ones are copyrighted
    11. Re:Shying away from OOP(s) by GodelEscherBlecch · · Score: 2

      Haha, never heard that one. Far more appropriate, although I still don't get people's beef with well-factored OO code. As far as I can tell everybody just reacts to either the readability aspect (there is plenty of IDE tooling for making class/interface hierarchies easy to understand, and FFS it's not meant for linear scripting, people) or the time they got some evangelist nutjob on the team who jammed OO where it didn't need to be (not exactly the language's fault). There is a difference between a bad tool and a frequently mis-handled tool.

      I love abstraction - distilling logic so that it can be promoted up a level, be consistent with the API and instantly empower everything downstream in the hierarchy...it's like getting a 4 row wipeout in Tetris. In terms of nerd fun, for me it's right up there with crunching on high-performance algorithms - I don't get why people shit on it so much here. I mean if your project doesn't call for OO then don't use it, but disparaging it without context just seems silly.

    12. Re:Shying away from OOP(s) by infolation · · Score: 2

      The principle here is 'be selective about who you listen to'.

      Sometimes just listening to the client is the quickest way to get things done, instead of listening to the other programmers. In other words, just find out what the code is supposed to actually do, rather than how it's supposed to do it.

    13. Re:Shying away from OOP(s) by jandersen · · Score: 2

      Its an absolutely terrible idea that tries to make software work the way we think it should, not the way we think.

      It depends, I'd say. Coming from a background as a mathematician, I tend to see programming a bit like set theory (set theory has a lot to do with binary logic, in fact, so perhaps that makes sense). Set theory is a funny subject - the theory we learned in school ('naive set theory') is very intuitive and gives us some profound insights into the nature of several important concepts; but it also runs into serious problems, like the Cantor Paradox. To get around these problems, there are now several, highlly formalised and complicated axiom systems, that really are only for the specialist (I apologise to any mathematicians who might read this). I think this is like C vs C++: C implements a simple, straight-forward and intuitive way of programming, which is why it has been so successful over the years; C++, on the other hand introduces a load of heavy axioms and formalism, which together form a great suite of tools to solve some really important problems - but you have to be a real expert to utilise them. OOP is a fantastic tool for solving general problems in a very tidy, elegant and efficient way - that is what the celebrated Design Patterns are all about.

      I think what often goes wrong in OOP projects is that they have the technical leadership they require. The classical model, where you have sales people feeding customer requirements into a design process, which then goes more or less directly to individual coders, isn't a good idea, I think; you need somebody in between, who really understands the appropriate design patterns, and who also knows how to write the code, so he/she can command respect (and offer guidance) to the developers. "Architect" might be the word I'm looking for. although it appears to have become somewhat tainted by misuse over the years.

    14. Re:Shying away from OOP(s) by dwpro · · Score: 2

      You make a fair point, but I'd say 'simpler' is far more subjective than 'less', and less seems to be the right answer 95% of the time.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
  18. Good enough that people won't stop doing it... by Narcocide · · Score: 3, Interesting

    ... despite that I keep telling them not to, but never good enough to save their business plan or their company from disregarding my wisdom.

      - Agile/scrum, anything related to it, inspired by it, or even remotely like it, and the mindset of managers who advocate it.

      - "continuous integration"

      - "devops"

      - server-side javascript

      - giving every single person in the IT department the root server access

      - using microsoft "solutions"

    1. Re:Good enough that people won't stop doing it... by dgatwood · · Score: 2

      I agree with everything on your list except continuous integration. What makes CI a nightmare is that so many CI systems basically eat themselves from the inside out, randomly, causing everything to stop while somebody wastes half a day to debug the CI system. But when it works, CI is a godsend. It makes it easy to know exactly when things started to fail (tests, building, etc.), which makes it much easier to pin down the causes for some types of problems. (Obviously for building, this is trivial, but for test failures, it isn't, necessarily.)

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    2. Re:Good enough that people won't stop doing it... by Narcocide · · Score: 2

      I'm so sorry.

  19. Multiple Returns by tomhath · · Score: 3, Insightful

    For a while the mantra was that you only return from a subroutine in one place, at the bottom.

    I think that's been pretty much abandoned. Return when you're done; don't go through contortions to get out of nested loops or IF statements just so you can get to the return at the bottom.

    1. Re:Multiple Returns by phantomfive · · Score: 3, Interesting

      I stopped doing that one day when I looked at the disassembly of my function and realized the compiler was optimizing my code to have multiple returns.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Multiple Returns by johannesg · · Score: 2

      What the compiler does truly doesn't matter. All those rules you are supposed to obey are only intended for correctness and clarity on source code level.

      Assembly only has one kind of flow control ("jump", i.e. goto), but that certainly does not imply that you should only use goto's everywhere from now on!

  20. Javascript by Anonymous Coward · · Score: 2, Insightful

    Javascript, the worst possible programming idea that seems to unfortunately work.

    1. Re:Javascript by grcumb · · Score: 4, Insightful

      Javascript, the worst possible programming idea that seems to unfortunately work.

      Son, you only say that because you've never poked the Cold Fusion bear. In earlier versions, it didn't even have subroutines.

      --
      Crumb's Corollary: Never bring a knife to a bun fight.
  21. Tcl by pedantic+bore · · Score: 2

    Some people used Tcl because for a while, it was the only way to use Tk, and Tk was handy. But people who used Tcl for the sake of Tcl shouldn't be watched over, for their own good.

    --
    Am I part of the core demographic for Swedish Fish?
  22. MUMPS by mmell · · Score: 3, Insightful

    No, really - I'm not making this one up. MUMPS manages to find every possible bad coding idea and make it as easy as possible. Interpreted code, typeless data, naked array references, zero FS compatibility with anything . . .

    1. Re:MUMPS by phantomfive · · Score: 3, Funny
      --
      "First they came for the slanderers and i said nothing."
  23. Interpretting instead of compiling by Frans+Faase · · Score: 2

    I once discovered that an interpretting parser was faster than a compiled version of it. Probably because the compiled version became so large that it was larger than the CPU caches, causing lots of reads from memory, while the interpretter did not. It is often the case that interpretting is fast enough and that there is no need for compiling (to machine code or virtual machine).

  24. Magic Numbers! by BarneyGuarder · · Score: 5, Funny

    Magic numbers save tons of time. You get to working code quickly to verify your algorithm. They nev

    >Segmentation Fault

  25. Re:The Bubble Sort by guruevi · · Score: 2

    I always see people implementing some sort of bubble sort (often badly) in higher level languages like Java, PHP and Python. I don't understand why, there is a perfectly good sort method in most if not all languages yet every idiot programmer seems to want to reinvent it.

    --
    Custom electronics and digital signage for your business: www.evcircuits.com
  26. Switch(true) by omnichad · · Score: 5, Interesting

    switch(true) {

          case $a < 5:

          do something;

          break;
    ...

    }

    A bit messy, but a lot cleaner than a stack of if/then/else for a set of of conditions.

  27. Javascript by Snotnose · · Score: 3, Informative

    In 40 years I've used dozens of languages, the only one I learned to actively hate was Javascript/ECMAscript. A pathetic, piss poor excuse for a language.

    I've heard PHP is just as bad but, as I've never written anything in PHP I'll give it the benefit of the doubt.

  28. The latest trend is not your friend... by cloud.pt · · Score: 2

    I've been dwelling the past months in my team's will to go full-fledged MVC (actually MVP) while developing for the Android SDK (for those out of topic: making apps). I see peers and myself struggling with old, large activities, running laps around to make them pass "technical debt" code reviews intending to "make them more future proof".

    It would be nice and all if I could grasp the benefits, but the problem is three-fold:

    a) the team is fooling themselves and the company into spending too much resources in something they can't assure adds value;

    b) Android already has a very solid MVP-like pattern going on, and MVP-ing it up further is a clear case of overengineering

    c) most important of all: there is no actual standard to guide the team, so it's a free for all and I see all the initial benefits down the drain just because everybody tastes a different flavour of the view/presenter combo

    And I see and underlying problem which might even be more crucial: the app will likely be dropped before reaping the long-term benefits, turning the entire endeavor TOTALLY WORTHLESS. So what I'm trying to say is: you got a solid framework with great patterns put in place already, developed by a company that is on the tech top 10, and you decide to be all trendy around it? You're pretty much grinding for a promotion you definitely don't deserve, because you're making that framework worse for everybody that you manage.

  29. Objective-C by hcs_$reboot · · Score: 3, Interesting

    Objective-C and its weird syntax reached success within the iOS world

    --
    Slashdot, fix the reply notifications... You won't get away with it...
  30. Are they clean? by gerald.edward.butler · · Score: 2

    Did you make your macros Hygenic?

  31. Re:Skipping unit tests by Darinbob · · Score: 2

    I have found many of those tests to actually be useless. Such as testing that the implementation is doing what the developer thinks the implementation should be doing, rather than testing that the behavior is correct. And then never documenting what those tests were really supposed to be testing (maybe testing that OS version must by 1.2.3 because they all break in 1.2.4).

    Or the useless tests that don't really exercise anything important. Such as add 100 items to a list and then pull them all off and make sure they come out in the correct order. I modify it to insert then in a reverse order and it breaks. Didn't matter if they increased the test size to be one million as it would always succeed but I could make it break with a size of 2... The original test was ok, except that there were no other tests to go with it that would have caught any bugs.

  32. Re:Are you on drugs? by glenebob · · Score: 2

    It was a bit loopy.

  33. process per request by buddyglass · · Score: 2

    Was going to be sarcastic and answer "Ruby on Rails", but I'll go with "process per request" instead. That is, the Apache model, or for Rails the model where you keep a pool of instances that only handle one request at a time.

    Terrible in terms of scalability, but generally works for small workloads. Plus it largely sidesteps developers having to understand how to write thread-safe code.

  34. PHP by EmperorOfCanada · · Score: 4, Interesting

    People crap on that language and, when I use it I usually violate MVC hard enough that it needs therapy. Yet, damn, I can pound out high quality products in that format like I am a programming firehose. I am talking products that make money and need little to no maintenance for years to come.

    I can do python flask stuff that is technically cleaner, I could even do something super hardcore like a C++ we back end but for the easy homerun, PHP it be.

    Obviously I am talking about the web.

    Another dirty secret is that I do most of my stuff from scratch. Nearly every framework or great IDE extra out there I ignore. The whole storyboards thing in iOS, nope, Java on Android, nope, or just about any proprietary system that tells me how I should do something is a big fat nope. I find with most huge frameworks that I can knock of an almost fully functional prototype in no time at all, but then I start fighting with the framework and can never finish, 90% done and that is it.

    By working with the fundamentals and good libraries, I start slow, and finish slow, but finish I do.

  35. Re:The Bubble Sort by SuricouRaven · · Score: 2

    I wrote a hobby-program once that needed to sort a list. A really big list - too big to fit in memory. After much thought I came up with a really neat search algorithm, a sort of modified radix sort that used only linear access and so would run with good performance from reading from a file. I doubted I could have invented a new approach to sorting, but I couldn't find anything quite the same as it.

    A couple of years later I came across that algorithm - in a book that dates from the mainframe era, describing how to sort data on tape. It was just obscure because few people have to sort multi-gigabyte lists.

  36. Re:Bad Idea #1 by johannesg · · Score: 2

    That's elitist bullshit. Sure, programmers vary in qualifications from horrifyingly bad to mindblowingly excellent, but don't use words like "application programmer" for our less gifted brethren and "system programmer" for the better ones; that just makes you look like an elitist prick.

  37. Duff's Device by hmckee · · Score: 4, Interesting

    Seriously, the first time I saw Duff's Device I really thought it was a mistake. It's a do/while intermingled with a case statement. Look it up and be amazed.

  38. Re:Domain modelling [Re:Shying away from OOP(s)] by angel'o'sphere · · Score: 2

    An example of domain modelling would be a human resources app that models employees, managers, offices, etc. as objects. This mostly flopped
    This is not an example for OO. Because the design is wrong.
    Hence your conclusions are wrong.

    The correct domain model is Person, Role, HierarchicPosition where every Person has a set of Roles and HierachicPositions define your company layout/hierarchy and has a set of Persons filling those positions.

    But OOP works fairly well for making API's to network and system services
    That does not really sound plausible.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  39. Re: Bad programming idea that works by Shoten · · Score: 2

    Also works when a 23 year-old "expert" from one of the big consulting firms reports to the CIO that the servers are underutillised.

    My reply was "certainly, what level of utilisation would you like?" but the grin on my face gave it away. It was then followed by a laymans explanation of utilisation vs. response times. And a decision that the consultancy wasn't in the company's best interests.

    You left money on the table with that.

    I don't know the context...how many other people were working alongside this guy, or how representative he was of the team (if there was one) that was there. But if he worked for the consultancy I work for, we'd have wanted to know about this. You should have raised this (along with what must have been several other curious ideas from the guy) to the account manager/account executive/throat to choke (the technical term) for your company. I'm pretty sure that the guy's going to get pushed out an airlock sooner or later, but you could have helped hasten the process.

    Remember: it's stupid people - not stupid companies - that come up with stupid ideas. Smart companies want to know who the stupid people are so they can remediate the problem, while stupid companies are nothing more than companies where the stupid people outnumber the smart ones and have taken over. Either way, if you assume the company isn't stupid and act accordingly, you'll get better results. Even if that means finding out that your assumption is incorrect...at least then you know, rather than assume, that the company is stupid.

    --

    For your security, this post has been encrypted with ROT-13, twice.
  40. Re: Bad programming idea that works by bluefoxlucid · · Score: 3, Informative

    Depends on the utilization patterns.

    Heavy I/O utilization will give you a bad time. As a counter-point, overprovisioning RAM relative to your working set will cut back on some of the I/O--a lot, if you're not on a write-heavy workload or a database. Correct RAM provisioning has to include the working set (application memory) and page cache (which is working set represented on disk, rather than persistently loaded into memory by the application).

    PU utilization at 90% during peak is fine, if your applications can handle it. A PHP or C# application that can service 5,000 requests per second only takes, on average, 1/5000th of a second to fully-service a request; if it's designed to queue and thread in some sane way, then it shouldn't stall later requests because an earlier request is waiting for something. Its ability to handle 5,000 requests per second includes all that overhead: you can't automatically scale the HW requirements to service 100 RPS and claim now it does 5,000.

    An nginx server at 90% utilization typically operates just fine, because nginx (as a reverse proxy, caching proxy, or static file web server) *does* serialize sanely. It provides one worker per CPU (configurable), and passes requests to workers under the least load. Each worker serializes requests--they service one request at a time--and will basically put a waiting request on hold and immediately start servicing a different request. If a worker is waiting with no request to service, it can take a new request--even if it has 37 requests all waiting for something (I/O, a back-end proxy, an application).

    Writing an application to handle parallel requests with that kind of efficiency is *hard*. It's not impossible, and some applications handle it well; others do in fact increase latency significantly with utilization.

    Latency will, of course, always increase when utilization exceeds unity. Using more than 100% of all CPUs means something has to wait.

  41. Views are extremely helpful in such cases by raymorris · · Score: 4, Insightful

    Views allow you to operate on the database as if it were denormalized, without losing the consistency guarantees and other benefits of a properly normalized database.

    It's the same concept as STORING datetimes as a number internally, a consistent, monotically increasing number, while DISPLAYING them as strings like "November 6, 2016 1:30 AM". Storing "November 6, 2016 1:30 AM" is crap for any kind of calculation, especially because that string represents two different times an hour apart - there's no way to know whether that comes before or after "November 6, 2016 1:20 AM".

    Similarly, views are virtual tables which provide whatever you'd like the user to see, without breaking the underlying data structure.

  42. 8 levels deep normally means function too big by raymorris · · Score: 2

    Indeed, if code is nested 8 levels deep, four or more of those levels should probably be separate functions. The first function might be:
    while (line = readline) {
            if (notcomment) {
                    sql .= build_sql(line)
            }
    }
    return sql

    The levels of indentation related to building the sql are off in another function, called build_sql().

    Human working memory can hold about 8 items at a time, in this case 8 lines of code. Which means you can look at an 8-line function and understand it all at once; you know what those 8 lines are doing. When looking at a 300 line function, you have to scroll up and down parsing parts of it at a time. That greatly increases bugs. Functions no more than 8 lines can normally be seen to be correct - you can fully understand it, without need to scroll up and try to remember how foo affected bar 250 lines ago.

  43. Flat files... by gosand · · Score: 2

    Back in the early 90s I worked at the big cellphone company. We worked on Unix workstations, and I learned a lot of what to do and what not to do. We used an in-house built bug system built to use sccs. I managed the build shell scripts. The only way to get code into the build was to enter a CR (Change Request) and link the source files to it. Then the build would examine all the CRs for a weekly build, check out that code, ftp it to the target platform (tandem), build it. If all went well, 8 hours later you would have a successful build, which I would then write to 9 track tapes, and THEN install it on the target system testing platform.

    So the bug system I mentioned used flat readable text files to store all the info. There was a gui front-end but it was kind of slow.

    Out of necessity to quickly look things up, I wrote a shell script that would allow you to search and view CRs on the command line. Bad built on top of bad, but it worked pretty well. Other people on my team started using it too.

    It worked so well in fact that somewhere around 2006 I was living across the country, having been at a few other companies since then. An old colleague still at my first company got in touch with me, and someone was asking about me and the tool I created. They saw my email in the header of the script, and wanted to get in touch with me to see if I would let them edit it. They were still using it! What I created for myself others found so useful that it was still chugging along doing its job on the command line. I don't know if it made me proud or sad, but it was humorous to me. I haven't heard anything from them since then, but it would be very interesting if they were still using that same process and those shell scripts I created so long ago.

    --

    My beliefs do not require that you agree with them.

  44. Dear Square Peg by PortHaven · · Score: 3, Informative

    From Round Hole,

    Please go look at some old houses and barns. Guess what, the construction is almost all "post and beam"...and guess what, they did it by hammering square pegs into round holes.

    Why?

    Because it is very hard to drill a square hole. And making round pegs is far more labor intensive than square ones, and wastes a ton of wood. Lasty, friction baby.....that's right. A round peg in a round hole will either slide in and out too easily and not be secure OR it will be so tight that the friction will make it nearly impossible to fit it in. So instead, they hammers a square peg into a round hole. Both the peg and the hole deformed slightly. Allowing for a tightly fitted peg to lock the post and beam together.

  45. Web Stack Sucks Rotting Eggs [Re:Bad Ideas] by Tablizer · · Score: 2

    Specifically, so-called "web" interface programming using client-side Javascript on the DOM.

    Amen! Productivity (work-related) application programming (CRUD) using HTML/DOM/JS is a f8cking nightmare.

    Part of the problem is that each browser brand/version combo can potentially render things differently such that you have to test on say 30+ combo's of browsers and devices to cover all bases, AND future versions may STILL break it after all those 30+ tests. My hair is turning Bernie Sanders shades over that crazy shit (and falling out like his). It makes the DLL-hell of the 90's feel better in comparison. Now we have render-hell.

    Possible solutions include bringing back WYSIWYG and/or vector coordinates, OR doing the "auto-flow" rendering on the server and making the browser be a dumb coordinate-based vector plotter. That way you are dealing with only one renderer instead of 30+.

    Another idea is to put X Window engines on browsers, but I'm skeptical of the input box response. Input boxes should (optionally) buffer on the client.

    Other ideas welcomed.

    Sure, you if you put a lot of bloated margins around everything you can make stuff "shift proof" in the web stack; but it looks ugly, wastes space, and is often not what the customers want.