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!

674 comments

  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: 0

      You must be a data analyst. ;)

    4. Re:Denormalize by Anonymous Coward · · Score: 0

      What, you don't like joining five tables just to get one field?

    5. Re:Denormalize by Anonymous Coward · · Score: 0

      I'd rather have to join 5 tables then parse one UUID made up of 5 pieces on information concatenated together.

    6. Re: Denormalize by Anonymous Coward · · Score: 0

      Someone's gotta do it, you or the engine. Personally I'd rather be in control.

    7. Re:Denormalize by Etcetera · · Score: 1

      I'd rather have to join 5 tables then parse one UUID made up of 5 pieces on information concatenated together.

      Why? (Assuming you're not searching for it in a way that requires discrete indexes.)

      God created perl for a reason, and sometimes it's a hell of a lot easier to make your DB simple rather than normalized to hell and back. Flattening tables can be a good thing.

    8. Re:Denormalize by SQLGuru · · Score: 1

      My rule of thumb is 3rd normal form and selectively back off for performance or complex features. Anything more than that really sucks for real world use.

    9. 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.

    10. 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)
    11. Re:Denormalize by chris_osulliva · · Score: 1

      +1 database 101: normalization database 201: forget what you learned in database 101

    12. Re:Denormalize by lrichardson · · Score: 1

      Gotta say, one interesting benefit of working on a Netezza machine (massively multi-parallel) is that tables can be normalized to BCNF ... and joined (as views) so the users never realize they aren't looking at anything but a nice, fat, logical, (business) understandable table.

      Not to mention, gets rid of all those pesky nulls. Netezza, of course, being one of *those* systems that recognizes true/false/null ...

    13. 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.

    14. Re:Denormalize by Kaptain+Kruton · · Score: 1

      Two years ago, I embedded Assembly Code into something that operated on Terabytes of transaction data. It wasn't stupid.

      The person that must maintain your code in the future may disagree with your claim when he or she discovers assembly is involved.

    15. Re: Denormalize by Anonymous Coward · · Score: 0

      Maybe that person can learn to code and deal with it?

    16. Re:Denormalize by LifesABeach · · Score: 1

      One will eventually have to consider benefits. Is a 3 nano second improvement worth the cost? For a few, yes; for the rest of the multiverse, WTF? And we all live in the multiverse.

    17. 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
    18. Re:Denormalize by Anonymous Coward · · Score: 0

      Perl was created as a troll and then things just got way way out of hand.

    19. Re:Denormalize by Anonymous Coward · · Score: 0

      The company I work for is so bad at IT (though they think they are IT Gods) that the system are so broken it's a miracle they actually work at all. One system (HTTP interface) we log onto gives you a choice of which shop you are working at, though it take 25mins to load as the list is thousands of entries long. They could just put up the main shops retailers, then ask for location which would be so simple but no, they believe listing each shop individually is as lot better. Now you consider there are thousands of employees who have to log on each day and each emplyoee has to wait approx 25mins for the data to load syou can only wonder how much all that wasted time actually costs my company. On another note, my company loves to issue jobs out to employee without knowing the costs involved. For another example we were recently told to clean some equipment. A notice went out to 5400 emplyees, who all had to spend around 5 hours cleaning the equipment only to be told the next day (after the deadline had passed) could we not do this as it takes to long as the person issuing the job notice did not relise how long it actually takes to clean, however everyone had done it and it cost the company (5400 employees x 5 hours x $12.30 = $332100). They must have money to burn.

    20. Re:Denormalize by luis_a_espinal · · Score: 1

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

      I cannot remember myself going beyond CNF3 (and I can only remember one time I de-normalized to CNF2... and I still doubt if this was a good idea.)

    21. Re: Denormalize by Pseudonym · · Score: 1

      By "deal with it", I assume you mean "try to work out what it does and then rewrite it because it performs terribly on the next generation platform".

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    22. Re:Denormalize by bad-badtz-maru · · Score: 1

      At least one of the well-known open source RBDMSs seems to fall apart if normalization results in queries with a large number of joins. The planner can't effectively handle queries of anything other than basic complexity if there's more than 12-16 joins. Couple that with no shared plan cache and denormalization becomes one of the only options.

    23. Re:Denormalize by ilsaloving · · Score: 1

      Can you give an example? I can't think of a single reason why 4th normal form would be a bad thing.

      4th normal form adds flexibility to the data, while also reducing overall database size and as a result speeds up full table scans. I can't think of a single reason why you wouldn't want to use 4th normal, short of having a really bad application design/code base to begin with.

    24. 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.

    25. Re:Denormalize by Anonymous Coward · · Score: 0

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

      It depends greatly on the circumstances. Something that works but wastes time is also wasting money.

      Schlemiel the Painter's Algorithm for example.

      Leaving the paint can in the same spot works, but it's also stupid.

    26. Re:Denormalize by suutar · · Score: 1

      In my experience, "if it's stupid but works it isn't stupid" usually has an implicit assumption that nothing else is working.

    27. Re:Denormalize by sexconker · · Score: 1

      For the same reasons CNF2 is sometimes better than CNF3. Sometimes the extra width on a table, extra storage requirements, and extra memory footprint (if you're trying to keep a whole table in memory) performs better than having yet another join. Sometimes you have an external table used as the source for multiple columns (Father's Occupation, Mother's Occupation) and you don't want two source tables or intermediary tables, but you do want a cascade relationship. Maybe you're storing a lot of "Yes" and "No" values or "Yes", "No" and NULL or blank or "Unknown". Flags in a table can handle that (1/0/NULL), and everything can be mapped on the front end.

      Maybe you're dynamically going through a list of checkboxes on a form and need to track all the responses for each submissions. Do you have a table that links each submission to all of the checkboxes they submitted, and then have a table of checkboxes, and then join all 3 together every damned time? Fuck no, that's ridiculous. You store the checkboxes in the submission table (as flags or a bitmask) and maybe maintain a list of the column names in a separate table for dynamic processing. If you store 2 bitmasks on the submission table, one can serve as the dynamic piece (which checkboxes were submitted) and one serve as the response piece (checked or unchecked). A bitwise AND gets you the submitted and checked responses.

      Maybe there's front end business logic that's more restrictive than your normalized database would be anyway, so you can ignore normalization in favor of performance in certain instances.

    28. Re:Denormalize by suutar · · Score: 1

      my best guess is that it's a matter of whether the extra time to join the multiple tables is a significant problem. If you're never not joining them, it may be faster to just leave it in 3NF.

    29. Re:Denormalize by cwsumner · · Score: 1

      Sometimes, columns that have the same name in diferent tables do not have the same data. Trying to over-normalize something like that is a disaster...

    30. Re:Denormalize by cwsumner · · Score: 1

      If you can not at least -read- assembly code, then you are not really a programmer.

      And before you answer violently, consider what you will say when, a few years from now, some ignorant kid tells you that knowing a 3rd gen language is not needed! 8-)

      Actually, I have already heard that from people using Excel... 8-P

    31. Re:Denormalize by cwsumner · · Score: 1

      In my experience, "if it's stupid but works it isn't stupid" usually has an implicit assumption that nothing else is working.

      That's true.

      But that can, of course, change with time. And that has happened in a lot of these old systems, where there are now other ways to do things.

      The example above sounds like a system that had to be it's own database server and driver, before that sort of thing was available. When it was later updated, they divided the code in the wrong place. And left in operations that should have been rebuilt to use the standard database operations. Lazy is not always good...

    32. Re:Denormalize by Lonewolf666 · · Score: 1

      And the C example with strcat() is arguably only a problem because of C's sub-optimal way of handling strings.

      Many Pascal dialects use a length-prefixed implementation of strings (https://en.wikipedia.org/wiki/String_(computer_science)#Length-prefixed), which eliminates the need to parse the entire string.

      Sometimes the stupidity is in the tools, and can be avoided by picking the right tool. Or extending the tool. If I was a C programmer and had to work with strings a lot, I'd probably end up implementing my own version of strings with a length-prefixed implementation.

      --
      C - the footgun of programming languages
    33. Re: Denormalize by Anonymous Coward · · Score: 0

      Comments, Comments, Comments. Even in the military, documentation is everything.

    34. Re:Denormalize by Anonymous Coward · · Score: 0

      I have been thinking it would be neat to control most relations with an ACL to simplify interactions and provide some sort of bitwise descriptor between tables not just the user+some other table. Like a group could own posts so any use in the group could also edit posts. The relation is group->post and user->group but conventional ACLs would require code to describe user->group->posts or user->groups and then subsequently user->posts.

    35. Re:Denormalize by yuriklastalov · · Score: 1

      It's a database, it doesn't have an optimized compiler and I wouldn't trust some fancy toolchain to optimize the schemata while maintaining data integrity at whatever level is necessary for the application. Hell, you can't always trust the query optimizer to come up with a sensible plan to just access the data without babysitting it, let alone some automated tool that tries to design your database for you. Fuck that, I've seen the sorts of retarded shit devs do to databases, it isn't pretty.

    36. Re:Denormalize by Anonymous Coward · · Score: 0

      I hope somebody kills me before I ever get so bitter that I launch into profanity-laced tirades over inefficient SQL.

    37. Re:Denormalize by K.+S.+Kyosuke · · Score: 1

      1) All databases have query optimizers, so their query language implementations are effectively optimizing compilers, and 2) "controlled way" is exactly how one program gets transformed into another, different but functionally equivalent program in an optimizer. The whole premise is that the transformation is not observable by the user. Furthermore, relational databases (as a successor to network databases etc.) were invented for exactly this reason - to hide the details of relational program implementation from the user. I agree that the current implementations may be comparatively dumb relative to what ought to be possible, thus necessitating the kludges you mention, but so far I haven't seen a reason to consider that as anything else than just the contemporary state of affairs.

      --
      Ezekiel 23:20
    38. Re:Denormalize by joboss · · Score: 1

      I don't know the exact rules for normalisation but when I look at my schemas abd briefly scan the examples on wikipedia, they largely look to be around 4NF to 5NF.and frankly, if I saw someone doing something like the tables not largely around 4NF and 5NF in the before examples I wouldn't peg them as qualified for a database architect or DBA responsibility beyond the absolute basic.I find making a schema that corresponds with good normalisation rules fairly easy. It's actually pretty natural and common sense.

      Why do people still screw it up? I would guess a combination of aversion to having more tables and spending too much time with spreadsheets.

    39. Re:Denormalize by Anonymous Coward · · Score: 0

      Well, the point is, it's stupid to keep doing unnecessary work. "It works" is not sufficient justification to use a technique if its performance is sub-optimal.

      FWIW, you can store the length of your C string in a variable once, and keep using that value until the string is modified. It's a little more work than Pascal's method, but it's worth the effort.

      In the past, I've even used structs for strings, containing an int for the length, a buffer for the text, and an int containing null to guarantee that it's terminated.

    40. Re:Denormalize by Ann+O'Nymous-Coward · · Score: 1

      01000110 01010101 01000011 01001011 00100000 01011001 01001111 01010101 00100001

    41. Re:Denormalize by cwsumner · · Score: 1

      01000110 01010101 01000011 01001011 00100000 01011001 01001111 01010101 00100001

      And yourself, as well. 8-}

      But that is ASCII coded Binary equivilent to ASCII. What I was talking about is a human-readable language with symbol names, as in:

          MOV LocalCounter, CountArray[ThisIndex]

      I think even you can maybe read that? But a lot of people act as though is was poison.

    42. Re:Denormalize by stoatwblr · · Score: 1

      "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."

      "It runs - badly" is not the same as "it works"

      Anyway if you understand the calls, etc you should be able to get a nice 6-figure lumpsum payout for making the system run well. Pitch yourself as a contractor.

    43. Re:Denormalize by luis_a_espinal · · Score: 1

      In my experience, "if it's stupid but works it isn't stupid" usually has an implicit assumption that nothing else is working.

      That's true.

      But that can, of course, change with time. And that has happened in a lot of these old systems, where there are now other ways to do things.

      The example above sounds like a system that had to be it's own database server and driver, before that sort of thing was available. When it was later updated, they divided the code in the wrong place. And left in operations that should have been rebuilt to use the standard database operations. Lazy is not always good...

      Sadly, that's not the case. The system was built well into the 2000's in Java. They just didn't know WTF they were doing.

    44. Re:Denormalize by luis_a_espinal · · Score: 1

      "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."

      "It runs - badly" is not the same as "it works"

      Anyway if you understand the calls, etc you should be able to get a nice 6-figure lumpsum payout for making the system run well. Pitch yourself as a contractor.

      Don't get me wrong. I'm a mercenary and I'll do COBOL while wearing leather and gagged if it pays well. The thing is that places that have such monstrosities do so because they are organizationally dysfunctional. I can handle hard work with ugly systems. But working with ugly personalities, it eventually wears you out... and if you are not careful, you become like them.

      You want to work with challenges that make you grow technically and professionally every once in a way. Not all grunt work is worth doing, even when the moolah is good.

    45. Re: Denormalize by SharpFang · · Score: 1
      --
      45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
    46. Re:Denormalize by SharpFang · · Score: 1

      Another of *these* assumptions - that the code will ever be maintained before it reaches end of life.

      I'd written code that runs to this day and it's nearly a decade since anyone ever saw the sources.

      Yet another is that it's going to be expanded, and so needs to be written in a modular fashion with abstractions for potential expansions.

      Data is read from socket, frames are identified in the stream, then decoded, and depending on the content several reactions are undertaken. Four function calls and a switch(). No, I'm not going to implement an event listener system, just because someone imagines we *might* someday receive the data from something else than sockets, that the protocol is changed in unpredictable manner (I define that protocol!), and that someone might (gasp!) need to edit the switch() code, instead of registering handlers for new commands through the API. Twenty lines of code turn into five files by making this more "versatile".

      --
      45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
    47. Re:Denormalize by cwsumner · · Score: 1

      Well, that too.

  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 tigersha · · Score: 1

      I knew someone who worked on a large website where most stuff was C++. But it was a very high traffic news site so it was necessary

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    2. 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...
    3. Re: pop by K.+S.+Kyosuke · · Score: 1

      Chances are that rewriting it in Chez Scheme or decent Common Lisp would give you equal or higher performance while not having to build a house with a toothpick. So C++ is a possibility for extremely high performance sites but I definitely wouldn't call it's "necessary". I suspect that OCaml could probably be used in a similar capacity, and Haskell people started doing interesting things with Yesod recently. But perhaps the "news site" was simple enough that bothering with either of those four alternatives would not be worth it.

      --
      Ezekiel 23:20
    4. Re: pop by Clsid · · Score: 1

      Facebook is extremely high traffic and even them do not resort to C++. C++ sucks for string processing, which is what web development pretty much is, which is why Perl gained so much popularity in the early days of the cgi-bin

      Sure, C++ is a way to solve the problem, but in the days of AWS, having to do something like that is a waste of money.

    5. 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..

    6. Re: pop by bad-badtz-maru · · Score: 1

      Facebook _did_ resort to C++ for a period of time, look up HipHop for PHP.

    7. Re: pop by Anonymous Coward · · Score: 0

      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..

      Must have been some really shitty C++ code.

    8. Re: pop by Anonymous Coward · · Score: 0

      I wouldn't mind being the person that decided PHP for Facebook. He is probably in the caiman islands or planning a personal trip to the moon.

    9. Re:pop by Anonymous Coward · · Score: 0

      I couldn't agree more, and writing JavaScript code is about 50% of what pays my bills these days.

      JavaScript is this decade's MS BASIC. A ubiquitous, but sadly, totally screwed up language with a thin veneer of thoughtful design layered over top.

    10. Re: pop by naris · · Score: 1

      (However(That(Would)))(Reduce(The(readability(And(Maintainability)))))(Of(the(System)))

    11. Re:pop by yuriklastalov · · Score: 1

      At least it doesn't use BASIC syntax. Or Coffeescript. Christ what a nightmare that was, it's more of a write-only language than Perl is. The combination of optional parentheses with frequent multi-line method invocations topped off with a Python-wannabe indentation scheme. You'd be better off compiling it to JS and working from that instead.

    12. Re: pop by s122604 · · Score: 1

      There is also the possibility that you have no clue what well written java, ran through a highly tuned VM is capable of..

  3. Bad programming idea that works by Anonymous Coward · · Score: 0

    10 GOTO 20

    20 GOTO 10

    1. Re:Bad programming idea that works by Anonymous Coward · · Score: 0

      overly complicating it a bit arn't we?

      10 rem
      20 goto 10

    2. Re:Bad programming idea that works by Anonymous Coward · · Score: 0

      Keep it simple:

      10 GOTO 10

    3. Re: Bad programming idea that works by Anonymous Coward · · Score: 0

      You seem to have a different definition of "works".

    4. Re: Bad programming idea that works by Anonymous Coward · · Score: 1

      Works when the boss says it's too cold in the server room.

    5. Re: Bad programming idea that works by petes_PoV · · Score: 1

      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.

      --
      politicians are like babies' nappies: they should both be changed regularly and for the same reasons
    6. 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.
    7. 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.

    8. Re: Bad programming idea that works by orasio · · Score: 1

      It doesn matter. When you run a server room, and a consultancy _firm_ makes that recommendation, it's not your business to do their HR work for them.
      A consulting firm that allows this kind of shit is a liability for the health of your systems, and a waste of resources. You need to get rid of them, and put a higher bar if any other company wants your money or attention. That's the safest bet.

    9. Re: Bad programming idea that works by BlackHawk-666 · · Score: 1

      Is that you, Accenture?

      --
      All those moments will be lost in time, like tears in rain.
    10. Re: Bad programming idea that works by orasio · · Score: 1

      As a matter of fact, "setting a high bar" was my euphemistic way of saying "do not accept them"

    11. Re: Bad programming idea that works by beschra · · Score: 1

      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.

      That worked? Impressive Jedi skills you have

      --
      It is unwise to ascribe motive
    12. Re: Bad programming idea that works by Anonymous Coward · · Score: 0

      It's really easy to write a C# app to handle multiple requests per thread due to its async/await feature. You just write your request handling code like a normal procedure and the thread can switch to other code whenever it hits an 'await' keyword.

      dom

    13. Re: Bad programming idea that works by Anonymous Coward · · Score: 0

      Switching threads incurs additional costs. The approach bluefoxlucid describes doesn't switch threads.

    14. Re:Bad programming idea that works by SharpFang · · Score: 1

      That may convince the management to get us better CPUs, but we'd be still short on RAM.

      I suggest 10 GOSUB 10

      --
      45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
  4. 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: 0

      Everything is a get from. Your code should be separate instances of `is`ness existing on its own core. Having statements executing like an Indian running on a gerbil wheel is pathetic. Learn the capabilities of the hardware that is being built for you and stop acting like your in 8th grade CS class in 1992.

    2. 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.

    3. Re:Goto by Anonymous Coward · · Score: 0

      Really?
      What should 8 and 16 bit programmers use ASM?
      All programing is not web design ans back ends.
      What do you thing Linux drivers are written in Java? Pyton?

    4. Re:Goto by Anonymous Coward · · Score: 0

      Don't worry about that guy. He likes to bash C because it's trendy to do so, but is completely incapable of answering WHY using C might be a bad idea (ie, using is C is a very bad idea for HIM because he has no fucking clue how to actually program).

    5. Re:Goto by Anonymous Coward · · Score: 0

      There's no need for Linux drivers because there's no need for Linux. Nothing anyone's heard of runs on it anyways.

    6. Re:Goto by Anonymous Coward · · Score: 1

      I used to do that, but then I went one step further and started using setjmp/longjmp instead - and wrapped them in some macros to make them nicer to work with.

      That had the advantage of removing most of the manual error checks within my own APIs

    7. Re:Goto by Anonymous Coward · · Score: 0

      Android, ChromeOS, DVD/BluRay players, routers, & most web servers. Yeah, nothing anyone's heard of...

    8. 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...)

    9. Re:Goto by Anonymous Coward · · Score: 0

      Hardcore C programmers often hate exception handling, but exceptions are much cleaner than goto, both within a given function and in rewinding the stack when the exception propagates (which goto doesn't help with at all). I spent years as a C coder before using Java (and then Python and Ruby) and initially felt that exception handling went against all that was good about procedural language code flow. But once you learn to think in terms of the 2 possible code paths (the normal path and the exception path), it actually becomes very intuitive.

    10. Re:Goto by Darinbob · · Score: 1

      Maybe, but we're still waiting for a suitable replacement.

    11. 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.

    12. Re:Goto by Anonymous Coward · · Score: 0

      Java, Python and Ruby all have automatic garbage collection, C doesn't.

      Sometimes it's cleaner in C to jump to some error-handling code to deallocate memory that is no longer needed because of the error before exiting.

      Just sayin'.

    13. Re:Goto by Darinbob · · Score: 1

      C doesn't have portable exceptions. And it's problematic to get this done efficiently while C is used in many environments where efficiency is necessary (no room for extra stuff on the stack, or no room for exception tables in code space, etc).

      In C++ I have seen that 99% of exception handling is all for error handling only, and throws to main() to do just print an error message then exit. Even many C++ books give examples where the arguments to throw are always error messages. In general, in most languages I see very few programmers who "handle" errors or exceptions in a more sophisticated way than just print an error and pop back to the main loop.

    14. Re:Goto by Anonymous Coward · · Score: 0

      This does indeed work, but is considered dangerous and non-portable. Fine if you only test on one platform.

    15. 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'
    16. Re: Goto by Bing+Tsher+E · · Score: 1

      In some applications, high level languages are a bad idea.

    17. 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. . . .
    18. Re:Goto by hcs_$reboot · · Score: 1

      Use GOTOs a lot as well, and indeed it is about the cleanest way to do things (programming in assembly)

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    19. Re: Goto by Anonymous Coward · · Score: 0

      C's still fine. The issue with goto is that it's only real purpose is to implement exception handling. And once you go down that path, you wind up with C++.

    20. Re:Goto by ShanghaiBill · · Score: 1

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

      The HLLs that lack goto have try/throw/catch exceptions instead, which are a more elegant way to solve the same problem. Why would you ever need goto in, say, Java?

    21. Re:Goto by Anonymous Coward · · Score: 1

      The only reason "goto" was ever demonized in the first place was because of the spaghetti code potential. This was massively compounded by countless beginner programmers (myself included) learning to program in the earlier line-number-oriented BASIC dialects which had zero concept of a "function" and no loops other than "for" and "if condition then backwards-jumping GOTO." When your beginner language's most effective tool for program flow control is GOTO (and its more function-smelling friend GOSUB) and your only available loop is a variable counter, you tend to learn to maximize what little you have in front of you. Unlearning the hard reliance on goto in favor of other loop structures can be annoying, but they often eliminate the need for explicit goto instructions entirely and improve the clarity of the code.

      However, C in particular provides no way to "break" out of nested loops without adding an otherwise unnecessary variable and check condition to the outer loop to extend the break command. Using a goto statement and label to jump out of the nested loops is by far the cleanest and most efficient way to do it. I also favor the use of goto statements to consolidate my generous pile of possible error messages a la "fprintf(stderr, "out of memory\n"); return -1;" beyond the last return statement at the end of functions, reducing ugly multi-line inline error code to a simple "if (!p) goto error_oom;"

    22. Re:Goto by narcc · · Score: 1

      Exceptions can be expensive. Far more expensive than other approaches.

      There are other problems and criticisms that apply to exceptions, but that's the easiest to understand. As for elegance, you'll find exceptions in Java are very often criticized for cluttering code. You'll find countless criticisms online with a bit of searching.

      Like most things, there isn't a clear "best way". Exceptions are fine sometimes, a horrible nightmare other times. Sometimes, a goto is a really good thing.

    23. Re: Goto by Anonymous Coward · · Score: 0

      Every website that matters runs Linux.

    24. Re:Goto by HornWumpus · · Score: 1

      'Extreme indentation' might have been an issue when we all used punched cards. But today? Any flow control statement SHOULD be easily found by looking at the change of indentation.

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

      Breaking out of nested control structures is a favorite of mine.

    26. Re:Goto by Anonymous Coward · · Score: 0

      Premature optimization is the root of all evil!

    27. Re: Goto by Anonymous Coward · · Score: 0

      Name any. I disbelieve your claim.

    28. Re:Goto by Anonymous Coward · · Score: 0

      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.

    29. Re: Goto by Anonymous Coward · · Score: 0

      NASA systems. Shh kid.

    30. 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'
    31. Re: Goto by Kremmy · · Score: 1

      Insert list of every high level language that isn't self-hosting.

    32. Re: Goto by Anonymous Coward · · Score: 0

      What? He likes to use BASH with C? That is crazy!

    33. Re: Goto by Anonymous Coward · · Score: 0

      Agreed. In the end, everything is a goto, once you get down to assembly. If you're careful with it and only use it for errors when the program halts (i.e. not jumping around between functions and stuff) there's no reason not to use it sparingly.

      I prefer setjmp/longjmp

    34. Re:Goto by Anonymous Coward · · Score: 0

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

      You might also consider breaking your functions into smaller chunks.

      IDEs are the problem... they encourage writing lines of code that are horrendously long.

      I'm currently dealing with about 2M lines of crappy code written in an ide that did/does soft wrapping of lines. Looks really pretty in that particular Windows ONLY
      IDE, but in anything else it looks like shit when you 1k, 2k and some times even 3k characters on a single line. No, I'm not joking.. I've got a single line embed sql query that is 3k characters long ( I don't have a problem with the query per sae, but with the fact that it was written as 1 flipping line).

      Yes, I'm an old fart that cut his teeth doing development work in C on hierarchical database. The IDE was vi on an ascii terminal 24 lines of 80 chars.. and a few lucky people got extra wide terminal 100 chars. Coding standard was tabs not space, tabs set to 2 width and lines had to break by column 72 ( some of the printers has feed strips starting at 74 (the paper was cheap and I suspect A4).

      Can't see the logic in 24 lines .. then the function is probably to complex .. or you like printing it out to fanfold paper to you could edit with a pencil.

      BTW, I hate having to do left/right scroll ...

    35. Re:Goto by Anonymous Coward · · Score: 0

      This does indeed work, but is considered dangerous and non-portable. Fine if you only test on one platform.

      Yeah .. right .. I haven't meet a Unix/AIX/BSD/Linux or clone (any remember Charles River Data Systems or Wang) that setjmp/longjmp didn't
        work flawlessly. And it works just fine on Ubuntu derivative Linux Mint 18 Sarah.

      Sheesh .. just realized I've been using setjmp/longjmp for more than 30 years now .. man am I an old fart.

    36. Re:Goto by Z00L00K · · Score: 1

      If you use Exceptions for the normal flow it's not a good idea but if you use them only for actual faults then it's not a problem. An Exception shall be an exceptional event.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    37. 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
    38. Re: Goto by TheRaven64 · · Score: 0

      Goto is the wrong tool for that, but C lacks break n and continue n control structures, so goto is all that you have.

      --
      I am TheRaven on Soylent News
    39. Re:Goto by TheRaven64 · · Score: 1

      The problem with exceptions is that they're a non-local goto. When every function call becomes intra-procedural flow control as well as inter-procedural then reasoning about your code is painful. Java is one of the least bad languages that use exceptions in this regard, because it at least makes exceptions an explicit part of the method's contract, but it's still quite painful.

      Any new language should consider error handling as one of the most important design elements and propagate a good design throughout its standard library (error handling, concurrency, and security are the three most difficult problems for any programming language). Unfortunately, neither Go nor Swift did this.

      --
      I am TheRaven on Soylent News
    40. Re: Goto by Anonymous Coward · · Score: 0

      Gotos should be taught first, its best to start with basics and build up to more "complex" ideas like control structures. If gotos are in fact bad, the people learning to program will jump into for loops and if else etcs...

      On the other hand maybe gotos are best for them, maybe gotos are more inline with their thinking, and they can advance their skills faster.

    41. Re:Goto by Anonymous Coward · · Score: 0

      I'm a huge C fan, but I rarely use goto, but rather use control blocks instead.
      The reason is that goto can break variable scoping in very subtle ways that are
      difficult to detect. Now, goto to the end of a function is the safest route, I avoid
      using goto in the middle of a function's body because I shot myself in the foot once.

      CAP === 'ranger'

    42. Re: Goto by Anonymous Coward · · Score: 0

      "All programing is not web design ans back ends."
      Completely off topic, but why is it that everywhere I look I see someone writing "all X are not Y"? What you're saying here is that no programming is Web design or back ends, which is blatantly false. Whatever happened to "not all X is Y"?

    43. Re: Goto by Anonymous Coward · · Score: 0

      IoT Vibrator with tweet and FB status posting functions

    44. Re: Goto by Anonymous Coward · · Score: 0

      I was going to say game controller with feedback but ummmm

    45. Re:Goto by johannesg · · Score: 1

      Exceptions are great: they let you separate error generation from error handling in a very clean and straightforward way. They make it impossible to 'just ignore' error conditions as well. They remove mountains of error handling code from places where it doesn't belong, making the intent of the surrounding code much clearer. Being non-local is not a problem, it is a vital feature.

      As for 'not knowing which code can throw' - learn the mindset that all code can throw, and work from there. It means learning how to properly use RAII, which also helps making your code much cleaner.

    46. 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.

    47. Re:Goto by AmiMoJo · · Score: 1

      I like the GCC system of local labels for goto. By always using local labels you can enforce the locality of the goto, and also avoid confusing similarly named labels between functions.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    48. Re: Goto by Anonymous Coward · · Score: 0

      Tell that to all the 'web developers' out there sometime. They think everything just magically exists in some cloud somewhere.

    49. Re: Goto by Jason1729 · · Score: 1

      Hardware drivers.

    50. Re: Goto by Jason1729 · · Score: 1

      Sure it belongs in a high level language. Doesn't mean it should be used by everyone, but it should be there for people who actually know what their program is doing.

    51. Re: Goto by Anonymous Coward · · Score: 1

      Yeah, exceptions are wonderful, except when they get in the way of coding. Java has a load of checked exceptions that shouldn't be.

      try {
              ios.close();
      } catch IOException(e) { // WTF am I supposed to do with this?
              throw new RuntimeException(e);
      }

    52. Re:Goto by Drethon · · Score: 1

      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.

      Having a bunch of state variables can help a lot with debugging, if not done to excess anyway.

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

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

    54. Re:Goto by Joce640k · · Score: 1

      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.

      Or... you could use a proper programming language, with exceptions.

      Using GOTO won't save you from having to clean up all those little memory allocations and free() statements that you just jumped past.

      C++ stack unwinding _will_ do that for you. Automatically.

      (And this, ladies and gentlemen, is the *real* difference between C and C++. It even has a name: RAII)

      --
      No sig today...
    55. Re:Goto by Joce640k · · Score: 1

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

      Even better: Get a screen which can display more than 40 columns of text.

      --
      No sig today...
    56. 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...
    57. Re:Goto by Anonymous Coward · · Score: 0

      Java still has a subset of goto, break and continue with block labels. Meant as a clean way to exit nested loops they can be used on any block.

                        void foo() {
                              mainFuncBody: {
                                          if( error )break mainFuncBody;
                                          callSomething();
                              }
                              if( error ) handleError();
                    }

      Worst about it is that people seem to prefer boolean flags even for the intended use case:

                  for( int i = 0; i Exceptions can be expensive

      At least in Java the highest cost is the stack trace, if you throw often enough that this is a problem and you wont read all just disable them in the constructor - the Java runtime does this for some build in exceptions. Other languages build even basic constructs around exceptions, like pythons for loop and then there are the ever present comparisons between C++ and abort() style (complete lack of) error handling. In other words, I do not really trust the "can be expensive" statement for the general case.

    58. Re:Goto by Anonymous Coward · · Score: 0

      Great slashdot ate my not html formatted code:

                    for ( int i = 0; i lessThen y and !done; ++i)
                              for( int j = 0; j lessThen x ; ++j)
                                      if( bar(i,j) ){
                                                  done = true;
                                                  break;
                                      }

      instead of

                          outerLoop:
                          for( int i = 0; i lessThen y; ++i )
                                for( int j = 0; j lessThen x; ++j )
                                        if( bar(i,j) ) break outerLoop;

    59. Re: Goto by K.+S.+Kyosuke · · Score: 1

      NASA is large *and* it may be using Ada to some extent, so strictly technically, you're not wrong, but historically, it mostly used assembly or HAL/S for onboard code and now is basically a C shop. Even more appetizing is the fact that Orion spacecraft's control systems were code-generated from MATLAB's Simulink.

      --
      Ezekiel 23:20
    60. Re:Goto by mrchaotica · · Score: 1

      I'm currently dealing with about 2M lines of crappy code written in an ide that did/does soft wrapping of lines. Looks really pretty in that particular Windows ONLY IDE, but in anything else it looks like shit when you 1k, 2k and some times even 3k characters on a single line.

      Just run it through indent and be done with it.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    61. Re:Goto by narcc · · Score: 1

      for ( int i = 0; i < y and !done; ++i)
          for( int j = 0; j < x ; ++j)
              if( bar(i,j) ){
                  done = true;
                  break;
            }

      It's not that hard. To produce a < just type &lt;

    62. Re:Goto by Anonymous Coward · · Score: 0

      Goto is not a bad idea. Sometimes it's the best way to do something in which case it's a very good idea. Hell, at the machine level there is only goto.

    63. Re:Goto by Clsid · · Score: 1

      C is not bad in itself. Depending for what you use it. I would say using C for web programming is a bad practice, but for real-time programming C, and C++ more specifically is where it's at.

    64. Re: Goto by Anonymous Coward · · Score: 0

      https://en.m.wikipedia.org/wiki/Considered_harmful

    65. Re:Goto by cellocgw · · Score: 1

      Dunno about exception-based code. Joel Spolsky seems pretty much against it.

      --
      https://app.box.com/WitthoftResume Code: https://github.com/cellocgw
    66. Re:Goto by Anonymous Coward · · Score: 0

      In C, goto is extremely useful for creating exit and error handling.

      int func() {
        int ret = 0;
       
        if (!blah) {
          ret = -1;
          goto end;
        }
       
      /* more code, etc */
       
      end:
       
      /* cleanup */
       
        return ret;
      }

      Clean and easy to understand.

    67. Re:Goto by ADRA · · Score: 1

      Meh, for actual errors, I'd prefer Exceptions since you have the 'guarantee' that the proper behaviour is enforced. For all other cases that I'd ever consider using a goto in Java, there's always "continue 'label';" or "break 'label';" (Continue or break out of nested loops).

      --
      Bye!
    68. Re: Goto by ADRA · · Score: 1

      If you truly don't care about native file handles not being closed properly, then use one of the million utilities like apache commons I/O:
      IOUils.closeQuietly(ios);

      --
      Bye!
    69. Re:Goto by atikare · · Score: 1

      what I really like about c++ exception handling is that it unwinds your stack neatly. so all the objects on your stack get destroyed appropriately. its especially important for releasing any locks you may be holding.
      If interested take a look at how boost lib uses it it to for thread cancellation.

      BTW all the complaining about c++ not being good for string processing goes out the window when using boost with c++11. really try it, it feels very much like java!

    70. Re: Goto by Anonymous Coward · · Score: 0

      They also like to design control systems in Simulink blocks and use that to generate code for flight.

    71. Re:Goto by Christian+Smith · · Score: 1

      C doesn't have portable exceptions. And it's problematic to get this done efficiently while C is used in many environments where efficiency is necessary (no room for extra stuff on the stack, or no room for exception tables in code space, etc).

      Single threaded exceptions with setjmp/longjmp can be implemented very cheaply and portably with just a fixed size static array, and a counter to track the nesting level. So long as you don't recursively try/catch, this should be good for small environments, and can be nicely wrapped in CPP goodness for syntactic sugar and easy portability to larger and/or threaded environments (which may require a more sophisticated exception stack.) While setjmp/longjmp can have a performance cost, if it makes error handling easier, then the cost may well be worth it in higher reliability. Make it work first, then make it fast.

      You'd have to be very resource constrained or trivial to make it impractical to use an exception model for error handling.

      In C++ I have seen that 99% of exception handling is all for error handling only, and throws to main() to do just print an error message then exit. Even many C++ books give examples where the arguments to throw are always error messages. In general, in most languages I see very few programmers who "handle" errors or exceptions in a more sophisticated way than just print an error and pop back to the main loop.

      Which may be perfectly valid, so long as you don't leak resources. Just abandoning the current transaction and moving on to the next might be perfectly adequate so long as proper diagnostics are available so that someone can determine why the failure occurred if required. However, making code exception safe can be non-trivial.

    72. Re:Goto by cwsumner · · Score: 1

      Real programs sold for profit need a lot more error handling that that. About 60% of a business or industrial program is error handling, they are not allowed to ever crash. Of course some things you can't recover from, but you better hope the clients never see one.

      So... leaving straight out of the current procedure/method on an error is not done. You must write code to clean up what can be cleaned, choose defaults when available, and return error codes to the calling procedure. Which does it's own cleanup and returning error codes, until the program gets to a place it can continue from.

      Do you really think your program is less important than those? Do you really think it will be easier to debug your program that just says "GPF", than those?

      To paraphrase an old saying: "Think twice, code once"

      P.S., I make my living fixing such things. Frustrating, but pays good... ;-)

    73. Re:Goto by Anonymous Coward · · Score: 0

      I'm currently dealing with about 2M lines of crappy code written in an ide that did/does soft wrapping of lines. Looks really pretty in that particular Windows ONLY IDE, but in anything else it looks like shit when you 1k, 2k and some times even 3k characters on a single line. No, I'm not joking.. I've got a single line embed sql query that is 3k characters long ( I don't have a problem with the query per sae, but with the fact that it was written as 1 flipping line).

      In what fucking world do you live where you can't simply run that through any of the multitude of free SQL code formatters / beautifiers / tidiers to break lines and make it more readable?

      Seriously, this is a solved problem. Why are you complaining about it here, if you're an old fart with years of experience?

    74. Re: Goto by Anonymous Coward · · Score: 0

      } catch IOException(e) { // WTF am I supposed to do with this?
                      throw new RuntimeException(e);

      try {
              ios.close();
      } catch IOException(e) { // Something really gnarly is going on with our underlying storage - clean up and exit as gracefully as possible.
              do.something(cleanup);
              throw new RuntimeException(e);
      }

      If you're catching an exception just to swallow it and throw a new exception of your own, that's kind of dumb. If you want the program to fail, but want to try and exit semi-gracefully, catch it, do your processing, then exit. If you want the program to fail, and have no worries about dying instantly, don't bother catching the exception. If you don't want the program to fail, catch it & execute some recovery commands, then swallow the exception.

      Either way, I don't understand why you would claim you don't care about an exception coming up from lower layers, but still try to catch it.

    75. Re:Goto by Lonewolf666 · · Score: 1

      I'm currently dealing with about 2M lines of crappy code written in an ide that did/does soft wrapping of lines. Looks really pretty in that particular Windows ONLY
      IDE, but in anything else it looks like shit when you 1k, 2k and some times even 3k characters on a single line. No, I'm not joking.. I've got a single line embed sql query that is 3k characters long ( I don't have a problem with the query per sae, but with the fact that it was written as 1 flipping line).

      Without knowing the context I'm guessing here, but isn't there a way to break the query into smaller parts? Or build it dynamically?

      A 3k character SQL query would immediately make me wonder where I messed up to get there...

      --
      C - the footgun of programming languages
    76. Re: Goto by Anonymous Coward · · Score: 0

      I would rather use my screen to view 3 80-column windows side by side.

    77. Re: Goto by johannesg · · Score: 1

      Throwing exceptions for failed resource deallocation is a very bad idea, and is strongly frowned upon in the C++ community (since it might lead to the double exception problem). I have _never_ seen any piece of software that had an appropriate response for close() failing anyway, whether it was based on exceptions or return codes. If Java throw an exception in that case it's braindead language design, and not so much a sign of a general problem with exceptions.

      Like all the tools in the toolkit, and like every language, _how_ you use it matters.

    78. Re:Goto by HornWumpus · · Score: 1

      I'd have to see the query plan, a 3k char query is either an act of genius or idiocy. The plan will tell, if it contains words to the effect of 'temp table' the whole thing is sure to be idiocy.

      The genius option is the query is really a stored procedure and some SQL admin thought they owned the server.

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

      Now you've done it.

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

      Using GOTO won't save you from having to clean up all those little memory allocations and free() statements that you just jumped past.

      Not true. So long as you initialize all your variables to NULL, and you never prematurely return from the function, having a final "goto CLEANUP" with NULL checks + deallocations at the end of the function, you can always ensure proper cleanup.

    81. Re:Goto by Anonymous Coward · · Score: 0

      I love you.

    82. Re:Goto by yuriklastalov · · Score: 1

      It's Python, you insensitive clod!

    83. Re:Goto by mrchaotica · · Score: 1

      In that case, you apparently want autopep8 instead.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    84. Re:Goto by goose-incarnated · · Score: 1

      I'm currently dealing with about 2M lines of crappy code written in an ide that did/does soft wrapping of lines. Looks really pretty in that particular Windows ONLY IDE, but in anything else it looks like shit when you 1k, 2k and some times even 3k characters on a single line.

      Just run it through indent and be done with it.

      Unless it's Python, in which case you're out of luck.

      --
      I'm a minority race. Save your vitriol for white people.
    85. Re:Goto by Joce640k · · Score: 1

      Not true. So long as you initialize all your variables to NULL, and you never prematurely return from the function, having a final "goto CLEANUP" with NULL checks + deallocations at the end of the function, you can always ensure proper cleanup.

      Or.... you could have the machine do all that automatically for you.

      --
      No sig today...
  5. well by Anonymous Coward · · Score: 0

    $PHP

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

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

    2. Re:well by naris · · Score: 1

      We have some VB6 apps and they are quickly becoming impossible to maintain since the development environment is no longer supported and getting it to run on modern hardware with modern OSes, especially in virtual machines, is becoming difficult. VB.net however is still very much alive and very usable.

  6. 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.

    1. Re:90% of "modern" software by Anonymous Coward · · Score: 0

      Every programming language has always seemed to get rid of something and add something else from a theoretical programming-language that has all possible features:

      C - Lets get rid of recursive function definitions like Pascal
      Java - Lets get rid of pointers
      Python - Lets get rid of machine-dependent instructions
      C++ - Lets add objected oriented programming to C

      Desktop systems kept their 2D GUI widgets and 3D rendering separate through the use of overlays, bitplanes, contexts and other concepts. Embedded systems just throw everything together into a single OpenGL context (ie .Qt)

  7. Spaghetti code by Anonymous Coward · · Score: 0

    I maintain a large old project that's full of spaghetti code. An IDE helps to manage it and it works fine but it's a pain to make certain types of changes.

    1. Re: Spaghetti code by Anonymous Coward · · Score: 0

      I use lots of manual prints and debug lines built into my code for projects that involve a variety of languages and technologies where debuggers are heavily lacking.

    2. Re:Spaghetti code by Anonymous Coward · · Score: 0

      Spaghetti code is easier to write but harder to maintain. and even harder to modify.
      But will often run just fine until you touch it. Then the sauce is everywhere.

    3. Re: Spaghetti code by Anonymous Coward · · Score: 0

      System.Diagnostics.Debug.Print is the duck's nuts for remote debugging, or local debugging if you must.

  8. 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 Noah+Haders · · Score: 1

      can you recommend a good source for kitten videos.

    3. Re:HTML by mnemotronic · · Score: 1

      HGTV?

      --
      The Russians have won. They have made the world a cesspool of distrust, greed, fear and hate.
    4. 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.

    5. Re:HTML by TheRaven64 · · Score: 1

      HTML plus JavaScript is the latest iteration in a display server design model that included NeWS. I liked NeWS, but even I'd admit that declarative HTML for layout and imperative JavaScript for controller logic is an easier combination to deal with than PostScript for both.

      --
      I am TheRaven on Soylent News
    6. Re:HTML by Half-pint+HAL · · Score: 1

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

      And it's not even very good for those, because the guys that wrote it were still thinking of paper publishing. What was the first major use for unnecessary JS bloat? Interactive menus. Even now, the least JS you can use for a menu hierarchy is a quick change of hidden/visible attributes in an onClick attribute.

      But if they'd had a <menu> tag, we could have done the whole hierarchy in nested HTML and then only needed to invoke Javascript at the last minute. And even then, if the nodes at the end of the tree hierarchy were links (as was the case in c.2000 JS menus) there would be no script needed at all -- pure HTML.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    7. Re:HTML by Noah+Haders · · Score: 2

      Those are kitchen videos...

    8. Re:HTML by ItsJustAPseudonym · · Score: 1

      Then there's EMACS...a fucking operating system that also includes an editor.

    9. Re:HTML by Matheus · · Score: 1

      Vi. We've managed to take something meant for editing text and figured out how to embed fucking operating systems into it.

      What's the problem?? :)

    10. Re:HTML by Anonymous Coward · · Score: 0

      In most languages, if you want to hack up something simple it's pretty easy and not too painless with Google at your side. But with JavaScript and CSS I find it hard to just scratch an itch without first learning a whole shitload of stuff I don't care about at the moment.

    11. Re:HTML by Tablizer · · Score: 1

      We've managed to take something meant for web pages and figured out how to embed fucking operating systems into it.

      You mean several operating systems, as each client (device) has a different browser brand and/or version, creating Client-Version-Combo-Hell, which I rant is arguably worse than DLL-Hell elsewhere in the story replies.

  9. 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.

    1. Re:Sub-optimal code. by DutchUncle · · Score: 1

      Second the motion. Binary search could be wrong, linear search will always work, and if the table is small enough it's not worth going crazy over. OTOH why are we searching a table in the first place, maybe it's in the wrong order . . .

    2. Re:Sub-optimal code. by Anonymous Coward · · Score: 0

      Sometimes the bad idea is to write a program at all. I have a coworker who takes pride in calling himself a "systems engineer," which in my head is not too different from developer, which is not too different from programmer. Anyway, we are often at odds with each other because a simple job that would take 15 minutes of repetitive work becomes, at his desk, a 2-week software development project. To write code that will never be used again, to solve a problem that could have been solved without a program in 15 minutes. Drives me crazy.

  10. 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 phantomfive · · Score: 1

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

      --
      "First they came for the slanderers and i said nothing."
    3. 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
    4. 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."
    5. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      Once, i had a task, to write the longest word in a big dictionary. Using STL took me close to 1min. Using pure C and proper algorithm (and 3 times more memory) took me 1s. Go figure.

    6. Re:Bad, you want bad: by Z00L00K · · Score: 1

      Was it Finnish?

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    7. Re:Bad, you want bad: by TheRaven64 · · Score: 1

      So using an off-the-shelf algorithm and an off-the-shelf data structure made your code slower than picking ones tuned to the data? Shocking! The design of the C++ standard library typically allows you to decouple the algorithm from the data (see the algorithms header), so doing the same tuning in C++ and following that design would let you change the two independently and see which combinations were better. But don't let that get in the way of your C++ bashing.

      --
      I am TheRaven on Soylent News
    8. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      proper algorithm

      Choose your iterators and algorithms wisely, son.

    9. Re:Bad, you want bad: by angel'o'sphere · · Score: 1

      So, from 1s we conclude that the file was maximum 500MB (from the typical read speed of SSDs and HDDs).

      If either C or C++ on a modern PC used any measureable additional time: you did it all wrong.

      Go figure.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    10. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      https://en.wikipedia.org/wiki/X_Macro

      I used this instead of templates when I was a C programmer and needed templates. Note that it is actually uglier than templates though.

    11. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      EDSLs are amazing. Boost MSM/statechart are far easier for our engineers to use than doing stuff with normal statemachine classes. I also have had great success using spirit for validating/parsing complex languages. It's a better solution than YAAC, IMO.

      And then there's enable_if. enabled_if is a quite spectacular piece of code that allows a person to create a library and implement some of the goodness of concepts: namely, that of rejecting bad types with good error messages. Being able to say "You can only use random access iterators for __function__" is far better than a type error or a runtime error. And far, far better than a runtime bug that doesn't result in an error until you get much further down the pipeline.

      So yeah, it's not *just* for performance; it's for fail-fast programming.

    12. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      >TMP version which was 50 LOC, and either worked or didn't, no place for small corner case errors to hide.

      TMP's ability to catch errors at compile time is a godsend. Anyone who doesn't grasp this has no business writing code in C++. It's that simple.

    13. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      Dude, link-time inlining has been around since quite a while ago. Also, code bloat much?

    14. Re:Bad, you want bad: by david_thornley · · Score: 1

      C++ template programming is infinitely efficient at runtime.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    15. Re:Bad, you want bad: by Anonymous Coward · · Score: 0

      C++ Template Metaprogramming FTW.

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

      TMP can also make the code more readable.

      If you had to code a generic library that also has to be blazing fast, for whatever reason, the hoops you'd have to jump through to keep it both generic and fast can easily kill readability. TMP can get you both sometimes, and I experienced this with a wavelet library that just had to support arbitrary configurations, and be very fast. TMP let me parameterize the wavelet function and let the compiler figure out how to produce optimized code for that wavelet in particular, it saved me a lot of time, the code was very readable (ie: the library got a wavelet functor as argument, can't get clearer than that), and was very short with almost no repetition.

      I don't think it could have been any better without sacrificing something.

      Perhaps the only trick was that it was very simple TMP, where the templates got functor classes with inlineable, constant-producing functions that would work well without all the compiler magic (only slower). So a casual reader would understand what it does, even if he wouldn't understand why it was so fast (ie: that the compiler knew how to const-ify all those calls).

      More complex TMP, like in boost::mpl, sure is write-only.

  11. Empty set by Excelcia · · Score: 4, Insightful

    There aren't any bad programming ideas that work.

    1. Re:Empty set by Anonymous Coward · · Score: 0

      This message brought to you from the "any code that compiles is good code" department.

    2. Re:Empty set by narcc · · Score: 1

      I don't know. I've seen more than my share of working applications that were composed entirely out of bad programming ideas...

    3. Re:Empty set by Anonymous Coward · · Score: 1

      I present Duff's Device.

    4. 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.

    5. Re:Empty set by Anonymous Coward · · Score: 0

      There aren't any bad programming ideas that work.

      Oh yes they do. I spend a good chunk of my time dealing with bad programming ideas that work. The problem is that eventually someone wants something modified, and that's when the bad programming idea becomes very apparent.

      Bad programming ideas are like duct tape. Sooner or later it's going to give and someone will have to deal with it.

    6. Re:Empty set by cwsumner · · Score: 1

      There aren't any bad programming ideas that work.

      "If Engineers built buildings the way Programmers write programs, the first woodpecker that came along would destroy civilization!"

    7. Re:Empty set by Anonymous Coward · · Score: 0

      My favorite example about scaling was finding out that a bubble sort (written in C) was actually faster than qsort() or other "better" sorts when the size of the data was small (main storage small), and already had some duplication and ordering, by the nature of the problem.

      Another example was on some of the TI computers that had shift operations that worked over areas of main storage. This meant a queue in what you actually moved the data elements position by position, instead of using head and tail pointers, could be done in one or two machine cycles.

  12. 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 Anonymous Coward · · Score: 0

      I love VB6. It is the only language/IDE that I *like*. However, I also recognize some of the more horrible things. Looped string concatenation is the killer of its performance. Since your classes are really COM objects, you can't contain an object of the same type (interface) and you have to use encapsulation vs actual inheritance. Crashing the runtime/IDE is pretty trivial, especially when using callbacks or multithreaded apartment shenanigans. But man... the ease of use of COM objects is bloody fantastic. Nothing else does it so seamlessly. Then there is the scripting runtime. Add a reference to that and you can not only call script code, but you can push your own objects onto the scripting context and the script will have access to it.

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

      I think that you forgot Perl

      --
      The real "Libtards" are the Libertarians!
    6. Re:Bad Ideas by Anonymous Coward · · Score: 0

      Oh god - the VB6 editor was garbage. I recall having to select all, copy, and paste into a text editor before saving any major changes because the save could crash the editor... and the editor clears the clipboard on start up (because it loads its form icon through the clipboard).

    7. 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...
    8. Re:Bad Ideas by Anonymous Coward · · Score: 0

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

      So-called "web"? What would you prefer we call it?

      Now, if you had said so-called "programming", you might have made some sense...

    9. Re:Bad Ideas by Anonymous Coward · · Score: 0

      There's nothing wrong in coding something in JS when it's appropriate. Some page effects can't be done any other way,...

      I bet you use PowerPoint and animations, too.

    10. Re:Bad Ideas by i.r.id10t · · Score: 1

      Not sure about VB6, but I used VB4 and 5 as a "scripting language" on Windows to do stuff to text files. Wrote a few things that basically did file format transformation so other people could do it. I was allowed to install VB/Visual Studio stuff but not anything else extra from the default image. Of course, this was in the late 90s and there wasn't really much else there.

      --
      Don't blame me, I voted for Kodos
    11. 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.
    12. Re:Bad Ideas by DickBreath · · Score: 1

      A problem I had to unfurl
      My stomach it started to curl
      A bad referenced array
      I found to my dismay
      I’m just glad it’s not written in C++

      --

      I'll see your senator, and I'll raise you two judges.
    13. Re:Bad Ideas by ausekilis · · Score: 1

      You forgot Java. Painful to work with (change a page, recompile, redeploy), moderately slow, and hideously bloated (library dependency hell, for a parser?). Yet it seems to be a very capable server side language.

    14. Re:Bad Ideas by mrchaotica · · Score: 1

      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?

      Visual Studio can do it with C#. Its C++ debugger also allows moving the program counter (but not editing), although it can sometimes cause a crash.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    15. Re:Bad Ideas by Anonymous Coward · · Score: 0

      VBA 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.

      There, fixed that for me.

    16. Re:Bad Ideas by Anonymous Coward · · Score: 0

      And python.

    17. Re:Bad Ideas by TangoMargarine · · Score: 1

      And debugging Java programs. You edit and save, the JVM rebuilds the relevant code, then execution jumps back to the top of the method you were paused in. Assuming of course you didn't try to edit anything in too large a scope like declaring new class-level stuff.

      Unfortunately I'm not aware that it's possible to prevent it from jumping back to method start. The nice thing about VS C# is that it works in-place.

      --
      Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
    18. Re:Bad Ideas by JustAnotherOldGuy · · Score: 1

      I bet you use PowerPoint and animations, too.

      I would if it was appropriate.

      --
      Just cruising through this digital world at 33 1/3 rpm...
    19. Re:Bad Ideas by Tablizer · · Score: 1

      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.

      Fire Fighter: "Fires create a lot of havoc for some people, but I love them. Fires have made me boatloads of money and paid for my house. Burn on!"

    20. Re:Bad Ideas by JustAnotherOldGuy · · Score: 1

      Fire Fighter: "Fires create a lot of havoc for some people, but I love them. Fires have made me boatloads of money and paid for my house. Burn on!"

      And....what's your point?

      --
      Just cruising through this digital world at 33 1/3 rpm...
    21. Re:Bad Ideas by Tablizer · · Score: 1

      Make a best guess.

    22. Re:Bad Ideas by JustAnotherOldGuy · · Score: 1

      Make a best guess.

      Was your point that I should invest in firefighters? Become a firefighter? Date a firefighter?

      Or was your point that you were jealous that I've made a shitload of dough with PHP and you haven't?

      --
      Just cruising through this digital world at 33 1/3 rpm...
    23. Re:Bad Ideas by Tablizer · · Score: 1

      My interpretation was that you are saying PHP is "good" because it made you money, NOT because it's a good language/tool. Thus, I used fires and fire-fighting as a sarcastic and exaggerated analogy.

      Microsoft's crappiness is certainly a "jobs program" for techies, but that's not the same as being a good product set.

    24. Re:Bad Ideas by JustAnotherOldGuy · · Score: 1

      My interpretation was that you are saying PHP is "good" because it made you money, NOT because it's a good language/tool.

      Well, you can interpret it however you like. I started off by saying that "PHP is full of warts", but maybe you missed that in your rush to condemn it.

      Regardless, whether it's a "good" language or not, it has made me a ton of money over the years, and in that respect I think it's very good.

      I also happen to think it's a completely serviceable language (albeit with lots of warts), but feel free to disagree as much as you like. The LAMP stack has allowed me to essentially retire very early, and while we argue about whether or not it's a "good" language, it's busy making my house payment. So by all means, feel free to disagree.

      We can even start here: PHP is a terrible, dreadful language with no redeeming qualities, except for thew fact it has allowed me to earn a lot of money and live quite well while breaking no laws and harming no one. But it's a terrible, terrible, AWFUL language and no one should ever use it unless they want to get stuff done and make money. Don't debase yourself and sink to the depths of using PHP unless you want to be like me, living comfortably and having fun, because it's a terrible, terrible language and no one should ever use it. EVER!!!

      Please, dear reader, I beg you- learn a more respectable language like Java or Simpleton or Brainfuck so you can hold your head up high in public, and no one will be able to whisper cruel things like "He uses PHP!" as you zoom by them in your Lexus LX570 or Porsche 911.

      When you hold a party in your lovely home by the water no one will be able to slander you with vicious rumors like "I heard the sick bastard paid for this place by coding in PHP, can you imagine?" O The Shame!

      Okay, your turn to tell me how awful PHP is. :) lol

      --
      Just cruising through this digital world at 33 1/3 rpm...
    25. Re:Bad Ideas by Tablizer · · Score: 1

      You are hopping back and forth between technical issues and personal finance. It's mixing apples and oranges such as to confuse the reader.

      I believe it's best to evaluate a given language/tool's technical merit from it's earning power separately. Perhaps there is a relationship, which would make an interesting discussion if enough details were given.

    26. Re:Bad Ideas by JustAnotherOldGuy · · Score: 1

      You are hopping back and forth between technical issues and personal finance.

      In this case they're inextricably linked. :)

      If PHP was so awful that I wasn't able to use it to make money, then I'd say you have a point and I should learn another language. But that's not the case.

      To be clear, I like PHP. I like it a lot in spite of its quirks and warts and whatever. (I felt the same way about my old 2005 Jeep, but I still drove it for years.)

      So yes, I know lots of people hate PHP, and I really don't care; the fact that some people hate it doesn't keep me awake at night.

      I find it to be an easy language to work with and one that lets me get the job done. It has its shortcomings but then so does every language. End of story.

      Feel free to tell me how awful it is, but honestly, I don't really care. It works perfectly well for what I need to do and that's the bottom line for me.

      --
      Just cruising through this digital world at 33 1/3 rpm...
  13. 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.

    1. Re:Using !important in css by Anonymous Coward · · Score: 0

      dafuq, I didn't know this existed! Thankyou

    2. Re:Using !important in css by Anonymous Coward · · Score: 0

      lol I wonder what else we don't know.

  14. Skipping unit tests by bi$hop · · Score: 1

    Sometimes unit tests can be extremely helpful. Other times they're a waste of time and provide little to no benefitâ"like when you're only writing them because somebody wants 100% code coverage.

    1. Re:Skipping unit tests by Anonymous Coward · · Score: 0

      I hate writing unit tests. Especially for work because I work in a dynamic language. It's just spending hours of time writing boilerplate tests that a real static language and compiler would check for you anyways.

    2. Re:Skipping unit tests by dmbasso · · Score: 1

      You only realize their benefit when later on you change something you thought completely unrelated, and the "useless" tests start failing. I had my ass saved a couple of times in situations like that.

      --
      `echo $[0x853204FA81]|tr 0-9 ionbsdeaml`@gmail.com
    3. Re:Skipping unit tests by Anonymous Coward · · Score: 0

      Ever found a use for things like

      Foo o = new Foo;

      o.setBar(5);

      TestEqual(o.getBar(), 5);

      ?

    4. 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.

    5. Re:Skipping unit tests by Anonymous Coward · · Score: 0

      i regularly write stupid tests and regularly find stupid bugs.

    6. Re:Skipping unit tests by Anonymous Coward · · Score: 0

      The whole thing is particularly funny if your company has code in a static and a dynamic language (say, C++ and Python).

      You write these simple tests in Python, mock some obvious functions you don't feel like setting up, and call it a day. 100% coverage.

      In C++, you get the same level of confidence just by compiling the code. But it doesn't count as coverage. So now you end up writing a bunch of code to set up your unit tests until you get the coverage you need, except maybe one branch for an unusual error check that you can't manually set up because it's just to handle a rare threading issue. Call it a day (or two). 80% coverage.

      In the end, the C++ code is more tested simply by compiling, the unit tests are even more thorough, but your metrics show differently and your team looks bad. Should've stuck with Python?

  15. FORTRAN 77 by stoicio · · Score: 2

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

    enough said.

    1. Re:FORTRAN 77 by Anonymous Coward · · Score: 0

      Both are ubiquitous in my field (Matlab in particular), and both should have been strangled at birth (Matlab in particular).

      But yeah, I use 'em too. Just remember though: for big stuff and when you want to break out of the straight-jacket for a while, mex is your friend.

    2. Re:FORTRAN 77 by Z00L00K · · Score: 1

      Fortran 77 has some good sides too, but it's from an age where a lot of the paradigms we follow today weren't invented yet.

      What's worse than Matlab - Simulink.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    3. Re:FORTRAN 77 by Anonymous Coward · · Score: 0

      Apparently you can now push your Matlab code to be executed in your GPU. That has to be one of the easiest way to take advantage of it.

    4. Re:FORTRAN 77 by daedalus2097 · · Score: 1

      I genuinely still get scary flashbacks when I see someone mention Matlab anywhere. *shudder*

    5. Re:FORTRAN 77 by mrchaotica · · Score: 1

      Why? Matlab (or better yet, GNU Octave) can be a reasonable choice if (and only if) your program is made almost entirely out of matrix manipulation.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  16. 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.

    1. Re:Working 80+ hour weeks by dwpro · · Score: 1

      Until you get sick or hit by a bus or, god forbid, take a vacation. My commute would be more gas efficient if I had precisely the amount of gas I needed to get to work and back, but not allocating for unexpected outages is living dangerously.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    2. Re:Working 80+ hour weeks by TangoMargarine · · Score: 1

      My commute would be more gas efficient if I had precisely the amount of gas I needed to get to work and back

      How is that?

      --
      Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
    3. Re:Working 80+ hour weeks by dwpro · · Score: 1

      The weight of fuel affects mileage, so you might get 1% better fuel economy if you're running with an extra 10 gallons of fuel that you don't absolutely need.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
  17. Gotos by Anonymous Coward · · Score: 0

    You've been there: You have a loop with a conditional. You need to work out if the loop ever took the conditional while(X) if (Y) Z; if (Z not executed) then ... . So you have to set a boolean flag and test it when you break out. It's really clumsy. Python has a nice feature for this, a while ... else , which I haven't seen other languages. Until others do it, a goto is hardly beautiful but less clumsy.

    1. Re:Gotos by Anonymous Coward · · Score: 0

      Is that like writing break; in C? If (some condition or other) break;

    2. Re:Gotos by Anonymous Coward · · Score: 0

      Nah. Different from break. "Uniquely, Python allows you to add an else clause onto the end of a while loop. Why? So that you can define a block of code that's to be run upon an exit from the loop caused by the loop's condition becoming false, but that's to be skipped over if the loop exits through a break statement or because of an exception. " http://www.wellho.net/solution...`

      Python supports to have an else statement associated with a loop statement. * If the else statement is used with a for loop, the else statement is executed when the loop has exhausted iterating the list. * If the else statement is used with a while loop, the else statement is executed when the condition becomes false.
      count = 0
      while count print count, " is less than 5"
      count = count + 1
      else:
      print count, " is not less than 5"

    3. Re:Gotos by Anonymous Coward · · Score: 0

      er, I think your example is bugged...

  18. 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
    1. Re:hierarchical filesystems by dwpro · · Score: 1

      Not to mention this 'database abstraction' lacks most of what makes a database:useful: enforced:types, uniqueness, referential integrity, joins.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    2. Re:hierarchical filesystems by angel'o'sphere · · Score: 1

      but using a filesystem to access data is really fraught with peril.
      Why?

      I consider it abuse of a DB if stuff that can be stored in files is put into data bases.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:hierarchical filesystems by angel'o'sphere · · Score: 1

      If you put something into a file, you obviously know you won't need: enforced types, uniqueness, referential integrity, joins

      Or how exactly do you want to join two *.jpg's ?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:hierarchical filesystems by AmiMoJo · · Score: 1

      Filesystems are popular because they are low overhead for the user. Everything else requires more work to maintain or locate the file you want. Most systems have offered metadata search for years but it's rarely used in preference of the traditional file/folder structure.

      Phones are an interesting example of trying to do away with the filesystem. For example, both Android and iOS default to sorting and presenting photos by metadata. iTunes does it for music too. It kinda works okay most of the time, but occasionally fails spectacularly like when iTunes deletes your personally created music library or live recordings that it thinks are identical to the cloud album rip version.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    5. Re:hierarchical filesystems by dwpro · · Score: 1

      OP mentioned using a file system/folder structure as a 'database abstraction', and  I listed some of the benefits of a database that you don't get in the abstraction.  I guess I'll describe them in more detail as I must not have been clear.  Of course it would be handy to say no log files in the image folder, enforce not having multiple copies of the same file type, don't delete the file but not the metadata, get all the *.jpgs, from two projects, etc.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    6. Re:hierarchical filesystems by angel'o'sphere · · Score: 1

      And how would a database help in that case?

      My point is: it does not.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    7. Re:hierarchical filesystems by Anonymous Coward · · Score: 0

      My first quick read of that was that "using a filesystem to access data is really fraught with Perl"...

    8. Re:hierarchical filesystems by DidgetMaster · · Score: 1

      File systems were designed long before 'big data' was around. When I bought my first 10 MEGAbyte hard drive back in 1985, it would only hold a couple hundred small files (by today's standards) before it was full. Today you can get more than 10 million files in your volume before it is full. Try finding all your .JPG files when you have to search through that many. It takes forever. That is why I am building a 'file system replacement' that changes the whole hierarchical model and large metadata records that make finding things slow. I can put the equivalent of 200 million files in it and find sets of files (e.g. all my documents) in just a couple of seconds (without needing to spend hours 'indexing' all the metadata into a separate database).

    9. Re:hierarchical filesystems by Anonymous Coward · · Score: 0

      Or how exactly do you want to join two *.jpg's

      SELECT * FROM /pr0n WHERE filename LIKE @fetish1 AND filename LIKE @fetish2 AND filetype = '.jpg'

    10. Re:hierarchical filesystems by Tablizer · · Score: 1

      I believe we need something that's a combination of file system and database. I've kicked around ideas for such. Generally we need hierarchies for "regular" people to relate to stuff, but sometimes we need a database-like layer or activity on files.

      I've kicked around the idea of using Extended File Attributes, along with "dynamic relational". Basically you'd define the file path as a virtual table, then query that table using a dynamic version of SQL. Pseudo-code:

      define table foo
      /networkX/zib/flahg/*.pdf
      /networkY/gerf/*.*
      end define
      begin query fliggo
        SELECT * FROM foo
        WHERE filename LIKE "library%"
        AND modify_author IN ('Bob','Martha','Suzan')
      end query
      DISPLAY filename, modify_date, path
        FROM fliggo

      (Slashdot messes up my indents.)

  19. PHP by Anonymous Coward · · Score: 0

    It works.

    1. Re:PHP by hcs_$reboot · · Score: 1

      It (may) work.

      ftfy

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    2. Re:PHP by daedalus2097 · · Score: 1

      Yes. So much this.

    3. Re:PHP by Big+Hairy+Ian · · Score: 1

      You think PHP is crap? Try M$'s half ass'd ripoff of it it's called ASP

      --

      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.

    4. Re:PHP by Anonymous Coward · · Score: 0

      Now it's called C# + MVC and it's so awful it works.

    5. Re:PHP by EmperorOfCanada · · Score: 1

      I dipped my dick into that and it fell off. It was like they took the worst of VB (good in its own way) and the worst from PHP and then somehow sold it to people who somehow became convinced that because it was MS that it was the one true way to make dynamic web sites.

    6. Re:PHP by Big+Hairy+Ian · · Score: 1

      C# is M$ clone of Java and MVC was created by Xerox/Smalltalk in the 70's

      --

      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.

  20. 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.

    1. Re:enum values by nonsequitor · · Score: 1

      That's the purpose of an enumeration, to assign a value to a label. If you're doing compares of an integer literal (hard coded magic numbers) to an enumeration, there's room for cleanup without increasing complexity, but variable to enum constant comparisons are a good practice.

    2. Re:enum values by Anonymous Coward · · Score: 0

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

      It's fine if you document with enumerations, for example:

      • Clear = 0
      • Red = 1
      • Blue = 2
      • Purple = 3
      • Green = 4
      • Yellow = 5
      • Teal = 6
      • White = 7
    3. Re:enum values by Anonymous Coward · · Score: 0

      Relying on enums to be particular values is an excellent technique for making it easy to use the correct particular value.

      This is frequently the case when interfacing to hardware.

      What is to be avoided is situations where this becomes an appropriate technique, i.e avoid situations where only a few particular values are legal.

    4. Re:enum values by Anonymous Coward · · Score: 0

      Sounds much like magic numbers, but with constants. So, magic constants? That is absolutely terrifying.

  21. Exceptions by fozzy1015 · · Score: 1

    Throwing an exception with a completely empty catch block.

    1. Re:Exceptions by Z00L00K · · Score: 1

      Add a comment and it isn't empty.

      In some solutions it's a lot better that the applications continues to run than that it fails on an exception and the application has to be restarted. Especially when you work with systems where downtime is a big problem then you better catch problems and log them but then continue execution.

      A horrible practice in C# is that exceptions aren't declared by the methods that throws them, so never know when to expect them without reading the documentation. You can of course do a general catch-all catch statement in strategic places but it don't really make for a good application.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    2. Re:Exceptions by Anonymous Coward · · Score: 0

      modern GOTO

    3. Re:Exceptions by Anonymous Coward · · Score: 0

      And what does

              void GraphTraverse(Action nodeHandler, T baton);

      throw?

  22. 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.

    3. Re:Put the business logic in the database by Anonymous Coward · · Score: 0

      >ftfy, make more sense now? Not everybody delivers (or stays) on the same RDBMS all the time.

      Actually, you know the number of times in my career any existing project has switched databases? Zero times.

      The actually important thing for businesses is the payload data in the database. The programs don't matter much. *They* can be replaced.

      >Not to mention how miserable it is to debug programs that live half in the middle tier and half in triggers.

      The entire data and validation stuff should be in the database. It's not a key-value store and it's not the 60's.

      If you insist on doing the complicated thing then look up distributed transactions. Not using them? Your program is unsafe.

    4. Re:Put the business logic in the database by GodelEscherBlecch · · Score: 1

      Actually, you know the number of times in my career any existing project has switched databases? Zero times.

      That's funny, because I deliver the same platform to different customer sites on Oracle, SQL Server, Postgres and sometimes even HSQLDB. Here we go again with the 'I've never needed it so it's dumb and useless' routine.

      The actually important thing for businesses is the payload data in the database.

      No, the important thing for businesses is whatever the important thing is for that business. Sometimes that is consistency of internal IT infrastructure and wanting to colocate applications in their existing RDBMS platform.

      The entire data and validation stuff should be in the database. It's not a key-value store and it's not the 60's.

      I can't even parse that sentence in such a way that it would constitute an argument. You've never written code that needed to be portable and/or unit testable independent of an external RDBMS - good for you I guess?

      If you insist on doing the complicated thing then look up distributed transactions.

      I use them all the time. Not sure what it has to do with the topic being discussed.

    5. Re:Put the business logic in the database by bad-badtz-maru · · Score: 1

      This is a bad idea because, generally, the database is the most difficult and most costly layer to scale. Like one of the downstream comments said, data and validation, yes. But the CPU cycles spent on general business logic are better placed on a higher layer.

    6. Re:Put the business logic in the database by tsm1mt · · Score: 1

      That's funny, because I deliver the same platform to different customer sites on Oracle, SQL Server, Postgres and sometimes even HSQLDB. Here we go again with the 'I've never needed it so it's dumb and useless' routine.

      1) We love Oracle's DB.
      2) We hate dealing with Oracle, let's go to IBM DB2
      3) We love IBM DB2
      4) We hate dealing with IBM, let's go to MySQL
      5) Wait, Oracle bought MySQL, and we hate dealing with Oracle.See 2
      6) OK, let's try PosgreSQL then, it's the only database with a vendor we don't dislike doing business with.

      7) Goto 1

    7. Re:Put the business logic in the database by GodelEscherBlecch · · Score: 1

      Don't read too well, huh? We never chose a DB to begin with, and never will. We deliver to customers who already have their own RDBMSs of various flavors, and we can do so freely because we kept the business logic in the middle tier, where there is not one single line of code that knows anything about which RDBMS platform it is talking to. This is also why I am having a ball right now seeing how blindingly fast it goes running against Cassandra. But yeah, everybody have fun re/writing all your procedural DB cruft.

    8. Re:Put the business logic in the database by gfody · · Score: 1

      Well they asked for "bad ideas that work" - it's bad for all the reasons we know but it sure does work, except for when it doesn't. If you are already locked in to a SQL Server or something then taking advantage of its modern features and tooling can be a real productivity boost over say writing lots and lots of plumbing code just to avoid having your "business logic in the database".

      --

      bite my glorious golden ass.
    9. Re:Put the business logic in the database by bad-badtz-maru · · Score: 1

      I see what you mean. I think it's just too close to home for me, seeing the downside to it. Most recently it was legacy SQL Server SSIS code that called a web service. The web service added a new requirement for a SOAP Signature. The signature hash method is only supported in .NET 4.5 or 4.6 (don't recall which( but SSIS doesn't support any version above 4.0 . Then, on the linux side of things, I also have a team that loves to write their business logic in Postgresql's PG/PLSQL versus on their C# layer.. PG/PLSQL is fairly primitive and they're calling web services and TCP socket servers from inside it. The resultant code is verbose and difficult to follow. Plus it has no capability to run on anything other than a single core.

    10. Re:Put the business logic in the database by gfody · · Score: 1

      I would tend to draw the line at making webservice calls.. that almost never works well from the database. I say almost 'cause I'm guilty of doing it from a service broker queue. I'm not proud of it, however.

      --

      bite my glorious golden ass.
    11. Re: Put the business logic in the database by tsm1mt · · Score: 1

      I read as well as you do. I was supporting your argument that putting logic in the database is a generally poor choice. Even if you don't deliver to multiple targets initially, you will eventually deal with a customer's falling out with a given DB vendor and have to make the change.

    12. Re: Put the business logic in the database by GodelEscherBlecch · · Score: 1

      Oops - thought you were mocking the very idea of wanting to switch in the first place. Good afternoon, my own petard.

  23. Non-standard formatting by Anonymous Coward · · Score: 0

    Sometimes I tell "standard" code formatting to take a hike and do things like:

    switch ( something )
    {
          case 1: { blah; break; }
          case 2: { bleh; break; } ....
    }

    Not often, but on occasion if you have to deal with a whole bunch of cases and don't want your code spread over 20 screens it's good to condense and align instead.

    1. Re:Non-standard formatting by Anonymous Coward · · Score: 0

      That sucks for inline debugging, and if your case statement is spread over 20 screens, you're doing it wrong: trying to squeeze it all onto one isn't going to save bad code.

    2. Re:Non-standard formatting by glenebob · · Score: 1

      I do that fairly often, but like:

      case 1: return blah;
      case 2: return blah * 2;
      default: throw up;

      Putting two statements on one line really is a bad idea.

    3. Re:Non-standard formatting by Z00L00K · · Score: 1

      It usually is a bad idea, but it depends on the case.

      In this case I don't see the need to break down on separate lines. But otherwise I agree that breaking down to separate lines is good.

      switch ( something )
      {
                  case 1: { a=4; break; }
                  case 2: { a=5; break; }
                  case 3: { a=0; break; }
                  default: { a=1; break; }
      }

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    4. Re:Non-standard formatting by Anonymous Coward · · Score: 0

      a = (something==1) ? 4 : (something==2) ? 5 : (something==3) ? 0 : 1;

    5. Re:Non-standard formatting by glenebob · · Score: 1

      I'd put that in its own function, and write it:

      case 1: return 4;
      case 2: return 5; ...

      1) Only one statement per line,
      2) The function can be named to make the code more readable in lieu of a comment explaining the switch..

    6. Re:Non-standard formatting by glenebob · · Score: 1

      Can I see you in my office please? :p

  24. 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 Anonymous Coward · · Score: 0

      And we have a winner. You have managed to explain the OOP spaghetti mess that has infected everything better than anyone else.

    3. 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.

    4. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      I'd go so far as to say that excessive OOP is *harder* to maintain than spaghetti code. With spaghetti code you just have to work your way through it to see what it does - it takes time, it can be tedious, but it's really not that hard. Code that over-uses and abuses OOP, on the other hand, is a living, breathing nightmare. It's a square peg jack-hammered into a round hole, and about as easy to take apart for repair.

    5. 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.

    6. Re:Shying away from OOP(s) by TranquilVoid · · Score: 1

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

      In some ways it is the opposite - OOP principles are designed to make software more closely resemble the user or business model, on the assumption that future changes will be easier and more natural.

      I do get what you mean about the way we think. OOP can invert our procedural tendencies. Event-driven programming can similarly be a nightmare to debug or piece together as a whole.

    7. 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...
    8. 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.

    9. 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?
    10. 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.

    11. Re:Shying away from OOP(s) by Darinbob · · Score: 1

      You code needs more FunctorFactoryGenerators.

    12. 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.
    13. Re:Shying away from OOP(s) by GodelEscherBlecch · · Score: 1

      I think maybe you are not clear on the meaning of 'spaghetti' vis a vis code.

    14. 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).

    15. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      This guy sounds like an unintentional parody of himself.

    16. Re:Shying away from OOP(s) by Shados · · Score: 1

      proving my point: how people beleive they think, not how they do.

    17. Re:Shying away from OOP(s) by HornWumpus · · Score: 1

      The correct disparaging term for an OO mess is 'Object onion'.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    18. Re:Shying away from OOP(s) by AuMatar · · Score: 1, Insightful

      Oh, got it. You're one of those people who just want to hear themselves talk and try to get the last word in rather than actually discuss things. I'll go back to ignoring you.

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

      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.

      Alex, is that you?

    20. Re:Shying away from OOP(s) by Dutch+Gun · · Score: 1

      Using whiz-bang features sparingly is, in my opinion, one of the cornerstones of working in C++ and not shooting your own foot off with over-complexity.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    21. Re:Shying away from OOP(s) by AuMatar · · Score: 1

      Back in the 90s and early 2000s operator overloading was thought of as really cool and was used in all sort of horrible ways. Some of that even slipped into the standard library with the > overloading the traditional bit shift and meaning output. Nobody really has a problem with using it for math, but it was way too frequently used for evil. The set of problems it logically helps on is so small it probably wasn't a net gain.

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

      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.

      Ruby.

      Not for beginners though, and hard to maintain across teams (no compile-time typechecking and such "overhead"). Very nice syntax and reflective OO plus some lambda paradigms though.

    23. 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
    24. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      You need to start with FunctorFactoryGeneratorsInterface and FunctorFactoryGeneratorsAbstract though. It'll be a blast!

    25. 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.

    26. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      You want to cage a lion - use functional programming. You want to build a lion cage - use OOP.
      That's the best explanation I read somewhere. If yoo have a somewhat difficult, well defined problem which depends strongly on the properties of a very specific object, functional programming usually works best. If you have a rather vague problem where boundaries constantly shift, OOP is usually better.

      If you cage a lion, everyone knows what you are hunting. If you build a lion cage, there are many more factors at play, non the least that you may end up housing a giraffe.

    27. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      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.

      Well if the goal is fewer lines of code, the quit measuring programmer performance in LINES OF CODE.

      I know plenty of people that can churn out 1-2k lines of debugged code a day ... problem 1990 lines of it are unnecessary, if the problem have been properly designed.

    28. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      OOP is fine, it's just far too many people don't know what it actually is supposed to mean even though they think they do. OOP wasn't designed to make software closely resemble the user, business model, or because it's how we see the world. That's just what's told to novice programmers before they learn more advanced concepts (then they splatter that all over the web and people start to believe it since the real things get drowned out). OOP is currently about turning everything into reusable, plug-able modules without needing to constantly repeat yourself. Your panel widget doesn't need to be modified every time you want to display something new because that new object will know how it's supposed to be drawn. That widget can display anything that's Displayable. There's no need to create WeatherWidget, ClockWidget, BatteryWidget, etc... Your Clock class will be self-contained and portable to other programs (yeah right).

      We currently apply OOP to the code 'layer'. When it was first thought up, OOP was applied to the application layer. Applications were supposed to be self-contained objects that knew how to operate on themselves and with others. In the original OOP world you didn't just send someone a Word document, that Word document would actually be the entire Word application. There would be no version incompatibilities because every document is also its full, self-contained reader. There would have been no codec packs as every video or audio file would come with its own player. A computing industry built on that would have been awesome, unfortunately its a lot harder to sell software in such a world.

    29. Re:Shying away from OOP(s) by Z00L00K · · Score: 1

      Most cases where OOP is used and failed is caused by not understanding the complete solution and a correct break-down of the "problem".

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    30. 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.

    31. Re:Shying away from OOP(s) by johannesg · · Score: 1

      It most certainly was a net gain. Maybe not in the software that you write, but when you do any kind of work with non-standard math types (vectors, matrices, complex numbers, bigints, etc.) then they are phenomenally helpful to readability.

    32. 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.

    33. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      You are quite mistaken:
      Java - lamdas
      Groovy - Closures
      Scala - higher order functions

      modern C++ - lambdas and operator() overloading
      older C++ - operator() overloading

      (yes, lambdas, closures, and overloaded () are not the same things or the same thing as a higher order function ...)

      I use the STL since its inception, if you don't use it with lambdas or Functor objects that define/overload operator(), you have not grasped the concept.

      Same for one of the parents who 'hates OOP'.

      If you hate it, you have not grasped it, plain and simple.

      The difference between a plain procedural program and the same thing as a class is three lines of code:

      1) class FancyName { // at the top of the code
      2) new FancyName().callToMain(args); // at an appropriated place
      3) }; // at the end, in Java/C# you not even need the ';'

      Granted, in C++ you need a header and #include it somewhere and prefix all method implementations with ClassName:: but bottom line there is no single real world example where a 'non OO' aka procedural implementation of any thinkable problem is shorter (except the 4 lines above, a header and an #include) than the equivalent OO solution.

      If you think otherwise you simply are an idiot who has no clue about what he is talking. On the other hand, OO done properly usually reduces program sizes. As you can put logic at the point where objects are instantiated and execute the relevant behaviour in a virtual method instead of cluttering if cascades to handle your data all over your algorithms.

      There are two ways of teaching/introducing OOP:
      a) define a struct and put the functions that work on such structs as methods into the struct - straight forward, but fails to explain the point
      b) write an ordinary C program and when finished add the three lines ( 1) - 3) ) above at the right places. Wow, you transformed a program into an object, now you can have plenty of them instantiated in other programs, reuse them, form abstractions, compose them - thats the point.

      Bottom line a) and b) are equivalent of course. But for the mind they are not.

      If you can not work with OOP and/functional concepts, your mind is stuck in simple thinking, you only get around that by actually using the stuff you hate.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    34. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      C++ and Java settled this issue - writing any vaguely mathematical code in Java is very, very painful, precisely because it got rid of operator overloading. You also get stupid rules like having to call "x".Equals("y") because == basically does pointer comparisons by default.

      Besides, these days, C++ isn't even the worst abuser, not by a long shot. At least it restricts the set of operators to things that you encounter all the time (even if it does allow overloading stupid stuff like operator|| and operator&&). Try Scala and Haskell, where there are no restrictions on what sort of crazy operators you can write...

    35. 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
    36. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      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.
      Same for me. No idea where this Myth is coming from.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    37. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      Some of us are old enough to could have gone through a generation of "overload everything" which was a disaster. FTFY.
      As the parent said:
      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.
      And none of the /. -ers complaining about operator overloading during the last 12 - 15 years ever managed to give an example about "operator overloading abuse".

      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).
      And why is that relevant? If you write a program so simple that it only needs one function and one variable, chose C and be done with it ... or as a mental gymnastics write it in assembler or brainfuck right away ... sigh, what stupid arguments.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    38. Re:Shying away from OOP(s) by stdarg · · Score: 1

      The myth comes from cout "Hello World!"; and C programmers wondering what the fuck have they done to the bit shift operator. If unnecessary operator overloading is used in the most basic of samples it sends a bad message I guess.

    39. Re:Shying away from OOP(s) by pla · · Score: 1

      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.

      "You are the team lead, a largely honorary title that effectively says you get all the blame if this project fails, with nothing but a title to show for it. Most notably, you neither determine my raises, nor have the power to fire or otherwise punish me in any way. If you want to use that role to pretend this is a OOD-201 class at the local university, have fun. If you need me, I'll be over there actually writing the code our employer pays us to produce - And going forward, all my classes will all be named after sitcom characters."

    40. Re:Shying away from OOP(s) by AuMatar · · Score: 1

      Except those are such a tiny fraction of the things anyone programs. I'm totally ok with all of those uses you mentioned, but the number of time I've seen them abused to be clever far outweigh the number of times I saw them used appropriately.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    41. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      Well,

      I actually liked the left shift and right shift operators overloaded like that immediately.

      As we are out of an "int context", who cares? And build in operators for build in types can not be redefined/overloaded, so gain: who cares?

      But you have a point, never thought about that example :D

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    42. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      Heck in Java you can't even have a variable or a function living on its own.

      Just make everything public static or just public and Java classes become nothing more than a mix of fancy structs and namespaces/headers.

    43. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      I completely agree with this. OOP is great when there are relatively few classes and the classes are big things. Your objects should be at a high level: clock, calendar, odometer, etc, not gears, springs, and sprockets. I have suffered too many times at the hands of a factoring junkie.

      And if it takes me a week to understand WTF a particular design pattern is good for or how it works, its not worth the it (e.g. visitor pattern - I'll take a little bit of pollution thank you very much).

    44. Re:Shying away from OOP(s) by GodelEscherBlecch · · Score: 1
      Well put, and hits on why I like doing OO design. More than any other style of programming it feels like creating proofs in a system of formal reasoning, and consequently gives a lot more ongoing feedback as to the sound-ness of your design when those proofs are validated. It also points out how flawed your thinking is when it cannot be made consistent within the rules of the system. I feel like this is why so many people hate OO actually - I see a lot of devs get whiny because they think 'anything that works is OK'. May be fine for small, isolated projects, but when you are dealing with a whole ecosystem of re-usable modules that can be recombined in any number of ways, internal consistency is just as important as 'my concrete thingy passes the unit test'.

      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.

      "Asshole" I think is the word the sales guys and junior devs have in mind, but somebody's gotta do it.

    45. Re:Shying away from OOP(s) by Alomex · · Score: 1

      And none of the /. -ers complaining about operator overloading during the last 12 - 15 years ever managed to give an example about "operator overloading abuse".

      They are now very rare, since people have learned to use them properly but there are still examples around of idiotic overloading of an operator in ways that are completely non-intuitive. The best example is the overloading in C++ of bit shift to do I/O.

      In the 80s and 90s operator overloading was considered cool and people would implement the most absurd interactions between two objects as overloading of "+". A rather common one was "+" overloading that had side-effects on the parameters, i.e. a+b would result in changes to a, often because what they really wanted to overload was "+=", i.e. a+=b; in which case the side effect on a is obvious and natural.

    46. Re:Shying away from OOP(s) by ADRA · · Score: 1

      "The goal should always be to produce less code"
      By your bar, Perl is probably the best language. It isn't (inherently). The best code is something that can meet present and future requirements allowing for the least amount of work to produce / maintain. For a one man shop working in their basement, that could be one huge file with literally every piece of code/data in it, but its unlikely to scale well with a big team of people all constantly making updates. That's where pattens, abstractions, API's, etc.. start to become not just mandatory but essential for optimal productivity.

      --
      Bye!
    47. Re:Shying away from OOP(s) by phantomfive · · Score: 1

      It was heavily promoted for a while in the 90s. cout is a prime example.

      --
      "First they came for the slanderers and i said nothing."
    48. Re:Shying away from OOP(s) by HornWumpus · · Score: 1

      'Well factored' is, to an extent, a matter of opinion.

      I tend to favor more complex key objects, with methods that look like procedural code. Others seem to like no methods with more than 4 lines.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    49. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      You're both idiots.

    50. Re:Shying away from OOP(s) by narcc · · Score: 1

      If you hate it, you have not grasped it, plain and simple.

      Yeah, here's the problem. You and everyone else already things they understand OOP and that everyone else just has it wrong. The believers will insist that any OOP failure is a failure to truly understand OOP.

      The truth, of course, is that no one understands OOP because no one can agree on what constitutes OOP. The Smalltalk folks will complain about how Java and C++ got it all wrong and ruined a good thing. The Java gurus will say that they've got the one true OO language. The Self guys will say that everyone else got it wrong from the start and that classes are unnecessary and add needless complexity. Converts still using C will argue that it's not the language, but how you use it that makes something OO.

      You use a simple example to sell us on OOP. Others claim that simple examples are what lead to the masses misunderstanding the true power of OOP and that you don't really see the benefits until you're working on a very large application.

      The design patterns zealots will tell you that it's the first step toward true software engineering. The rest will counter that design patterns are just complicated ways to work around the flaws in C++ and Java or that patterns are just missing language features. Others will claim that they can be helpful, but that their overuse has caused nothing but harm.

      Favor inheritance or composition over the other? Always use accessor methods or are they unnecessary redundancy/overhead sometimes? Was multiple inheritance a mistake, and Java got it right with single inheritance? Is inheritance a mistake entirely as it can break encapsulation, or is that an unfounded criticism?

      If you can not work with OOP and/functional concepts, your mind is stuck in simple thinking, you only get around that by actually using the stuff you hate.

      A lot of people hate OOP because they've used it for decades, seen the OOD fads come and go, best practices turn in to dangerous pitfalls, and other ridiculous industry trends. Now, rather than selling us on the solution that will allow us to finally reap the benefits we were promised by OOP salesman, they're selling us solutions to help us clean up the mess OOP left on the rug.

      Just one more example: You've not see spaghetti until you've seen a dependency diagram on any moderately large OO project. Enter dependency injection, the solution to the problem caused by various OO fads. If you're sold on DI, or one specific framework, you'll say that it's not only necessary, but we should have been doing this all along. If you're sold on OOP and skeptical of DI, you say that DI is only necessary for those that don't understand OOP.

      I can't say that I blame the anti-OOP crew. I just might be one myself. I say "might" as it really depends on what variant of OOP you've got in mind. Not that that's easy, as I don't think any one developer has a single coherent vision in mind. I suspect that if I asked 10 developers, I'd get 12+ answers.

    51. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      The Zen of Python, by Tim Peters

      Beautiful is better than ugly.
      Explicit is better than implicit.
      Simple is better than complex.
      Complex is better than complicated.
      Flat is better than nested.
      Sparse is better than dense.
      Readability counts.
      Special cases aren't special enough to break the rules.
      Although practicality beats purity.
      Errors should never pass silently.
      Unless explicitly silenced.
      In the face of ambiguity, refuse the temptation to guess.
      There should be one-- and preferably only one --obvious way to do it.
      Although that way may not be obvious at first unless you're Dutch.
      Now is better than never.
      Although never is often better than *right* now.
      If the implementation is hard to explain, it's a bad idea.
      If the implementation is easy to explain, it may be a good idea.
      Namespaces are one honking great idea -- let's do more of those!

    52. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      http://xkcd.com/1270/

    53. Re:Shying away from OOP(s) by dgatwood · · Score: 1

      Perl doesn't typically involve less code compared with using similar techniques in another language languages. Overuse of regular expressions can lead to less code that's less maintainable, but that's the exception that proves the rule. And really, the only thing Perl does differently from other languages is to hide the tens of thousands of lines of regular expression parsing and interpreting code that are needed to make them useful. The code is still there, making the software utterly huge when you look at the complete picture.

      --

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

    54. Re:Shying away from OOP(s) by johannesg · · Score: 1

      That "tiny fraction" includes pretty much everything with a 3D renderer, i.e. virtually all games, lots of visualisation tools, etc. And do enlighten us on all those abuses; maybe the people I work with are just too smart, but the only uses I've seen in their work or in the open source tools I've examined were by and large responsible.

      Another huge class of useful overloads are those for operator[] (for arrays and array-like things like maps), operator() (for functors, although that role is now taken over by lambdas), and operator-> for smart pointers. All of which I would positively hate to do without. I'll admit to not being fantastically happy about using operator to stream stuff (not that it's a disaster), but being able to manipulate strings with operator+ or operator== is great.

    55. Re:Shying away from OOP(s) by david_thornley · · Score: 1

      The goal should always be to produce less code

      No, it shouldn't. That way lies APL.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    56. Re:Shying away from OOP(s) by david_thornley · · Score: 1

      I've rarely seen overloading used to be clever, and the times I have (or have heard of it) strike me as projects that needed adult supervision. In one case, I couldn't understand how the team ever got shippable code.

      There's a fair amount of overloading in our code, since we use geometrical constructs. Points work better with operator+(), for example.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    57. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      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..."

      Ah... you silly, naive moron. Just because you've had to deal with poorly architected class hierarchies doesn't mean that OOP is bad or that inheritance is bad. It only means that either (a) you have not been exposed to good OOP code or (b) you are not smart enough to comprehend that OOP can be incredibly wonderful.

      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.

      Actually, it is not a terrible idea at all. Just because it doesn't work for you doesn't mean it's bad for everyone. For competent programmers, it's a great thing.

    58. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      You had to work under an idiot once? Welcome to the club, we're called everyone and we meet at the bar.

    59. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      Sorry, your country must be very strange.

      ... You use a simple example to sell us on OOP.
      [...]
      Now, rather than selling us on the solution that will allow us to finally reap the benefits we were promised by OOP salesman, they're selling us solutions to help us clean up the mess OOP left on the rug. [...]

      What "mess" are you talking about?

      And regarding the rest: I have no idea about what you are talking. No one ever "sold" me anything regarding OOP.

      A lot of people hate OOP because they've used it for decades, seen the OOD fads come and go, best practices turn in to dangerous pitfalls, and other ridiculous industry trends.
      I never experienced anything like this and I use OOP since over 20 years ...

      I say "might" as it really depends on what variant of OOP you've got in mind.
      There aren't any "variants" ... at least not in the sense I would understand a variant ... the difference between dynamic and static typing is much huger than the question what small difference you have in inheritance. Now with Scala and Groovy having Mixins and Java having interfaces with default implementations the question about MI is finally settled: developers want "some kind of MI".

      The rests of your points are imho only interesting if you want to talk in an academic way over certain OO languages. Which is fine. Much to many programmers know much to few languages to even grasp your post. Who knows what Self is? Raise hands! I doubt we see more than ten. And SmalTalk might be known more, but likely only as "the guys who invented oop" (which is wrong, but does not matter).

      For my daily work all the points your raise are irrelevant.

      E.g. Inheritance versus Composition ... that depends on situation, obviously. And in dynamic languages (those with an MOP), you can do compositions much easier than in e.g. Java (but well, therefor you have the IDE with its "delegate" and "extract interface" forward engineering and refactorings.

      Same to design patterns ... when the GoF book came out I knew all the patterns already, we just had no names for them. Basically every Application Framework/class library (MacApp, ThinkC, ThinkPascal, Talingent, Bedrock, Et++ etc.) used them all over the place.

      DPs got a bad reputation in some circles because programmers did not adher to the warnings given in the book: don't desperately search for a place to use a DP!

      About DI I have no deep emotions. During the time DI started to gain traction (2001? 2004?) I used "Configuration classes" that configured and wired groups of objects. And when people started to use e.g. Spring for DI I basically stuck to my habit in my own coding and adapted what the team used when I was in a team.

      The only tool doing DI right is google guice ... I probably will try it once, but frankly: I rarely have any situation where DI solves a problem.

      My current hobby project is a HyperCard clone written in Groovy with Groovy as scripting language. I would not know why I should replace any "new" in my code by a magical provided object via DI.

      Just one more example: You've not see spaghetti until you've seen a dependency diagram on any moderately large OO project.
      This is an inherent problem of software development. And not a problem of OO. There is no difference if a C library X calls a function in Y or if an object A has a reference to B and calls a method. Likely you just made a bad example: but examples like that simply instantly trigger the "you have not understood OO" reaction.

      I did some Y2K reengineering. I think biggest program was something like 750k LOC Cobol. I doubt I will ever see a more complex dependency mess in the rest of my life than I have seen there (yes, we had a superb GUI tool that made us graphs about everything).

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    60. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      The best example is the overloading in C++ of bit shift to do I/O.
      Why? This is actually an excellent example for operator overloading done right!

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    61. Re:Shying away from OOP(s) by Alomex · · Score: 1

      In what way is logical bit shifting similar to input or output operation? This is precisely an example of improper operator overloading. There is no way to predict what on a stream does from knowing what does on a set of bits,

      Contrast this with vector arithmetic, where it is rather obvious what vec_1 = vec_2 + vec_3 means. This is proper operator overloading,

      By the way, the fact that is improper overloading is more or less universally acknowledged, this is not something I'm coming up with on my own.

    62. Re:Shying away from OOP(s) by narcc · · Score: 1

      Likely you just made a bad example: but examples like that simply instantly trigger the "you have not understood OO" reaction.

      That's fair. My entire point is that no one understands OOP as the concept is too poorly defined. A lot of people think they understand it, naturally, though you'll find little to no agreement between them.

      As for defenders and detractors: If you're a believer, you can guard against any criticism by simply saying that this or that "isn't really oop" or "they're doing it wrong". If you're a critic, there's nothing you can offer that can't immediately be disregarded. All they can hope to do is tear-down one fad or trend after another, hoping that they won't return with the next generation of OO believers.

      Now with Scala and Groovy having Mixins and Java having interfaces with default implementations the question about MI is finally settled: developers want "some kind of MI".

      That's a fine example. Multiple Inheritance was once thought to be essential. Later, as Java gained popularity, it was regarded as a terrible evil. Now, it's making a comeback. At each step, a lot of developers thought the question was settled. See, what is and is not popularly considered OOP changes from moment to moment.

      What "mess" are you talking about?

      I can't offer any answer that can't immediately be deflected with "That's not really OO" or "That's because they/you don't understand OO". It's too poorly defined a concept. Can you offer a criticism of OOP that can't be deflected in such a way? Can you even find some aspect of OOP that has remained relatively consistent over the past 20 years? Of course not. That's the point.

    63. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      If you can not work with OOP and/functional concepts, your mind is stuck in simple thinking, you only get around that by actually using the stuff you hate.

      Ironic, because OOP used to be touted as being "more natural": it allegedly fit our conceptual high-level view of objects of the real world, including easy-to-digest taxonomies, like "employee" and "contract worker" being a sub-class of "person", and traits of "person" magically trickle down to employee and contract-worker to give us magic re-use. (In practice we need set-based feature selection and trees proved too blunt an instrument.)

      Now it's an esoteric dark art that requires extra discipline like spinach and exercise.

      How about proponents scientifically prove a technique is better rather than just claim it loudly. Objectively measure important, useful, relevant, and wide-ranging factors; and show how the technique improves those factors (better score).

      Without science to check claims, trolls are indistinguishable from Einsteins.

    64. Re:Shying away from OOP(s) by lars_stefan_axelsson · · Score: 1

      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.

      That's not necessarily true in practice. And I've seen it for myself.

      But, and that's a big "but". It's been my observation that functional programming isn't "comfy" the same way that procedural programming is. With procedural languages you get to feel all warm and fuzzy inside when you've solved little problems and hurdles that the paradigm put in your way in the first place, and it feels like you've accomplished something, when you haven't actually move all that much closer to your end objective. With functional programming the easy stuff is so easy that's its over in five minutes and you very soon is exposed to either real computer science problems or the actual problem you're there to solve. There's no twiddling your thumbs while feeling and looking productive.

      It's been my experience that its this effect that makes students and beginners feel like its hard, while in actual (measured) fact, it's easier and leads farther, sooner. But of course the flip side is that it weeds out poor programmers sooner, as they can only survive by only twiddling your thumbs.

      P.S. And note that functional programs as measured at Ericsson tends to be equally shorter. I.e. four to ten times, for the same functionality delivered (with much better non-functionals, i.e. dependency, resilience etc.). And easier to read/maintain as well.

      P.P.S. And also note that Ericsson isn't a zealot about it. There's plenty of e.g. 'C' etc. used as well. No-one is suggesting you should write a device driver in Erlang. But it's delegated to specialist tasks, as a small piece of the larger puzzle and an edge node in the architechture where it can shine, not a complex and centralised part, where it's the wrong tool for the job.

      --
      Stefan Axelsson
    65. Re:Shying away from OOP(s) by lars_stefan_axelsson · · Score: 1

      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.

      Yes! This is the biggest difference I've observed from using functional programming i large scale industry projects. The "easy" stuff is so easy and quickly dealt with that you can't get away with just treading water and doing busy work. You get exposed to the actual problem or a real computer science one much, much sooner. And there you are.

      This is my own personal pet theory of why people find functional programming so "difficult". It doesn't provide you with the nice fuzzy feeling from the hand holding that busy work can provide you. You don't get to catch your breath fiddling with the scaffolding. You have to actually get the house built from the get go. And hiding your incompetence from the rest of the world/team/management is correspondingly more difficult as well.

      And I think that is a large part of why Ericsson found it to be four to ten times a productive, even when using it with programmers with a C/C++ background and only a short conversion course under their belts. With smaller resulting code to boot, and better characteristics in terms of resilience, maintainability etc. (When we did interop tests with other manufacturers it was always us that changed our gear to match their (mis)understanding of the specs. We could have a change finished and rolled out in 30 minutes right there in the test facility, while they would invariably need a couple of hours, at least...)

      --
      Stefan Axelsson
    66. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      In what way is logical bit shifting similar to input or output operation? This is precisely an example of improper operator overloading. There is no way to predict what on a stream does from knowing what does on a set of bits,
      And why should bit shift be relevant?
      Something is shifted to the left, obviously it is not bits.
      If someone coming from C saw

      stream < objcect1 < int2 < "some string";

      and did not grasp immediately what is going on there, he should not be in the programming business.
      After all not far away from "stream" there will be a declaration:

      OutputStream stream;

      And worst case: there is documentation.

      By the way, the fact that is improper overloading is more or less universally acknowledged, this is not something I'm coming up with on my own.
      It isn't. It is a /. myth or perhaps american propaganda. I never saw/met anyone in RL who is against operator overloading or experienced an abuse in that area in his career.

      There is no other operator more suited for input and output than left shift and right shift. Or do you want to += to an output stream and -= from an input stream?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    67. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      Actually I believe OOP is perfectly well defined:
      You have objects, either class based or prototype based, that hold data and the code that works on that data as methods or messages. Such a system should support dynamic dispatched messages/methods and one or more forms of inheritance.

      And all OO languages I'm aware about support the above definition.
      Perhaps there is a better one on Wikipedia?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    68. Re:Shying away from OOP(s) by angel'o'sphere · · Score: 1

      In practice we need set-based feature selection and trees proved too blunt an instrument
      In the late 90s there was an academic idea called "subject oriented" programming.
      The idea was to decompose objects in kind of slices.
      The wish was to have a "Subject" like Person, but have its attributes and methods depending on context. E.g. the date when the Person joined an organization, and the "Rank" or "Level" in it would be mixed in.

      So that you mix several slices together depending on programming task or environment where your application is running.

      No idea what came from it, I guess now as modern languages mostly support MI or mixins, that concept is automatically available and does not need a new name or language support.

      https://en.wikipedia.org/wiki/...

      Oh, I think I have the Hyper/J package still somewhere on a computer in my basement.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    69. Re:Shying away from OOP(s) by Anonymous Coward · · Score: 0

      And why should bit shift be relevant?

      This shows you don't understand proper operator overloading. No wonder you can't find any examples of bad operator overloading since you couldn't recognize one when you see it.

      I never saw/met anyone in RL who is against operator overloading

      James Gosling... does the name ring a bell? Java, have you ever heard of it? Java has no operator overloading, you can read interviews with James where he explains why he didn't allow overloading in Java.

    70. Re:Shying away from OOP(s) by goose-incarnated · · Score: 1

      OOP can invert our procedural tendencies.

      Close. OOP does invert our natural tendencies.

      --
      I'm a minority race. Save your vitriol for white people.
    71. Re:Shying away from OOP(s) by narcc · · Score: 1

      Actually I believe OOP is perfectly well defined:

      A lot of people believe that it is well-defined. The problem, of course, is that none of them agree with one another! Let's take a look at your definition.

      You have objects, either class based or prototype based, that hold data and the code that works on that data as methods or messages.

      You start off by defining objects, though your definition is unusually restrictive. You exclude objects that aren't instances of of class or which have no prototype, or similar structures built in languages which don't feature classes or prototypes. This might have been unintentional on your part. You also exclude objects with only methods and objects which have no methods.

      But we're not talking about objects, we're talking about Object-oriented programming. Moving on...

      Such a system should support dynamic dispatched messages/methods and one or more forms of inheritance.

      "Such a system" indicates that you believe that OOP classifies languages or systems within languages. You'll find that many people disagree with that, and will insist that OOP is an approach to programming not an approach to language design. There are plenty of people who believe they're doing object oriented programming in C.

      To my point: OOP is so poorly defined, people can't even agree on what the term is intended to classify! Never mind the details, does it refer to programming languages or to programs? I've seen arguments for more than the two obvious responses to that question.

      Now we have dynamic dispatch and inheritance. Inheritance is an easy one, as there is no general agreement here. Some go as far as to say that inheritance should never be used. There are also OO languages that do not support inheritance. Go is a nice example as it's fairly new and reasonably well-known.

      I'm not exactly sure why you brought up dynamic dispatch. I don't know that I've seen anyone list it as an essential feature. I've seen people argue for and against polymorphism as an essential feature, though you don't necessarily need dynamic dispatch to achieve that either. (In Rust, for example, dynamic dispatch is the exception, most polymorphism is handled by static dispatch.) I agree that it's useful for implementing common types of object systems, I'm just not sure how it fits in to your definition of OOP.

    72. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      I like the idea of using "Table Oriented Programming" for feature and variation management. For a simplified example, consider this table layout:

      person (table)
      ---------
      personID
      hasFeatureA
      hasFeatureB
      hasFeatureC
      hasFeatureD
      hasFeatureEtc...

      Each person instance (row) then has these Boolean "cells" filled in with Yes or No (or value parameters in some cases).

      (A variation of this is a many-to-many table of "roles" for a given person, which is more flexible because we don't have to add columns for each new feature.)

      This means a person can fulfill any role we have implemented by simply checking a box.

      We don't have to dig around in or reshuffle hierarchies. We don't even have to define hierarchies or taxonomies* up front: we just check-mark the features we want, buffet-style.

      Now, some combinations may not be allowed by law or shop rules, and we can put validation on our table to prevent or flag such combinations, such as a person not allowed to be customer and a vendor at the same time.

      We can also have templates for common patterns so that a feature template can be applied to a given person to save time from manually marking each box.

      And the implementation doesn't clog up our view of the features, for that's elsewhere. It's nice and compact to visually sift.

      In practice it's often not so smooth to do all things this way, but a degree of it can bring about a lot of flexibility and reduce code reshuffling.

      * One might point out that "person" is already declaring a kind of taxonomy. If corporations are later treated like people (SCOTUS-style), then calling it "person" may be a mistake. We can make a single generic object such as "entity" or "party" or something, but often that confuses maintainers in my experience. We sometimes have to force some concreteness into designs so people can relate to it.

    73. Re:Shying away from OOP(s) by narcc · · Score: 1

      Have you run across entity component systems? There seems to be a good bit of similarity.

    74. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      OOP is currently about turning everything into reusable, plug-able modules without needing to constantly repeat yourself.

      Currently? Why did "they" change it?

      It often fails at those goals because real-world variations-on-a-theme often don't fit a nice hierarchical taxonomy. Sure, OOP doesn't have to be tree-shaped, but it gets uglier than the alternatives when it's not.

    75. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      It's been my experience that its this effect that makes students and beginners feel like its hard, while in actual (measured) fact, it's easier and leads farther, sooner. But of course the flip side is that it weeds out poor programmers sooner, as they can only survive by only twiddling your thumbs. P.S. And note that functional programs as measured at Ericsson tends to be equally shorter

      The bottleneck of most software is maintenance, not the original writing. It might be less code, but can future maintainers, who may not have been part of the original team, read it, understand it, and be able to change it in a timely and safe manner?

    76. Re:Shying away from OOP(s) by lars_stefan_axelsson · · Score: 1

      Well, it's Ericsson we're talking about here. Still running plenty of thirty year old code. So "we" know a thing or two about that particular problem.

      It's was my experience when I was there for seven years, and six major releases of successively larger and more feature-full products, that maintainability was higher than could be expected. And that's even when we had code from another team (100+) in another country basically just dumped in our basement. (The other site was closed down).

      And like I said in another comment, when it came time to interop tests, we were the one that changed our behaviour to work around bugs in other manufacturers equipment. We were much more nimble than they were. Much of the credit goes to the programming environment there as well.

      --
      Stefan Axelsson
    77. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      Another problem is that "method" and "message" are not well-defined (or consistently defined among proponents).

      In many cases one has to first define "object" before "method" is defined, and method is part of one's definition of object. Thus, it's a circular definition.

      (I suppose circular definitions are not necessarily wrong or erroneous, as one may define recursion as "something that uses recursion". But it will confuse the daylights out of a lot of people.)

    78. Re:Shying away from OOP(s) by Tablizer · · Score: 1

      May be fine for small, isolated projects, but when you are dealing with a whole ecosystem of re-usable modules that can be recombined in any number of ways, internal consistency is just as important as 'my concrete thingy passes the unit test'.

      From their perspective you may be creating an e-bureaucracy that only you or a handful of architects fully understand. It gives you the sense of power but slows them down because they can't grasp your "ecosystem" or libraries quickly.

      And when they complain you perhaps tell them "be smarter and spend more time learning them, or quit so we can hire faster library grokkers".

      That's how communism (or extreme socialism) viewed economic systems: factor everything into as few parts as possible (parsimony) for efficiency and consistency. You don't need 5 brands of peanut-butter like those market nations have.

      It sounded wonderful on paper, but did poorly in practice (except for the top-level bureaucrats).

      Sometimes reinventing the wheel is more efficient for humans than grokking and managing a Department of Wheels. Perhaps such duplication working is counter-intuitive, but hey, some things just are.

  25. 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 Anonymous Coward · · Score: 0

      AGILE!!! I'm on a 100+ person project spread over 3 countries and Agile holds it all together.

    2. 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.

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

      I'm so sorry.

    4. Re:Good enough that people won't stop doing it... by Anonymous Coward · · Score: 0

      I was going to tell him exactly the same thing. CI is god on earth.

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

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

      buzzwords, but there is some value in it

      - "continuous integration"

      probably a good idea if you don't hook it up to production

      - "devops"

      buzzword, but quite a bit of value in it. Why not have a repeatable build process across landscapes?

      - server-side javascript

      square peg but hey, why not. I don't see this ruining a business, the language has come a long way.

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

      holy hell no.

      - using microsoft "solutions"

      some are good, some are not, but if you don't like anything they do you probably do it based on ideology.

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    6. Re:Good enough that people won't stop doing it... by Anonymous Coward · · Score: 0

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

      Check out the Async Manifesto.

      - "continuous integration"

      Depends on the implementation, but if it can also run all your unit tests it can be extremely useful so that your programmers don't need 30 VMs with every possible deployment configuration. Just don't berate someone for checking in code that breaks and instead encourage them to use the system to do the tests instead of relying on everyone to manually run all the unit tests for all possible cases.

      - "devops"

      ... because communicating with the people deploying your software is such a horrible thing?

      - server-side javascript

      Never. Just Never.

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

      I haven't run into this, but it sounds horrible.

      - using microsoft "solutions"

      Meh. Some MS platforms are useful. Some *nux platforms are too. Pick the right solution for the job.

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

      Agile and scrum have definite advantages when done right (and what's right for one team won't be right for another) when requirements change. Continuous integration is useful, provided it doesn't take up too many resources. Devops look like they could be useful in other contexts. I'm not going to comment on server-side JS. Giving root access widely is almost certainly a bad idea. Microsoft does some good stuff and some bad stuff, and if you're deploying on Windows there's much to be said for Visual Studio.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  26. Nodejs? by Anonymous Coward · · Score: 0

    Javascript on the server side, coming soon to your bank account.

  27. 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!

    3. Re:Multiple Returns by Drethon · · Score: 1

      Great as long as you don't have to debug. If you have to debug, the results often are cleaner for me to have an appropriate number of if statements. If the nested loops or if statements are getting excessive, this is a strong indication the function needs to be broken up as opposed to sticking in a bunch of returns.

    4. Re:Multiple Returns by Anonymous Coward · · Score: 0

      This is useful in the following case:
      1) The code requires aviation certification (also known as DO-178C Level A
      2) The code (not the object file) goes thru coverage analysis (must prove testing covers all the possible paths thru a function.)

      This type of analysis typically involves "node based analysis" where each if/else/for/while/return/break/etc. is a node that needs to be accounted for.

      Smaller functions that have less complex functionality in each typically allows for a higher degree of modular or black-box testing.

    5. Re:Multiple Returns by Anonymous Coward · · Score: 0

      Yeah, it's pretty much abandoned; I think that's because the mantra of single entry / single exit was created in a different time with different languages and issues at play:

      http://programmers.stackexchange.com/questions/118703/where-did-the-notion-of-one-return-only-come-from

    6. Re:Multiple Returns by Anonymous Coward · · Score: 0

      Shit, most of my functions open with:

      if (<bad_parameter_data>) return null;

      Which, to me, is far easier to process than:

      if (<good_parameter_data>) { /* entire fucking function nested in a giant if-block */ }

      But that's mostly what I see in our code...

    7. Re:Multiple Returns by meekrab · · Score: 1

      You're hurting your future self. The control flow of the compiler output doesn't matter except to some optimizer that can read machine code better than you can read text messages from your bae. The logical control flow of your source code does matter, to potentially a lot of people, because humans have to reason about it when they change it. One exit point is better than 50, but sometimes its worse than 2.

  28. The Bubble Sort by noelhenson · · Score: 1

    A horribly inefficient but completely reliable way to sort things.

    1. Re:The Bubble Sort by Lord+Apathy · · Score: 1

      That is what I came in here to say. Bubble sort, bad programming at its finest but can't be beat when you need a simple and fast way to reliably sort a small list.

      --

      Supporting World Peace Through Nuclear Pacification

    2. 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
    3. Re:The Bubble Sort by mnemotronic · · Score: 1

      ... Bubble sort, bad programming at its finest but can't be beat when you need a simple and fast way to reliably sort a small list

      Or the list is already mostly sorted.

      ----
      Supporting a World in Pieces Through Nuclear Proliferation

      --
      The Russians have won. They have made the world a cesspool of distrust, greed, fear and hate.
    4. Re:The Bubble Sort by wierd_w · · Score: 1

      Quick and dirty statistical presort + quicksort.

      1) count array elements
      2) get upper and lower bounding conditions for sort. (If numbers, get highest and lowest values in the array. For strings, define the alphabetical sorting space by finding the highest ascending value, and the lowest descending value.
      3) get rough clustering data. For the first byte in each array element, how many are of each kind of byte. Eg, how many start with "a", etc. Dont be stupid here. Dont try to bruteforce the space. Just check the byte, and store it. Check the next byte, and see if it matches. If it does, increment the counter. Else, redim the array you are using to statistically presort your array with, and add another element. Store the new byte, put the incrementer on that byte at 1, and check the next element's first byte. Check each element against this array of known bytes, and increment/redim accordingly. By checking only one byte, we never have more than 256 values for strings, or 10 values for numbers.
      4) presort your unsorted array based on the rough distribution you just collected. By having a rough idea of where an item should be in an array, based on the first byte, we can clump similar data together in the array, with some reliable cutoffs on the zones. Eg, all the "As" will be together, and before the "Bs", because we know how many As there are, and have defined a zone in the array space for them. Each time we find an entry with the right first byte, we place it in the next available slot. It does not have to be fully ordered at this point. This just radically reduces the work of quicksort, which will make it actually right.
      5) run quicksort.
      6) be amazed at how many comparisons total (including those done by the presorter) it is, as in most realworld sets, it will be significantly smaller to sort the array than with quicksort alone.

    5. Re:The Bubble Sort by Darinbob · · Score: 1

      Sometimes it's hard to use those sorts. Sometimes having your own is faster for your particular case, or involves less code to get it done, etc. Ie, I have a list, but the built in sort doesn't know how to sort lists, so I write a very brain dead insertion sort when adding elements and it's not efficient but efficiency in time isn't important for it. Which is why you see bubble sort so often, because you can do it in a very small amount of code and it's perfectly fine for sorting a small array.

      Sometimes even for big arrays the built in sort is not very good. Sorting a million records for instance, quicksort or heapsort won't cut it if you can't keep it all in memory at the same time because the paging will destroy all your performance. Which is why having a better sort method for big iron mainframes in the past could make you a millionaire.

    6. Re:The Bubble Sort by Anonymous Coward · · Score: 1

      Because they want to apply what they learned in school. Nobody bothered telling them that 99% of the "merit badges" they earned in college for their busy work involved doing things wrong deliberately so that they learn an appreciation for what's under the hood of engineered off the shelf solutions.

      The purpose of the programming exercises becomes lost when the curriculum is passed from the person who created it to the person who is punching a clock to lead the students through a self-esteem day camp @ $10/hr per student * 30.

      If you aren't using office hours, most teachers who aren't punching a clock assume you don't actually care and are just there to do the bare minimum required to earn your piece of paper and a salary bump and in the case of 99% of all students they are 100% correct.

      Teachers usually want to teach, and they typically love finding someone who shares a passion for the subject matter.

    7. Re:The Bubble Sort by phantomfive · · Score: 1

      FWIW if you have fewer than 8 items, bubble sort is faster than quicksort or mergesort.

      In 1956 there was a PhD thesis published at Stanford that 'proved' Quicksort was the fastest sort overall. Knuth later said that such a thesis would not have passed when he was at Stanford.

      --
      "First they came for the slanderers and i said nothing."
    8. Re:The Bubble Sort by Anonymous Coward · · Score: 0

      Quicksort a file, and then with bublesort, and then let me know which one is faster :)

    9. 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.

    10. Re:The Bubble Sort by Z00L00K · · Score: 1

      You can often add your own sort condition to the sort routine that takes care of how to decide the order of the elements.

      There are rare cases where the library-provided sort routines aren't good enough, but they are usually from performance perspective.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    11. Re:The Bubble Sort by Anonymous Coward · · Score: 0

      If you're not writing plain C, and your language of choice can't sort a list, it's a shitty language.

      In any implementation of a library sorting routine that isn't stupid, it switches over to a selection sort/bubble sort algorithm at a certain cutoff point. The people writing this stuff aren't stupid, they already know that at some point the cost of x more function calls will easily overwhelm an O(n^2) algorithm.

    12. Re:The Bubble Sort by Anonymous Coward · · Score: 0

      Actually it's efficient in one case: an almost sorted list. And better yet for that usage case is Insertion-sort.

    13. Re:The Bubble Sort by s122604 · · Score: 1

      Java and C# make this brain dead simple. Implement the comparable interface, or a custom comparator, and then call Collections.sort...

      I do not see the difficulty/complexity in that

    14. Re:The Bubble Sort by david_thornley · · Score: 1

      Which is still not an excuse to use bubblesort, since insertion sort is usually better.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    15. Re:The Bubble Sort by david_thornley · · Score: 1

      If you need a way to reliably sort a small list in C++, I recommend std::sort. It works, and on a small list it rarely matters what algorithm is used. If you need more performance or have some reason not to use the library sort, try insertion sort, which is usually better than bubble sort.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    16. Re:The Bubble Sort by phantomfive · · Score: 1

      yeah

      --
      "First they came for the slanderers and i said nothing."
    17. Re:The Bubble Sort by Megane · · Score: 1

      Bubble sort can also be implemented on a singly-linked list.

      Also, if you look at a graphical representation of the sort, you can see that running the inner loop from high to low is slightly more efficient. (but you can't do that with the singly-linked list version)

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    18. Re:The Bubble Sort by Anonymous Coward · · Score: 0

      FWIW if you have fewer than 8 items, bubble sort is faster than quicksort or mergesort.

      Are you fucking retarded? Bubble Sort of 8 items has average-case performance of 28 comparisons. Mergesort of 8 items has average-case performance of 13 comparisons.

    19. Re:The Bubble Sort by phantomfive · · Score: 1

      You can't just count the number of comparisons, mate. There's more to it than that.

      --
      "First they came for the slanderers and i said nothing."
  29. 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.
    2. Re:Javascript by daedalus2097 · · Score: 1

      Ooh, no, I actually like PHP, but then again I learned ARexx many years ago and in a number of ways it's quite similar. Definitely agree on the JS front though, it feels like a dodgy experiment that got out of control and now we can't stop it.

    3. Re:Javascript by Anonymous Coward · · Score: 0

      I feel the ColdFusion pain

    4. Re:Javascript by Anonymous Coward · · Score: 0

      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.

      Cold Fusion indeed, wrote an e-commerce plateform with it in '99, it was a painful experience to say the least!

    5. Re:Javascript by Anonymous Coward · · Score: 0

      Javascript is terrible, but it does not hold a candle to how bad PHP really is. https://en.wikiquote.org/wiki/Rasmus_Lerdorf

    6. Re:Javascript by Anonymous Coward · · Score: 0

      I've only done a very little PHP work so I don't know it well...but, this might be one language to not give the benefit of the doubt:

      PHP: a fractal of bad design

    7. Re:Javascript by Anonymous Coward · · Score: 0

      Don't give PHP any benefit of doubt. I "ended up" working with PHP for 4 years, and I will NEVER use it again.

    8. Re:Javascript by david_thornley · · Score: 1

      You misspelled COBOL.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    9. Re:Javascript by Anonymous Coward · · Score: 0

      It's not.

      It's bad, but not that bad.

    10. Re:Javascript by Anonymous Coward · · Score: 0

      Son, you only say that because you've never poked the Cold Fusion bear.

      I wish I could use my mod points to make you higher than +5.

  30. What are some bad programming ideas that work? by Anonymous Coward · · Score: 0

    Microsoft Windows.

    1. Re:What are some bad programming ideas that work? by in10se · · Score: 1

      Oh, how clever you are!

      --
      Popisms.com - Connecting pop culture
  31. 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?
    1. Re:Tcl by phantomfive · · Score: 1

      Tcl is such a great language.

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Tcl by nonsequitor · · Score: 1

      Tcl = Tool Control Language
      We used it at my old startup as the scripting language for the testing tool we sold. I have fond memories of developing multithreaded scripts from the interpreter command line. I never used it for Tk, but I implemented the Tcl API for interacting with our tool in C. It was the right tool for the job, trying to use it for everything would be a mistake, just like with any other language.

    3. Re:Tcl by stdarg · · Score: 1

      I used TCL for writing Eggdrop scripts (an irc chat bot). Then I did some stuff embedding TCL in C. It had the best interface for doing that at the time... much better than Perl embedding for instance.

    4. Re:Tcl by Anonymous Coward · · Score: 0

      My only exposure to TCL comes from DarwinPorts where it was (is?) used for build scripts. I thought it was a pretty good fit there.

      As such, I don't quite get the hate the language gets.

  32. 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 JoeRandomHacker · · Score: 1

      And don't forget the scoping, or lack thereof. At least with GT.M you get (mostly) compiled code.
      (Disclaimers available on request.)

    2. Re:MUMPS by phantomfive · · Score: 3, Funny
      --
      "First they came for the slanderers and i said nothing."
    3. Re:MUMPS by Anonymous Coward · · Score: 0

      Oh, no, you have TWO spaces instead of one....

    4. Re:MUMPS by Anonymous Coward · · Score: 0

      Looks like obfuscated C without the #define statements.

    5. Re:MUMPS by Anonymous Coward · · Score: 0

      My eyes are bleeding!
      MY EYES ARE BLEEDING!

      WHY would you link to that?
      WHY??!

    6. Re:MUMPS by naris · · Score: 1

      Oh, so that's where python got that!

    7. Re:MUMPS by naris · · Score: 1

      I rather come down with the other Mumps than maintain that!

    8. Re:MUMPS by Anonymous Coward · · Score: 0

      I can hear the choir of a dozen dot matrix printers, singing at the end of the fiscal month the songs of cost reports and paychecks.

  33. hah by Anonymous Coward · · Score: 0

    "marketing is a bad idea that works, but in brazil it only sucks" - me.

  34. Using Windows by Anonymous Coward · · Score: 0

    Sometimes you just have to do it.

    1. Re:Using Windows by hcs_$reboot · · Score: 1

      Don't blame devs developing on Windows. They usually don't have a choice due to economic constraints.

      --
      Slashdot, fix the reply notifications... You won't get away with it...
  35. 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).

  36. Copy and paste code by Anonymous Coward · · Score: 0

    I feel bad every time I think about this, but the thing I've written that has had the greatest utility for me personally was some utilities to improve copy-and-paste. Maintaining case (all-upper, all-lower, camel), creating a new file by replacing in the filename, copying one template to a bunch of targets....Sometimes it feels like most of my job, when I'm given something new to write, is finding the closest thing to use as a copy target. So much boilerplate in our classes...If pressed, I know what most of it is for and I can identify what pieces might be missing to cause some unexpected problem, but most of the time I just want to find something that's got all the right bits already and make a duplicate of it.

  37. 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

    1. Re:Magic Numbers! by Anonymous Coward · · Score: 0

      The band is definitely a terrible idea that should never have worked.

  38. the for loop by Anonymous Coward · · Score: 0

    The basic for loop is terrible.

    Generally with javascript
    $.each(array,function(index,item){ //this works great, as you utilize the items in functions etc they stay set in memory, FANTASTIC
    });

    for(var i=0;iarray.length;i++){ //this pile of filth when referenced is unable to do anything but hit the last item in the array when utilized with functions //damn it's creator and his lazyness, DAMN HIM TO HELL! (and yes it was a him, be real)
    }

    Still though it is a malignant cancer within the code and for new coders the for loop is the go to (until after suffering they are reborn), it does do certain jobs admirably.

  39. 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.

    1. Re:Switch(true) by Anonymous Coward · · Score: 0

      You blew mind my with this.

    2. Re:Switch(true) by hcs_$reboot · · Score: 1

      Valid, but it looks a bit too hacky imo... code readability is important!

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    3. Re:Switch(true) by omnichad · · Score: 1

      When I've used it, it was the more readable option. So that should say something. If you have a series of value ranges in a conditional, it's the easiest to read IMO.

    4. Re:Switch(true) by Anonymous Coward · · Score: 0

      Are you by chance a Python programmer that also does some C/C++?

    5. Re:Switch(true) by hcs_$reboot · · Score: 1

      Because there is no other option, none of these languages made 'switch' able to elegantly deal with a train of if else...

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    6. Re:Switch(true) by omnichad · · Score: 1

      Mostly PHP and Javascript. It's supposedly more efficient to run vs. an if-else block. I just think else if chains are messy - it's probably just because if it's properly indented, I like that the switch block is all indented as one cohesive unit.

    7. Re:Switch(true) by Anonymous Coward · · Score: 0

      COBOL can:
      If (...)
      If (...)
      If (...)
      If (...)
      .

      One problem though: The single dot is supremely important (automatically closes all open control structures).

    8. Re:Switch(true) by CrashNBrn · · Score: 1
      I do something like that in some of my AHK scripts.

      while(A_Index==1||ErrorLevel)
      {
      ErrorLevel:=DoSomethingFun(A_Index)
      }

      Where, A_Index always starts at 1. ErrorLevel might have a prior value, but it doesn't matter, as the || (OR) is superfluous in the first iteration.

    9. Re:Switch(true) by dwpro · · Score: 1

      because this irks me, how about :

      enum thingToDo {thingA};

      func thingToDo CalcThingToDo($a)
      {
        if($a<5) return thingA;
      }

      switch(CalcThingToDo($a))
      {
         case: thingA:
           ...

      --
      Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz
    10. Re:Switch(true) by pscottdv · · Score: 1

      This is awesome. I have immediate use for this idea in SQL.

      --

      this signature has been removed due to a DMCA takedown notice

    11. Re:Switch(true) by Anonymous Coward · · Score: 0

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

      So, you are replacing

      } else if [comparision] {
      ...

      with

      case [comparision]:
      ....;
      break;

      and think you've made an improvement ? Really ??

      I also fail to see how you can call the former "stacking", and the latter not.

      As far as I'm concerned you're solving a non-existing problem and making the sourcecode harder to read as a result.

    12. Re:Switch(true) by bad-badtz-maru · · Score: 1

      Beware, the resultant query plan will probably suck.

    13. Re:Switch(true) by T.E.D. · · Score: 1

      That does not work in C++. I'd be surpised if it works in C. So the question I have for you is, what language DOES it work in? It looks like csh to me.

    14. Re:Switch(true) by omnichad · · Score: 1

      Works in both PHP and Javascript. You linked to bad code all around on stackoverflow.

      Their example works out to:
      userInputtedInt == >= someNum && <= someOtherNum

      It doesn't even make sense.

      The right side of that is two invalid expressions (a comparison operator missing one side) &&'ed together. My example does a different comparison:
      true == $a < 5;

      Both sides of the comparison are boolean. It works.

    15. Re:Switch(true) by T.E.D. · · Score: 1

      That's not really the point though. In C++ (and I believe C) the case labels have to be integer literals of some kind. This is because the compiler is meant to be able to implement a switch statement with a jump-table. Those have to be built at compile time, so they can't have variables in the case's.

    16. Re:Switch(true) by omnichad · · Score: 1

      Right - here's a better resource for that:
      http://www.open-std.org/jtc1/s...

      It seems that it does have to evaluate to a literal value. One of the benefits of using interpreted language, I guess. Most of what I work with wouldn't benefit much from being compiled.

    17. Re:Switch(true) by Tablizer · · Score: 1

      Why doesn't the C family offer a modernized replacement for it's ugly case/switch statement? Keep the old one for backward compatibility, but add a new one with different keywords that doesn't need "break", and has "set lists". Even VB did it better. Maybe something like:

      select(a) {
              when 1,2,3 {...}
              when 4 {...}
              when 5,6 {...}
              otherwise {...}
        }

  40. How to write unmaintainable C code by Anonymous Coward · · Score: 0

    An oldie, but goodie unmaintain

    Of course, doing the opposite is the tongue-in-cheek point.

  41. The C Programming Language. by Anonymous Coward · · Score: 0

    On more than one occasion I've been able to write a C solution to a problem where the "high level language" solution only took a few minutes to write, but it took days longer to run than the C solution took to both write and run.

  42. Modern Web Apps and Design by Anonymous Coward · · Score: 0

    I long for the Web 1.0 days but with modern day bandwidth. ...and while we're complaining...over architected IT systems...."everything is an object/service" is the bane of my careear. I'm learning to appreciate simple pipes and filters more and more every day.

  43. Recursion by Anonymous Coward · · Score: 0

    See subject.
    Foam at the mouth all you want, in your heart you know it's true.

    1. Re:Recursion by hcs_$reboot · · Score: 1

      Recursion is not a bad idea. The problem is that it relies on a small memory space that was not designed for that purpose initially (or you have to customize it)

      --
      Slashdot, fix the reply notifications... You won't get away with it...
    2. Re: Recursion by Anonymous Coward · · Score: 0

      Sorry, what'd you say after See Subject? Never got there because your comment is a GOTO loop.

    3. Re:Recursion by JustOK · · Score: 1

      you should use recursion if you need to use recursion. Conversely, if you need to use recursion, you should use recursion.

      --
      rewriting history since 2109
    4. Re:Recursion by Anonymous Coward · · Score: 0

      OK, so you have apparently never heard of n-depth hierarchies. Jeez, what is it with all the 'I've never used it (correctly) so it must be stupid' folks around here? You may as well stand over in the tools section of the hardware store warning people away from the screwdrivers because they make such a big mess of mitre cuts.

  44. perl by Anonymous Coward · · Score: 0

    Enough said.

  45. 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.

  46. CSV Files as Program I/O by Anonymous Coward · · Score: 0

    Everyone knows how to input data into a speadsheet, and do useful post-processing in a spreadsheet.

    1. Re:CSV Files as Program I/O by naris · · Score: 1

      Much better than .XLS files as Program I/O.

  47. Short variable names by Anonymous Coward · · Score: 0

    If you use short variable names for loop variables and stuff, you can code faster because you type quicker. Also globals aren't bad, and public variables aren't bad.

    1. Re:Short variable names by HornWumpus · · Score: 1

      Agreed, I once worked on a project with a global array named 'aLocalArray'. It would have been better if they had just named it 'Ass'.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    2. Re:Short variable names by dwye · · Score: 1

      If you use short variable names for loop variables and stuff, you can code faster because you type quicker.

      Back in college, I had to rename i,j,k,l as indx,jndx,kndx,lndx just to keep the TAs off my back. Single char variable names were FORBIDDEN!! but they never had a good reason for ruining the readability of the code when a quick comment at most would serve to describe which index variable was which.

      You might notice that Mathematics texts never use long variable names, and COBOL always does? Nuff said.

      Also globals aren't bad, and public variables aren't bad.

      Of course they are bad. Necessary sometimes, but bad. So write yourself a comment as to why you are using it, and go on, and let someone else remove it after you have left the company, if they have nothing else to do with their lives. Especially useful for tracking internal conditions in functions when you are debugging and don't want to bother stepping through them.

  48. 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.

    1. Re:The latest trend is not your friend... by complete+loony · · Score: 1

      Activities and Views are fine, I guess. But forcing serialisation of state between screen rotations sucks. A good presenter model with lifecycle management, baked in from the start, would have been nice.

      IMHO Google made things worse with Fragments. If you follow the code examples, you end up repeating yourself with lots of nearly empty Activities, just to host your fragments on a phone instead of a tablet.

      --
      09F91102 no, 455FE104 nope, F190A1E8 uh-uh, 7A5F8A09 that's not it, C87294CE no. Ah! 452F6E403CDF10714E41DFAA257D313F.
  49. Editors by TranquilVoid · · Score: 1

    Using Emacs instead of Vim, occasionally it actually is more productive.

  50. 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...
    1. Re:Objective-C by phantomfive · · Score: 1

      I'll be honest, I really like Objective-C. It's my favorite OO language, other than Smalltalk (which is brilliant).

      --
      "First they came for the slanderers and i said nothing."
    2. Re:Objective-C by Anonymous Coward · · Score: 0

      Objective C is truly a different beast than any other language I've seen. Anyone doing classic C, C++, Java, .NET, etc should go buy or borrow a book on it and read it, if only to get some perspective and see what interesting things can be done without leaving the procedural/imperative paradigm.

      Functional (eg Lisp) programmers will still think it's all junk.

  51. if assignments by scdeimos · · Score: 1
    There's probably only one case in 10,000 where you actually want to do this. Compilers really only should allow it if you've wrapped #pragma around it:

    int i = 0;
    const int j = 1;
    if (i = j) {
    //Do something unintended
    }

    1. Re:if assignments by KiloByte · · Score: 1

      Eh? That's one of nicer features of C. Think of if ((x=somefunction())), or related switch(x=somefunction()).

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    2. Re:if assignments by mrchaotica · · Score: 1

      If you're doing that, it's more clear for your condition to be like this:

      const int error = 0;
      if( (x = somefunction()) != error ) { ... }

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    3. Re:if assignments by KiloByte · · Score: 1

      Do you type "const int one=1, two=2;" before every line, too? Sorry, with your scheme that'd be "const int one = 1; const int two = 2;". I fail to see a benefit other than getting Cobol fingers...

      More terse code tends to be more readable.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    4. Re:if assignments by dwye · · Score: 1

      That is what lint used to be for, and compiling with full nattering (warnings), so that you can find the cases where you really wanted to drive on the guardrail-free mountain roads in a sport car rather than cruising in a Volvo, to use the once obligatory car analogy.

    5. Re:if assignments by mrchaotica · · Score: 1

      Providing a descriptive name for the error condition was not the important part (especially when the error value is 0, null, or false). The important part was the explicit use of the comparison operator in addition to the assignment operator.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

  52. Are they clean? by gerald.edward.butler · · Score: 2

    Did you make your macros Hygenic?

    1. Re:Are they clean? by K.+S.+Kyosuke · · Score: 1

      Hygienic macros in a language designed to get your hands dirty? ;)

      --
      Ezekiel 23:20
  53. Ooh... by Anonymous Coward · · Score: 0

    ... goto hell.

    1. Re:Ooh... by Anonymous Coward · · Score: 0

      b& FBI

  54. Are you on drugs? by gerald.edward.butler · · Score: 0

    This has got to be one of the most incoherent piles of meaningless drivel I've ever come across.

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

      It was a bit loopy.

  55. Full of shit you are by Anonymous Coward · · Score: 0

    1 + 1 is too, that means 1 + 1 = 01 or 10 in binary.

    If you aren't right, then you are using another language (that means they are responsible, the authors) and if you are writing in C then you are probably wrong.

    It's pretty simple, but the fact is that whores will be whores and guys will turn gay.

  56. One word by Alomex · · Score: 1

    Perl

  57. Global Variables by Anonymous Coward · · Score: 0

    >Reading Comments >= +2
    >Ctr+F
    >Glob
    >0 Results
    Come on...
    I can't be the only one that uses globals from time to time....

    It saves a lot of time to have a private global (within a well defined black box) than to pass pointers around inside that same code...
    You just have to make double sure you aren't fucking it up.

  58. Boolean Switch/Case Statements by Anonymous Coward · · Score: 0

    $true

  59. Laundry list of "bad" shit I unapologetically do by Anonymous Coward · · Score: 0

    Using sqlserver read uncommitted isolation level when you could just as easily use snapshot or some shit. Limits to unimportant displays and low value reports so I don't care if it fucks up every once in a while.. thing is I've never seen it screw up and nobody has ever noticed or complained about it ever.

    Stuffing UTF-8 into databases that don't even understand UTF-8. This works as long as you use the right code page, make damn sure character translation is disabled, never truncate data, don't give two shits about proper ordering of non latin characters or resulting output appearing as complete garbage in most query, ETL and reporting tools. Yet I don't give a fuck, gotten away with it for some dozen years without any complaints. The alternatives are a lot of work I don't want to deal with and significantly increase storage and network requirements which can piss off those trying to skirt by on freebee commercial databases or hosting with providers charging by the GB when few care about language support in the first place.

    Ignoring various HTML spec constraints... example title must appear in the heading... or fucking what? It works just fine no matter where the hell you stuff it. I'm not going to rewrite or buffer a whole goddamn workflow just so shit like that is spit out in the right "order".

    Liking Microsoft shit...You can pry visual studio and editing C code live in debugger without restart from my cold dead hands.

    Total complete utter rejection of exceptions... Exceptions are a totally insane way of introducing bugs and hopelessly impossible to check code. The only reason people use them is because it makes life easier for THEM to code early in the lifecycle with no consideration to what comes next...Well fuck that I only care about being able to verify correct operation under all circumstances... You can't design error free or error tolerant subsystems or systematically verify proper operation of jack shit when everything is a black box that can throw whatever the fuck it pleases whenever it pleases. I write exception free exclusively even though some systems the code implements are paradoxically DSLs with exception handling but that is a constrained environment where no such issues are possible.

    Total rejection of garbage collected languages. If you follow a few simple rules you will never have memory management issues... if you use garbage collectors well good luck guessing what the GC will or won't do ... running low on memory because of some unintelligible dependency chasing? Micro/macro stuttering to do GC bullshit? No fuck all of that just learn to code. Memory is by far the most cost free item you can possibly ever fuck up... if you can't manage that how the fuck are you going to deal with not fucking up synchronization, connections, transactions, handles and shit... Things which are guaranteed to cause havoc if you just ignore the issues and rely on GC and exceptions.

    Not giving a shit about how small throwaway utility programs are written. Have no problems writing complete unintelligible geek code in the most dynamic scripting language chalk full of automatic variables I can get my hands on when maintenance cost is essentially zero.

    Strong but conditional dislike of OO*. Great if your writing game engines and some business shit but many things we work have proven to be more of a liability leading to the same tired old inheritance traps. Things avoided by abstaining from the Kool-Aid.

  60. Always run as root, or as an Admin by Anonymous Coward · · Score: 0

    Turn off SELinux entirely.

    According to Lennart Pottering, turn off *every single systemd feature* and using tools compatible with old code and other operating systems.

    Also according to Lennart Pottering, let user processes continue after the user logs out or gets their shell session disconnected.

    Store credentials in plain text, because "you trust the people you work with" and "if they have access to your system, you're lost anyway". Subversion still does this, and 90% of all SSH users do this by keeping their private SSH keys without a passphrase, which is still the default behavior of ssh-keygen.

    Do not even bother checking for disk warnings, since more than 1/3 of the time disks fail without warning.

    Never apply updates to the operating system, at all.

    Use maven, CPAN, nodejs, pip install, or any other tool that builds a random assortment of the latest versions of publicly available components and has no working way to lock down all the dependencies before starting or even to effectively roll them back.

    Java, C++, or any "object disorientated" code.

    Tail looping.

    Never sanitize inputs or checking for error codes.

    Timestamp your backups with the timestamp of the backup directory (rsapshot).

    Never write checkpoints in batch processing tools.

    1. Re:Always run as root, or as an Admin by johannesg · · Score: 1

      You consider all of these 'bad ideas that do work'? Or merely 'bad ideas and you fail at reading comprehension'?

  61. 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.

    1. Re:process per request by Anonymous Coward · · Score: 0

      Process per request isn't "the Apache model" unless you want to go back 15 years or so. Apache httpd is fully threaded on all major platforms, though the prefork model is still there in case you want/need it (*cough* modphp).

    2. Re:process per request by buddyglass · · Score: 1

      I recant the part about Apache then, and limit my answer to running Rails in process-per-request mode. Unfortunately the project I work on has a ton of legacy code that's probably not thread-safe, so rather than go through the pain of refactoring it it we've elected to just buy more RAM, i.e. have more instances in the pool.

    3. Re:process per request by gustygolf · · Score: 1

      That's curious. I've never seen a different approach made (for dynamic content HTTP requests). Things like FastCGI are the norm for me. What alternatives exist, and who/what uses them?

      --
      "Slow Down Cowboy! It's been 58 minutes since you last successfully posted a comment" -- slashdot, driving users away.
  62. one word... by Anonymous Coward · · Score: 0

    goto.

    *Takes cover*

  63. Only 1 Things: by Anonymous Coward · · Score: 0

    0) Counting from zero.
    1) Whitespace characters with different meanings.

  64. SQL: Left join vs inner join by diesalesmandie · · Score: 1

    A guy I work with uses left join for everything when the majority of the time an inner join would be more suitable. Oh well, it still works.

    --
    This is my sig, there are many like it but this one is mine
    1. Re:SQL: Left join vs inner join by kbrannen · · Score: 1

      A guy I work with uses left join for everything when the majority of the time an inner join would be more suitable. Oh well, it still works.

      I'd guess because he learned SQL while using the older versions of Mysql, where left joins were faster than inner joins for some strange reason.

      Hmm, that reminds me that Mysql would qualify for this overall topic. Mysql isn't that great of a DB, but it generally works well enough for many people.

  65. Back in the day.... (IK, ugly cliche) by Anonymous Coward · · Score: 0

    Talking 8085/Z80/6502 assembly days, there were 2 things you just didn't do.

    1. Recursion. The relative merits of this have already been dicussed, so I won't belabor it here.

    2. Self modifying code. To my knowledge this is still considered a bozo no no, however I found it fast and effecient when resources like memory were still at a premium.
      It's definately a bad idea that sometimes worked not only well enough, but better than any other solution available.

  66. 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.

  67. AUTOSAR by Anonymous Coward · · Score: 0

    If you need templates, implement them generically via a preprocessor but don't use crap like AUTOSAR. Yes, it works. But it takes far longer than if it had been done right. FIBEX files are nice though.

  68. Implementing control flow using exceptions by Anonymous Coward · · Score: 0

    Did it once while implementing a serious e-commerce engine, still in use 13 years later. Tried it a few different ways, propagating errors and user dialogs using java exceptions just turned out to be the best way.

  69. trust the guru by Anonymous Coward · · Score: 0

    Everything you do has risks and rewards. Bad programming ideas are only bad when you don't understand them. If you are skilled enough to know all the best approaches and fundamentally understand the problems that they are trying to address, then make an informed decision to implement a bad programming idea, I will not fault you for it. That does not mean that I will not question it or seek to understand it at your level.

  70. Clever solutions by El_Muerte_TDS · · Score: 1

    Clever solutions work. For now. But when they contain a bug they are a major to pain to analyze and fix, and it only gets worse once it is somebody else's clever solution.

  71. Bad Idea #1 by Lodragandraoidh · · Score: 1, Flamebait

    Allowing (or forcing) application programmers to do system programming. If your language forces the programmer to reinvent the wheel - he will invariably do it badly. The corollary to this: poor libraries/frameworks/abstractions built by aforementioned programmers then let bad programmers spread even more bad code.

    This, by the way, is the source of all zero days.

    If you have to do system programming - make sure you have a bona fide systems programmer - preferably who has a thorough understanding of secure programming - on the team; either as a reviewer, or designer.

    Given that there aren't that many real system programmers out there - those that are should focus on building tools that keep application developers from shooting themselves in the foot (so they don't have to be there to keep the carnage from happening). In this instance, I am all for gun control. You don't give a child a loaded gun, and you shouldn't give an application programmer one either.

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
    1. 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.

    2. Re:Bad Idea #1 by Lodragandraoidh · · Score: 1

      Call it whatever you want. Apprentice/Master --- but there needs to be a way to differentiate - and thereby focus the work efforts. Master developers/designers need to be building a cohesive set of tools and a design that the Apprentice uses to get the job done.

      An apprentice programmer should never be allowed to lead the design or implementation of a project - I don't care how many years they have with the company. Years of service does not equal quality of skill set. I've seen too many projects destroyed because the wrong people were in key positions in the team - and should not have been. The idea that every programmer is an interchangeable widget is a lie. If you are peddling that 'happy joy and rainbow land' view of the world - then you are part of the problem that I am talking about.

      The truth is in the deliverables. Most of those deliverables are nowhere close to being right.

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
  72. Excel by darkain · · Score: 1

    I'm forced to support an Excel sheet for mass data entry into a web application. The people using the system can barely understand how files are handled in general, so the concept of "save as CSV, then upload to web" is too complicated. There is a built in VBA macro that extracts the current sheet into a new document, uploads it behind the scenes, then triggers the web app to process it. Luckily, XLSX files are just ZIP files with XML files inside. So the worlds shittiest XML parser is used to handle those documents, since I know it doesn't need to meet even 20% of the full XML spec, just enough to handle one single Excel sheet at a time.

    Variations of this system have been in place since Excel 2003 ...

  73. hard coding by Anonymous Coward · · Score: 0

    hard coding server names, odbcs, queries, stored procedures of test environment in library scripts to avoid altering the script during dev and deploy and the support due to differences of environment. Just deploy and run!

  74. Public variables by johannesg · · Score: 1

    If something is a private variable that comes with a pair of trivial get/set functions, it is arguably already public, just with lousy syntax. Just make it public.

    "But what if we want a less trivial get/set later on, JohannesG, what will you do then, huh?"

    Simple. I will move the variable into the private section, add the required get/set functions, and let the compiler tell me where I need to change the code to call them properly. So what if I have to edit 10-20 lines? Because usually that's about the worst of it... And if you know it is potentially going to be much more of course I wouldn't recommend this.

    Also, magic numbers. No, I'm _not_ going to declare a constant or enum for every damn possible unnamed value I could send over your MIL1553 or RS232 bus; if your damn manual cannot be bothered to name them, neither will I. Most of these occur exactly one time in the program anyway, and if I have to do any debugging I'll be comparing my code to your manual. I'd like both to speak the same language, and if you chose that language to be hexadecimal, I will happily include those magical hexadecimal numbers directly in my code, screaming QA drones notwithstanding.

    1. Re:Public variables by angel'o'sphere · · Score: 1

      Or you use an IDE, select the variable in question and use the "Encapsulate Field" Refactoring and you are done instantly ...

      Well, so many people spending the last decades under a rock.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  75. Fixed size arrays to handle unknown N items by Alsee · · Score: 1

    Memory is cheap. Sometimes it's just plain faster and simpler to allocate an oversize fixed-size-array than to mess with dynamically allocating and freeing memory.

    Fixed size arrays explode if N ever gets above your array size. There are many cases where you should NEVER do this... anything safety-critical or crash-critical or anything which might come under attack. However there are cases where you can assign an acceptable real-world practical limit on N and simply allocate an abundance of memory for it.

    --
    - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
  76. 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.

  77. VHDL by Anonymous Coward · · Score: 0

    VHDL. Worst piece of trash language. It requires someone to write out verbose repetitive lines for one single simple thing, and is overly sensitive about types.
    There's a reason why majority of the companies have been moving towards Verilog/SystemVerilog.

  78. I disagree with "Wasteful algorithms" by e70838 · · Score: 1

    What is called "Wasteful algorithms" is not bad programming but another way to present a good old programming practice: "premature optimization is the root of all evil".

    I think the main rule is: "It is ok to violate rules as long as you know that you are violating a rule, you know why you are violating it and you know the problems you may face".

  79. Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

    It turns out OOP can be a pretty good tool for name-space management in many cases, but it has stunk at domain modelling. Domain modelling is how OO was "sold" to us for roughly the last 2 decades, and this was a fat mistake that turned many prematurely gray.

    An example of domain modelling would be a human resources app that models employees, managers, offices, etc. as objects. This mostly flopped.

    But OOP works fairly well for making API's to network and system services (and arguably GUI's, but that's another subject).

    We were doing it wrong.

    1. 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.
    2. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      I don't see how that necessarily improves things, but another problem with domain-modeling in OOP is that nobody agrees on how to do it "right". There are no solidly-proven set of unambiguous rules to partition domain objects. If you have them, write them down so I can verify they are unambiguous. In other words, OOP domain-modelling is too easy to get wrong because it's too hard to know if you are "doing it right".

      If 98% of human resources processing is on "employees", then adding an extra "person" layer into it doesn't help. Maybe if HR tracks and processes contractors also (which they may not, per org), it might help, but perhaps it would be easier for contractors and employees to be independent objects/classes if they are usually treated differently: a top level just gets in the way because it may not contribute much of actual use.

      Over-normalizing relational tables can create similar problems: too many joins and keys to keep track of without helping much. And it slows processing down.

      It's hard to say without studying the domain and intended use of the software. Having a generic model of the world would have too much indirection (levels/layers/components) to be practical for IT.

      Relational generally doesn't require one to hard-wire domain verbs to a given set of domain nouns. Operations are often multi-noun anyhow such that tying them to a single noun is often arbitrary (forced) in OO. The real world is better modeled as virtual coming together of nouns for a particular purpose at a time, rather than trying to make universal declarations about which verbs go with which nouns.

      The business world is situational, and our software models should reflect that. Noun X working with Noun Y on Tuesday shouldn't have to care about Noun X working with Noun Z on Friday. Many-to-many relationships tend to get really ugly to manage in OOP such that one ends up turning the OOP app into an (ugly) database to track and manage it all. Might as well start with the database instead and stop trying to make an OO mirror for it: that's double work.

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

      Many-to-many relationships tend to get really ugly to manage in OOP such that one ends up turning the OOP app into an (ugly) database to track and manage it all.
      But you do know that OO models are mapped trivially directly to relational models and vice versa?

      Regarding domain models: of course a model of the same "nouns" look different in a different domain. Nevertheless there is absolutely no difference if I make a domain model with a relational DB in mind or with an Object oriented Model, the outcome is exactly the same.

      If other people fail on that they can no model (which implies they can not analyse), plain and simple! Sure, you can do slight optimizations on the DB side, or really bad spaghetti objects that can not be mapped easy: but then you already have likely failed in modelling.

      Might as well start with the database instead and stop trying to make an OO mirror for it: that's double work.
      That is what plenty of people do. Nevertheless as soon as the data is incarnated in memory it will be in objects. What do you care?

      Business operations as your example in "Noun X working with Noun Y on Tuesday shouldn't have to care about Noun X working with Noun Z on Friday" should not be associated to the nouns anyway, but to controller objects as in MVC patterns. Or transactional objects (that is not what you think it is: a transactional object is one that describes a contract e.g. like a marriage. Everything relevant to the marriage is coded in such a class and not spread over persons).

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    4. Re:Domain modelling [Re:Shying away from OOP(s)] by phantomfive · · Score: 1

      It turns out OOP can be a pretty good tool for name-space management in many cases, but it has stunk at domain modelling. Domain modelling is how OO was "sold" to us for roughly the last 2 decades, and this was a fat mistake that turned many prematurely gray.

      Yeah lol, that's basically all it is, just a big namespace.

      --
      "First they came for the slanderers and i said nothing."
    5. Re:Domain modelling [Re:Shying away from OOP(s)] by narcc · · Score: 1

      Sorry for the extra reply, but this is my earlier point entirely. You both think the other "doesn't understand OOP" or is "doing it wrong".

      Tablizer has quite a reputation outside of Slashdot for his thoughtful criticisms of OOP. It's difficult to claim that he doesn't understand it, as far as anyone is capable of understanding such a poorly defined concept.

    6. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      *snicker*

    7. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      But you do know that OO models are mapped trivially directly to relational models and vice versa?

      Trivially? I don't think so. OO-RDB mappers are often considered a royal PITA. I suspect some will say "but they are doing it wrong". Again it's yet another case of OO domain modelling being hard to get right and hard to know if you are doing it right.

    8. Re:Domain modelling [Re:Shying away from OOP(s)] by david_thornley · · Score: 1

      We have some very successful inheritance hierarchies that model certain domains. Of course, we try to figure out what will work best and aren't afraid to refactor if we need to.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    9. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      Tablizer has quite a reputation outside of Slashdot for his thoughtful criticisms of OOP. It's difficult to claim that he doesn't understand it...

      It's entirely possible I outright "don't get" OOP for domain modelling (OODM), despite trying to figure it since the late 90's. OODM appears to make the design more complicated to my eyes and fingers. It's supposed to make the design better able to handle future changes in requirements*, but "refactoring" is now accepted as a common ritual when the design turns out to be wrong. If it made the system change-friendly, you wouldn't NEED to refactor much. Constant refactoring means OODM failed at its primary stated goal*.

      Part of the problem is that it seems to be trying to make universal/global modelling decisions, and then later one finds out it's the wrong universal model due to new requirements and/or "philosophizing wrong" and have to rework it. Focusing on a task at hand means one only has to model a local temporal little world and is not committed to universal modelling declarations. There's no Grand Taxonomy Burden. No crystal ball needed.

      Relational modelling also requires global modelling to some extent, but it's mostly driving by repetition factoring (avoiding duplicate info) and NOT by an intended global description of reality.

      Other experienced people have come to similar conclusions. They too found use in OOP, but not in domain modelling. Sometimes it helps organize certain code better, but the reason has little or nothing to do with modelling real word things. It simply packages certain services and related state nicely code-wise.

      Maybe OODM is somehow "better", but some of us, perhaps many of us, are somehow inherently color-blind to its benefits. I'd be hesitant to claim one-technique-fits-all-minds.

      * Although the alleged benefits and their ranking vary per proponent, which also highlights the fishiness.

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

      Tabelizer actually wrote before 2010 only nonsense in his anti OOP thoughts.

      And I don't see much development, albeit he writes less nonsense now :D

      But I better answer to his post below.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    11. Re:Domain modelling [Re:Shying away from OOP(s)] by angel'o'sphere · · Score: 1

      First of all: OODM appears to make the design more complicated to my eyes and fingers
      Even as the word "modelling" implies that we are doing "design" here, Domain Modelling is Analysis and not Design. The result of the analysis can be improved by avoiding typical mistakes if you map them to a relational model. But This model would be the exact same model if you would think in objects.

      Design in the oo world is more important for architecture and the use cases than for the domain model. Hence if you need to refactor you did not understand the domain model beforehand. Or: you only refactor in the business layers, which is completely normal when business requirements change.

      The difference between "relational modelling" and "oo modelling" is only the drawing notation in which you draw the resulting domain model. If two designers/analysts come to two different models than the reason can only be their different understanding of the domain and not the question if they tackle it in a domain driven way, relational way or object oriented way.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    12. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      Hence if you need to refactor you did not understand the domain model beforehand.

      An architect can't always know everything. We move, they move, we all scream for ice-cream.

      And even if one knows the current domain, it's very difficult to anticipate future changes. Change requests come out of left field all the time that go against the grain of the current system. If a technique requires a well-functioning crystal ball or perfect knowledge, then it's focked.

      It's better not to try to lace everything together with an overriding global domain model. If a given task can remain mostly independent, it should. If it gets what it needs and only what it needs from the community, then it's not tied to side issues and more protected against change requests that don't (and shouldn't) affect it.

      Ask yourself, does X truly need to know or care about Y? If not, cut the wires.

    13. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      I don't claim it can't happen, only that it's hit and miss and nobody can come up with clear guidelines to make it more likely to succeed beyond "keep trying, after N projects it will finally click." But that means N - 1 projects are crappy; a lot of collateral damage that makes our Middle East policy look sane in comparison.

      and aren't afraid to refactor if we need to.

      ANY paradigm/technique can be "refactored" to improve it or make it fit better when it doesn't work very well.

    14. Re:Domain modelling [Re:Shying away from OOP(s)] by david_thornley · · Score: 1

      Clear guidelines? There's the Liskov substitution principle. It's expressed technically, but if you're going to do an inheritance hierarchy you do need to know and apply it. Call it an advanced technique if you like, since you can certainly screw things up in an inheritance hierarchy (classes in a hierarchy are VERY closely coupled). The best way to learn it is not to get things wrong until you figure it out, but to learn from more experienced developers.

      As far as refactoring goes, things in our domain change (as we add new capabilities, for example), and refactoring is necessary to adapt to that. Having some very good people on staff who get involved in these things, we generally do it right.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
    15. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      A good many OO-domain-modelling (OODM) proponents agree that trying to force everything into hierarchical taxonomies fails in most domains and that "composition" OODM is the way to go (which is closer to the set-theory-based variation management I talked about). I'm surprised there are still hold-outs for "mass trees".

      One can force things into hierarchies, but that doesn't mean one should. Objectively verifying that taxonomies don't violate certain rules says very little of their ability to be useful to maintainers or anybody else. Humans maintain code, not math. LSP is a narrow metric, like optimizing a car for gas mileage above anything else (room, comfort, speed, repair costs, etc.)

      Most domain nouns I encounter either cannot be hierarchically classified, or any hierarchical classification is likely temporal, accidental, or forced.

      In other words, one can take an given feature set and FORCE them into a hierarchy(s) and say, "See, I have LSP-passing trees!" But that says nothing of the quality or future-friendliness of such designs.

      Perhaps over time designers can become "tree whisperers" to detect and codify hierarchical domain taxonomies properly (for a wide range of useful metrics). But it's not clear when this point is reached and if anyone can obtain that ability or just "special" people. Time has to test designs to see if they are reasonably worthy, and the designer may be retired by then.

      and refactoring is necessary to adapt to that.

      I agree that code-rework after requirements changes are necessary no matter what technique is used, but that doesn't tell me why tree-OODM is "better" at flexing or better at anything else.

      Having some very good people on staff who get involved in these things, we generally do it right.

      There are masters of any paradigm/technique. There are COBOL GOTO masters who can write and read GOTO code fast and easy. If a GOTO shop can find enough of those experts, they are humming! (Newer COBOL doesn't have to rely on GOTO's, by the way, but there's a lot of old code floating around.)

      I suspect a lot of Grand Paradigm/Tool claims are purely personal: the tool fits YOUR mind(s) better. That's fine, but please don't extrapolate that to all minds and/or a universal truth without universal evidence.

    16. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      I meant that related functions/methods and state can be grouped under a local or virtual name.

      ref1 = new bigFooClass(...);
      ref2 = new bigFooClass(...); ...
      ref1.attributeX = 7;
      ref2.attributeX = 42;

      Here we assign a handy local shortcut reference name to each instant, and easily keep instance 1 (ref1) separate from instance 2 using our handy shortcut reference name.

      For example, in the old days if you had two files open at the same time, it was too easy to visually or actually cross-mix the file handles between instances.

    17. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      No I get that, and you're not wrong per se, but if either domain modeling or namespace management is what you looked for in OOP you severely missed the point. If I were to make a list of the things for which I find OOP useful, neither of those would be on it.

    18. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      Practical examples are welcome.

    19. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Based on our previous conversation I already know this to be a disingenuous request, and frankly you should be embarrassed to have made it. I'm not going to run a CS101 workshop for you. Read a book, come back when you can demonstrate a working understanding of what OOP actually means, and I will be happy to have an earnest debate about its merits in various use cases. As the person claiming that the majority of enterprise middle-tier application developers in the world are doing it wrong, the burden of proof is on you. And no, popularity does not equal merit, but it is perhaps something you should consider before claiming something you don't understand to be bunk just because apparently you have not found a use for it in your limited domain.

    20. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      You are exaggerating its popularity. OO domain modelling is dying out. Get some real science and real numbers, I'm tired of hollow opinions from blOOwhards.

    21. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Oh I see what's happened here. You think 'Object-Oriented Programming' and 'Object-Oriented Domain Modeling' are the same thing. Now I'm the one who's embarrassed for even engaging with somebody who has their concepts so backwards. You're wrong on both counts really, but being as how you don't understand either one well enough to distinguish them I suppose I should not be surprised.

    22. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      Wrong. My very first message I made a distinction. Read better.

    23. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Domain modelling is how OO was "sold" to us for roughly the last 2 decades

      Sure you did, by making the utterly ludicrous statement that domain modeling was the main thrust of OO.

    24. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Domain modelling is how OO was "sold" to us for roughly the last 2 decades

      Sure you did, by making the utterly ludicrous statement that domain modeling was the main thrust of OO.

      Note to Slashdot: apparently replying from a notification replies to the parent, Weak.

    25. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Oh I see, it's a max depth thing. Guess I've never had a tedious debate go on this long before.

    26. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      by making the utterly ludicrous statement that domain modeling was the main thrust of OO.

      It was the main thrust as promoted and taught. I used to blog heavily on OOP and followed that stuff closely. ("Reuse" was a close second, the 3rd being "fitting the way humans think", by my estimates.)

      Now whether that "should be" the main thrust is another matter, for I'm just reporting on human interest level in that spot; not tool value.

      The "value" issue gets back to the science and evidence debate: proving objectively that X is better than Y rather than "trust me, I'm smart" (beyond one or two narrow factors.) The opinion-to-science ratio is so very high in the OO biz. (Well, software engineering in general. Good SE science is expensive and nobody wants to pay for it.)

    27. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      It was the main thrust as promoted and taught.

      In 15 years of working with OOP I have never heard it sold primarily on the basis of domain modeling, and anybody who had done so would have been laughed out of the room. You seem to be confusing the common entry-level examples of 'automobile/car/truck', 'bookstore/book', etc. as representing some kind of mission statement on what OOP is about, which makes about as much sense as assuming from 'hello world' that it is about scripting. Had you stuck around long enough to learn design patterns, you would have found that these (poorly devised) initial examples cease to play a role rather quickly because OOP is about managing logic, not model entities.

      "Reuse" was a close second

      Better, but a vast oversimplification. I would give you more credit if you weren't 2 items into this enumeration without mentioning a single actual OOP principle.

      "fitting the way humans think"

      Humans do not think in compartmentalized regions of internally consistent logic assembled into 'correct by construction' higher level constructs. They are irrational and perfectly happy to proceed with actions and assumptions while lacking proof that they are valid or even while staring contradictory evidence in the face. This is the polar opposite of OOP.

      I used to blog heavily on OOP and followed that stuff closely

      In other words, "trust me, I'm smart". Snarky jabs aside, I would like to read these blogs, because to be honest everything you have said so far has been nonsense to me.

      by my estimates

      Would that be the 'real science and real numbers' which you directed me to acquire earlier without citing any references?

      Now whether that "should be" the main thrust is another matter, for I'm just reporting on human interest level in that spot; not tool value.

      Oh OK, so your actual thesis is 'people use tools incorrectly sometimes and that is bad'. On this we agree, but I'm still not sure why you felt that it was an appropriate entry into a discussion on OOP, within which nobody had mentioned domain modeling until you showed up. Here's a reminder:

      It turns out OOP can be a pretty good tool for name-space management in many cases, but it has stunk at domain modelling

      This is the kind of sentence that makes me feel absolutely confident in ending a candidate interview immediately and knowing that I have made the right choice.

    28. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      In 15 years of working with OOP I have never heard it sold primarily on the basis of domain modeling...

      My experience differs. It's quite possible the presenters were naive or "unqualified", but I'm not judging the quality of such claims/claimers in that spot, only their commonality. You tend to over-interpret specific statements of mine.

      nobody had mentioned domain modeling until you showed up

      There's a lot things they didn't mention. That's hardly a decent metric for industry presentation quantity.

      because to be honest everything you have said so far has been nonsense to me.

      The feeling is mutual.

      Would that be the 'real science and real numbers' which you directed me to acquire earlier without citing any references?

      It's purely my observational opinion. We don't have solid science/math/logic either way, so it's your word against mine.

      makes me feel absolutely confident in ending a candidate interview immediately

      I'm not here to please you and fortunately don't have to.

      Until somebody has solid science/logic/metrics* (SLM) to show that OOP is better for most or all parts of applications, it's merely opinions and anecdotal evidence. If you want to insist it's better, then find a way to present your case well rather than imply that skeptics are of low skill/intelligence. Makes you sound like a damned troll.

      Had you stuck around long enough to learn design patterns,

      The design pattern case was poorly presented. They should have presented a variety of implementation choices and come up with clear SLM to show that their implementation choice is the "best" choice. Many seemed like arbitrary implementation decisions to me. Often such choices will depend on the context or the domain and/or usage of the tool.

      without mentioning a single actual OOP principle.

      A principle is not necessarily a metric. Satisfying Principle X doesn't necessarily make a tool overall better. Generally one will be weighing multiple principles against each other because it's usually not possible to optimize them all at once.

      No escaping for the need for SLM.

      Humans do not think in compartmentalized regions of internally consistent logic assembled into 'correct by construction' higher level constructs. They are irrational and perfectly happy to proceed with actions and assumptions while lacking proof that they are valid or even while staring contradictory evidence in the face.

      Maybe, but if Ferengi's are going to be maintaining the code in the future, it may be a bad mistake to code for Vulcans. Car co's design cars for regular folk, not Indie 500 drivers. Perhaps you are making unrealistic staffing assumptions.

      * Beyond narrow/specific metrics, such as "scores high on the Fiddlebop Reference-Cycle metric. Too many people are happy to judge something on narrow or few pet metrics.

    29. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Oh man, now I am dying to read this blog. If this circular gibberish is what you come with when pressed, I really want to see what you can do when you take your time. Link, please.

    30. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      First you present your SLM evidence that it's usually better.

      A better source of my thoughts is probably the c2.com wiki. Discussions from many about many software engineering topics, including OO, are there. It's in read-only now, though, due to vandals.

    31. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      No I'd rather read your stuff, thanks. I Googled it, and I have to sincerely thank you - the first screen length was enough to ensure me that just because I am out of John Oliver episodes, I will not be lacking for entertainment for a while. Also the last few weeks have been a crunch for the team, and I am 100% serious when I say that I will be holding a morale meeting tomorrow so we can all enjoy it. Thank you for making this slog have a worthwhile destination.

    32. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      Sarcasm won't fix your lack of SLM.

    33. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Oh, you mean the nonsense thing which has never existed and you made up to move goalposts around? No thanks, I'm far too absorbed now with my new favorite humor blog. It's this comedic genius who wrote a satirical masterpiece exploring what happens when extreme hubris coincides with extreme incompetence and a touch of mental instability.

    34. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      I made up science? Just call me Francis Bacon Jr.

      Damned troll!

    35. Re:Domain modelling [Re:Shying away from OOP(s)] by GodelEscherBlecch · · Score: 1

      Objective science to prove the superiority of a programming paradigm, something which is subjectively ambiguous, which you disingenuously demand as if it exists (it doesn't), with every intention of rejecting it on tautologically 'reasoned' subjective grounds (AKA bullshit)? Yes, that is a thing you made up, and then tried to use it to push goalposts around so many times you don't even remember what argument you are failing miserably to refute.

      Re-read this travesty of rhetoric over again if you need a reminder: I never so much as mentioned the merit of OO relative to whatever lunatic scratchings you call coding, because that would be as idiotic as your 'I like hammers, screwdrivers are stupid' arguments, I am simply here to point out that you don't know what the fuck OO is in the first place, much less have anything coherent to say about it. Every tool has a proper place and use, and making relative value judgements between them is something fuckwits do when they only know how to use one thing. Sometimes they are so magnificently stupid that they demand that others prove with 'science' that one is better than the other.

      Now, you will be happy to hear that my actual argument is something for which I actually do have scientific proof, which you were so kind to provide in the form of your bumbling manifesto. Tell you what, post a submission here linked to your blog and let everybody know how you've rooted out this terrible OO hoax perpetrated on the industry. I'm sure you'll receive nothing but support and praise for your well-reasoned ideas, and that nobody else will do as I am currently doing and start slicing it up into hilarious quotes of the day to amuse the team.

    36. Re:Domain modelling [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

      you don't know what the fuck OO is in the first place

      Nobody agrees on the definition or formal characteristics.

      And nobody agrees on who gets to decide the definition. There is no standards body who defines what OO is. YOU are not it.

      Every tool has a proper place and use, and making relative value judgements between them is something fuckwits do when they only know how to use one thing.

      I've mentioned multiple times I do choose to use it to some degree. I've found practical utility for it under certain circumstances. So what is this "one thing"?

      how you've rooted out this terrible OO hoax perpetrated on the industry

      Well, okay, "hoax" is possibly a little harsh, but I do believe that OO-domain-modeling was thrust on the industry by hucksters wanting to sell books and consulting services; and millions, if not billions were spent chasing this false dream.

      The primary focus of these hucksters was in domain modeling. Therefore, other than a small blurb, I didn't used to make much of a distinction between "OO" and "OO domain modelling".

      A bigger distinction is made now in the industry because practical experience and failures taught many that domain modeling is NOT where OO shines. I know you disagree that domain modeling was the main stated selling point of OO, but we'll just have to let that disagreement stand (unless somebody can present reliable surveys of beliefs).

      Why does it matter to you anyhow? It's water under the bridge. I'm not understanding your complaint. It appears you want to make this all about me instead of OO. That's why you appear to be a troll. Non-trolls talk about the subject at hand. Say something about OO and than back your claim with evidence: that's not asking too much.

      You seem to agree there that scientifically comparing the utility of software engineering paradigms/techniques is either a gray art or requires resources not yet committed by anybody. Good, that part is mostly settled then.

  80. Choose appropriate solutions by Anonymous Coward · · Score: 0

    The topic for the article is almost as pointless as, "Which programming language is the best". The answer doesn't get much better than, "It depends". This is all about context. No programming language/technique is definitively 'bad' in and of itself. It's only 'bad' when the solution doesn't suit the context.

    Quoting from the article, a "masterful pile of engineering and computer science" isn't appropriate where you only need "one simple input". But a problem that justifies a "masterful pile of engineering and computer science" couldn't be summed up by "one simple input". You end up with thousands of "simple inputs" that are far harder to understand. The whole point of abstraction is to break down complex, overwhelming problems into discrete, comprehensible components. This really matters when problems are so large that only a team of people can deal with them. But it would be a colossal waste of time for problems on the scale of a single spreadsheet macro.

    The article would have been better titled, 'Choosing appropriate solutions".

  81. Goto: Knuth by golodh · · Score: 1
    @jomegat

    I agree. Just look at Donald Knuth's algorithms and see how "while structured" they are. Well ... they aren't.

    I thoroughly understand the need to keep vast wodges of code structured, modular, and (if possible) even while-structured. But when it comes to the core algorithms (numerical or non-numerical) buried deep in library routines, CSC dogmatism should (and usually does) go out of the window.

  82. reinventing the wheel by Anonymous Coward · · Score: 0

    Open source advocates are especially against this bad idea, but often reinventing the wheel saves time, because it takes time to find the code you want in some open source program, especially if you need to understand it. I know expert level programmers who have all but mastered OpenGL in a day, but few can gain that level in a day, sometimes it takes not so long to write your own OpenGL equivalent ( extreme example :)), but you know what I mean, sometimes just doing it yourself is better for the project.

  83. How about this one ... by Qbertino · · Score: 1

    A guy I know connected the xml-socket datastream of a very large media/music database of a very large global media corporation wth the online service of a very large global telco provider with a sed script he wrote in 30 minutes. They paid him 15000 Euros per month for a few years to mainain it / guarantuee a reaction time of und 60 minutes, not really caring for the details.

    Thinking twice about this had me conclude that there probably is no better tool for this job than said sed script. Imagine the hassle and flakyness with some large convoluted Java Appserver setup requiring extra hardware with failovers and stuff.

    --
    We suffer more in our imagination than in reality. - Seneca
  84. Nested tree to do audio processing by joel2001k · · Score: 1

    It even makes sense but I hate it somehow. http://www.nongnu.org/gsequenc... http://www.nongnu.org/gsequenc...

  85. Too many lambdas by Anonymous Coward · · Score: 0

    While lambdas are great for some things i had a new guy write a year of his software with lambdas anywhere that could be used. I had to get used to reading code backwards, it was like learning to ride the backwards bicycle.

  86. Variable naming conventions by Anonymous Coward · · Score: 0

    The worst code can be easy to fix and follow with any naming convention that uses long meaningful variable names.

    The best code gets dusty and rewritten if single letter and hard to follow var names are used.

    Pick a way and use it, even if its not the latest cool way, follow it.

  87. Spotted the millenial by Anonymous Coward · · Score: 0

    Did you really just say that the epitome of common sense, the hierarchical filesystem, is a bad idea? If so, spotted the millenial.

    1. Re:Spotted the millenial by OrangeTide · · Score: 1

      Sorry, I'm an old bearded unix guy. I've even worked in the storage industry on file systems. My experience doesn't automatically make anything I say correct, but you may want to take me seriously if I point something and say "you should think harder and not make assumptions about this design".

      --
      “Common sense is not so common.” — Voltaire
  88. Windows by Anonymous Coward · · Score: 0

    Microsoft's OS is really bad software, but seems to work well enough to gain a monopoly.

  89. Windows 10 by Anonymous Coward · · Score: 0

    Windows 10

    1. Re:Windows 10 by Anonymous Coward · · Score: 0

      ANNIVERSARY UPDATE AVAILABLE -- Check for it at your local FBI Kiosk.

  90. Whatever gets the job done by m76 · · Score: 1

    If it's a stupid idea and it doesn't get the job done, then it's just a stupid idea.
    If it's a stupid idea and it gets the job done, then it's a brilliant idea.

  91. OO by Anonymous Coward · · Score: 0

    Object oriented programing. "Why shoudl I care how it works?" coding at its finest.

  92. No One-size-fits-all set of principles by John+Allsup · · Score: 1

    Personally, I detest large programming projects. For me, if I need over 1000 lines of code, I am using the wrong language or the wrong framework.

    If you are writing a 10-line function, which you can see in a single eyeshot, you can sensibly use single-letter variables and understand what stuff does, just as traditional mathematical notation does. If you are writing a sub 100-line script, again, techniques developed to manage 100,000+ line projects are inappropriate, wasteful, and tend to turn that 100-line script into a 10,000-line behemoth.

    When you write something, it should be clear from reading the source what it is meant to do, how it does it, and hopefully why it looks the way it does. It is also helpful if it actually works, but given a preference, I would rather have clarity and succinctness first, since then if it doesn't work, it won't be that hard to fix. On the other hand, if it does work for its intended use, and that use changes slightly, you're stuffed.

    So to now answer the question: just about any commercially available software is an example, just about any OS, including Windows, OSX, and any Linux distro is again an example. Stuff that I don't consider 'bad ideas that work' are rare gems. But there are not enough of those rare gems for practical purposes, so I put up with Windows, OSX and GNU/Linux for now.

    --
    John_Chalisque
    1. Re:No One-size-fits-all set of principles by david_thornley · · Score: 1

      The software I mostly work on is complicated, and has many thousands of lines. If you'd rather not work on it, that's fine, but somebody's got to.

      --
      "When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
  93. 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.

    1. Re:Views are extremely helpful in such cases by Tablizer · · Score: 1

      Views only help on the output side, not the input side. If you split domain nouns up into bunches of little tables, then you often have to manage the updating of bunches of little tables. The input screens and/or update ordering may not match the table divisions. Even if they start out that way, they may grow apart over time.

      I have to agree that over-normalizing tables creates difficult-to-use and slow systems in general. There are exceptions, but they are probably dumb luck rather than from genius high-level-normalization experts. And you don't know up-front which of these box of chocolates you are getting under high normalization: genius-split tables, dumb-luck-good tables, or PITA tables. I usually encounter the PITA ones.

    2. Re:Views are extremely helpful in such cases by ADRA · · Score: 1

      "The input screens and/or update ordering may not match the table divisions"
      That's where controller layers comes in. Having a naked CRUD UI to direct DB modification may be stupid simple, but it usually means there's no business logic to the application. Sometimes you need direct write access to some tables, but only really naive systems need direct access write to all tables. Use the controller backends / ORM in most languages these days to do the heavy lifting bridging the two.

      Eg. ISP
      I issue two IP's to the customer and I could code my table:
      Customer Name, UID, IP1, IP2
      Super simple and will meet my business needs until.. I decide that I need to add a third IP, but only for business customers that pay be more. Now I need a few tables to model the problem. On the UI when I'm editing, I could still model 4 fields when I choose to edit the regular old consumer class customer, but in the middleware, you're adapting the customer records from a few tables to throw on the screen properly.

      If you're simply representing data for data entry / raw query speed / egress performance, etc.. you're probably not caring much about the greater system, or you're making it very brittle for any new enhancements.

      --
      Bye!
    3. Re:Views are extremely helpful in such cases by Tablizer · · Score: 1

      Middle-man layers create more busy work and more layers to change when requirements change. They are often a favorite for consultants who want to gold-plate the application/system to run up their charges.

    4. Re:Views are extremely helpful in such cases by ADRA · · Score: 1

      Or, you know, any sort of system with even moderate complexity. You can ad hominem till the cows come home, but it won't make your argument right.

      The last time I worked on such a system like described, we had around 200 tables with something like ~10000 columns. I'd say half were modified with CRUD front-ends (or at least master-detail derived editors), and the rest were driven by business processes related to workflow management, automated batch processing, and externally triggered events. You don't tell data entry staff to figure out a vastly complicated business application that even with years of training, they won't necessarily master. You walk them through the process by wizards, lots of validation, a view of the data which is relevant to their present requirements ....

      --
      Bye!
    5. Re:Views are extremely helpful in such cases by Tablizer · · Score: 1

      I don't understand. I'm talking about application developers and DBA interaction. What do data-entry operators have to do with anything? I said nothing about UI's. There appears to a misunderstanding here. And I'm not against views.

    6. Re:Views are extremely helpful in such cases by Tablizer · · Score: 1

      Correction,

      I did mention UI's when I said: "The input screens and/or update ordering may not match the table divisions"

      But that's not something users (data entry operators) are concerned with. My suggestions are not about how to design front ends.

      I'll give a more explicit example. Suppose a given draft table has columns A, B, C, D, E, and F.

      There are currently 3 draft CRUD screens in the design, Screen 1 that updates columns A and B, Screen 2 that updates columns C and D, and Screen 3 that updates columns E and F.

      A new architect comes along and decides to add "higher normalization" by splitting the table into 3 tables that match the screens: table T1 has columns A and B, table T2 columns C and D, and table T3 with columns E and F.

      It's perhaps okay for now, but later the screens are changed into two screens where the first one modifies columns A, B, and D, while screen 2 modifies C, E, and F.

      Not only do the new screens no longer match the existing (split) tables, but now each screen has to access two tables where before it only had to access one. The split has served no useful purpose and makes the app more complicated and slower.

      Perhaps there is or was some "conceptual" value in the split, but it's either no longer relevant, or of small value.

      One could make 3 views instead if there is some conceptual value in splitting and leave the original "wide" table in place.

      And I don't see what your "IP" example saves. You still have to modify the middle layer. Unless there is a high "share count" to modified parts, it's a waste of layers. Use subroutines or views for JUST the highly shared parts rather than put a middle layer for everything for speculative future sharing. Factor out actual duplication only.

  94. hmmmm - thoughts by Anonymous Coward · · Score: 0

    Work is like "best" - it is meaningless without a rubric.

    The question behind the question is therefore what are some measures of goodness that are served by having what a good programmer would call "crap code"?

    Good, fast, cheap - pick two. This means that cheap and fast are going to exclude good.
    Better is the mortal enemy of good enough. This means that a line is drawn and as soon as the product is over the line, it is shipped. (Microsoft mentality)

    Versions of Fast
    - Minimum viable product
    - No documentation, or maintainability
    - political appearance of progress
    - quick fix for today with intent to wholly rebuild next week

    Versions of Cheap
    - Off-shored work done by hacks for pennies on the dollar
    - Done by college students in a garage

    Malicious hiding
    - hiding talent in hacks, or cracks by making it look like a robbery instead of an assassination
    - Trojan horses in the allegory sense, not the password catcher. More common in ransom-ware.

    Non-malicious hiding
    - sharing the brunt of a problem in a public forum without disclosing/revealing underlying IP

    Fast/Cheap mix
    - no documentation
    - no reproducibility
    - no annotation
    - no test cases
    - if the build fails try again because it might work next time .... instability of the tools

    Sometimes cheap is about the tools, not the developer.

    There is "crazy" or "divine" depending on perspective. (TempleOS)

  95. 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.

    1. Re:8 levels deep normally means function too big by Half-pint+HAL · · Score: 1

      Indeed, if code is nested 8 levels deep, four or more of those levels should probably be separate functions. The first function might be:

      That's a procedure, not a function.

      OK, so I'm being pedantic, but I'm actually a big fan of functional programming as a way of thinking, and the more I reduce my code to short subroutines, the more it bugs me that I am still writing procedural code rather than functional. In your example, procedural imperative code works best (by avoiding the need for recursion), but it's still true that FP (where suitable) very quickly forces you to produce functions that can be analysed within human working memory.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    2. Re:8 levels deep normally means function too big by Half-pint+HAL · · Score: 1

      On a different note, the nesting of procedures is generally another of the bad-ideas-that-work, because they introduce unnecessary context switches. Unless you have a decent compiler, in which case it optimises smaller procedures out as macros, in which case it is better all round. One of the things that niggles at the back of my head with Python is that when I try to write neat code, I'm always aware that ever single call is a call, so there's the efficiency hit in context switches. But I do it anyway, because I want to understand my code in a week's time.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
    3. Re:8 levels deep normally means function too big by Anonymous Coward · · Score: 0

      Human working memory can hold about 8 items at a time, in this case 8 lines of code. Which means [...]

      Excuse me, are you 12 years old or something? What twisted logic makes you say such an absurd thing? Yeah, yeah, we've all heard the whole human mind only can remember 7 things bullshit. Even if that were true, that's not how we process source code. We don't remember exact lines. We conceptually reduce lines and blocks of code to what they generally do as a concept, not as a sequence of characters. A good programmer can handle dozens if not hundreds of lines this way.

      In the opposite case, it's possible to have an extremely difficult-to-understand 8-line function when the code is performing some subtle calculations or loop. "8 lines" doesn't mean simple or complex. 8 lines is just 8 lines.

      Many 30-line functions are easier to understand than some 8-line functions, and vice versa.

      You should stop going around saying all this nonsense about 8 lines as if it were some magic threshold. It's not even a rough guideline.

  96. 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.

    1. Re:Flat files... by Tablizer · · Score: 1

      Reminds me when I wrote a full-screen text editor in Fortran for the Prime mini-computer the org had because I got tired of the command-line editor. It caught on and clerks started using it for customer support call screen text editing. (One could purchase FSE's, but the org was a penny-pincher.)

  97. Any programming language because by Anonymous Coward · · Score: 0

    By the time you figure out how to do what you need to, the requirement has changed. And the language you used, no longer fits the bill.

  98. Manual loop unrolling, with goto's by Theovon · · Score: 1

    Thank the language gods for gotos.

    I had written this tree-traversal code that I was trying to optimize, because although it was a O(log n) solution, it was slower than the O(n) solution for many of the problem sizes I was dealing with. Unfortunately, I couldn’t just choose one or the other dynamically because the data structures were completely different. Using a pragma, I got the compiler to unroll the loop, and that helped a LOT because there was this array of constants that got nicely integrated into the unrolled loop code. While I was looking at this, I realised that there was this one branch that there was this one if condition where if it was ever executed at all, and it was true, I would bail out, while if it was executed and was false, it would never become true. So what I ended up doing was defining some macros kinda like this:

    #define M1() \
    if () { } else { goto the corresponding next M2 macro }

    M1(0)
    M1(1)

    #define M2() \
    label: \
      doesn’t include the if.

    M2(1)
    M2(2) ...

    That just about doubled the performance. It could probably be better. Because of commonalities between the two macro expansions, LLVM thinks it’s clever and rearranges code so that I have a bit of a spaghetti of unconditional jumps. I was also getting some really weird instruction sequences, like:

    lea EAX, [expression]
    mov EBX, [EAX]

    Why not combine those into one instruction? As far as I could tell, this value in EAX was never used for anything else. I also saw this a few times:

    mov EAX, EBX
    mov ECX, [expression involving 8*EAX]

    Why not just us EBX directly?

    I thought about reporting this as a bug, but the instant I tried to make an isolated test case, the anomalies disappeared, so what I did was separate this code into its own compilation unit (which I had planned to do anyway, wrapping it in a C++ class). Oddly, even without the code anomalies, the speed wasn’t measurably different. On a modern x86 processor, hardware instruction parallelism can slip lots of extra instruction in basically for free, especially when there are memory accesses going on that might be an L1 miss.

  99. XML by pinkushun · · Score: 1

    I firmly believe in the axiom: Use XML as a solution, and then you have two problems.

    It's astounding how proliferant such a shitty data structure has become.

  100. VBA by pinkushun · · Score: 1

    In-house product integration and automation was a marvel in it's time.

    It's legacy, now, is a generation of companies locked-in to one platform, product and age. And a living nightmare to maintain it all.

  101. Don't use "perfect" products. by Anonymous Coward · · Score: 0

    Being a webapp developer I have to deal a lot with fanboys and con-artists.
    If something is "perfect" it's usually because of one of two reasons:
    1) Either it's unpopular and nobody uses it, or 2) it's become so popular that everyone is afraid to bad mouth it.
    Either way, perfect products are hard to support because nobody discusses issues with them.

  102. Host Application on Windows Server by darktwains · · Score: 1

    Host Application on Windows Server

  103. nano-penny efficient or $1,000 efficient? by raymorris · · Score: 1

    > when I try to write neat code, I'm always aware that ever single call is a call, so there's the efficiency hit in context switches.

    On the topic of efficiency, given the choice, would you rather use up a resource that's worth a penny or a resource that's worth $1,000?

    Suppose the function call takes 50ns of CPU time. Suppose we hit that function call a million times. The total cost of a million function calls is about 50 milliseconds. Let's convert that to dollars. Suppose a CPU core costs $350 and lasts 157680000000 milliseconds. So a million function calls cost $0.0000000002.

    Your time costs approximately twice your salary (the company pays for your office, your computer, your health insurance ...). Suppose you are cheap, you make $50K / year. That means you cost $100 / hour, or $1.66 / minute.

    One minute of your time costs 830,000,000 times as much as a million function calls! If you spend one minute of your time ($1.66) to save that function call ($0.0000000002)

    Suppose the function were called a TRILLION times. It still costs 830 times less than spending a minute of your time on it.

    The most efficient thing is to save yourself the time. Unless the function is called a QUADRILLION times, it is wasteful to be worrying about it.

    1. Re:nano-penny efficient or $1,000 efficient? by HornWumpus · · Score: 1

      Local function call != Context switch.

      Still has overhead, but nothing like a context switch.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    2. Re:nano-penny efficient or $1,000 efficient? by Half-pint+HAL · · Score: 1

      Local function call != Context switch.

      Still has overhead, but nothing like a context switch.

      But macros only have overhead at compile-time. I was basically lamenting the lack of macros in Python. Python is far too dynamic.

      --
      Got them moderator blues I blieve I walk out the do', With these mod-points I been gettin', I 'most never post no mo'
  104. Re:Jquery by Anonymous Coward · · Score: 0

    You can add Jquery to the list as well. It functions okay unless you need to modify/custom it. It's bad enough, I no longer admit to knowing anything "language" which corresponds with web pages.

    PHP is nasty, but not as bad as trying to 'correct' XML by hand. All of the IDEs I played with have a issue with cleaning its own code.

  105. 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.

    1. Re:Dear Square Peg by Tablizer · · Score: 1

      Okay, but please don't extrapolate this to managing personnel: it sounds painful.

  106. People confuse "old" and "bad" by rbrander · · Score: 1

    The last several years of my career - which was as an engineer that did a lot of programming, not a programmer...but the IT department was so hard to get hold of, or get results from, I ended up doing a lot of "favours" around the office -- I did a bunch of web pages with perl scripts.

    I never got into Javascript or even much DHTML, so these looked like 1993 web pages. They had a few simple forms with a couple of text boxes, a radio button set, etc. You could get customized reports with them that IT just didn't have time for...and I could customize in a new feature in an hour or two. So they grew like coral over a few years, and we ended up with several of them before the requests wound down.

    IT was not happy...not because I'd used poor programming practice. (I have a CompSci degree too, I know how to comment and write clear code.)

    No, IT thought it was awful because of the 1990's Perl/CGI-gateway architecture; only Microsoft tools should be allowed, this was unmaintainable, etc. ("Unmaintainable" continued after a junior engineer took over maintenance when IT wouldn't. He had the code figured out in a few weeks.)

    I guess my point is you need to put "Bad" in quotes, because it's always an opinion...and lots of people mistake "bad" for "not the current fad".

    The entire reason this worked is that these were *small* problems; IT could have done them easily, but each report only served a few people and IT was consumed with Big Systems that served everybody. That's also why there were just a few of them needed, it was a small "market". So I guess another point is that you don't always have to use the giant Official Corporate Development Environment Hammer to hit every nail. Those are chosen to be able to handle Big Problems, but the overall bureaucracy can be too heavy to nimbly solve small ones. Be open to small, simple, script-sized solutions. IT people constantly call those "Bad", usually with dire warnings that they will grow and become spaghetti-code monsters that will suck up all your money.

    With respect, what the F do they know? They only get called in for those monsters. They may be unaware there are twenty times as many out there that did NOT grow into monsters and the small solution was just right and ran for a decade. So the next time you're pretty sure you just have a Small Problem, tell IT to stuff it and solve it yourself.

  107. Software that controls Software by Anonymous Coward · · Score: 0

    Sometimes, when my software stops for no apparent reason once every few weeks/months, it takes too much to figure out what's wrong with it, so I just re-use a piece of software that checks if it's on or off and restarts if needed. Sort of automatic recovery in windows services.

  108. Operator <- by Dalzhim · · Score: 1

    This gem was posted on reddit recently :

    Operator <- : http://www.atnnn.com/p/operato...
    Reddit thread : https://www.reddit.com/r/cpp/c...

  109. Javascript by Anonymous Coward · · Score: 0

    it may be ugly to the purists but it gets the job done

  110. Using Serialised Data as a Config File by coofercat · · Score: 1

    When you can't be arsed to write a config file parser and you decide to just use a blob of serialised data as your config, you're making a mess for everyone who uses your software. That said, lots of people seem to be doing it. My pet gripe at the moment is RabbitMQ, but there are plenty of others (sendmail definitely, nginx maybe).

  111. Bad programming ideas that work. by Anonymous Coward · · Score: 0

    Programming.

  112. De-normalizing views are updateable if the base by raymorris · · Score: 1

    > Views only help on the output side, not the input side.

    Not normally true if your base tables are in normal form.
    If your base tables are *not* normalized, updates (through views or otherwise) are a crapshoot. If the base tables are normalized, you can update them through a de-normalizing view.

    Aggregate views (reports) are of course not updateable. Updating an aggregate would cause your totals to no longer match your detail records. That's a good thing.

    1. Re:De-normalizing views are updateable if the base by Tablizer · · Score: 1

      If the base tables are normalized, you can update them through a de-normalizing view.

      I had a long debate with a dude once over how much to normalize. After a heated debate, we both eventually agreed that IF the RDBMS were well designed, everyone could have the views they want: low-normalized and/or high-normalized, and they'd all be update-able (within reason). It wouldn't be either/or.

      One would be able to select (and perhaps make) the "view-name-space" they wanted and everyone would be happy: it's all virtual and relative.

      If the RDBMS ran faster with the de-normalized version (or vice versa) under the hood, the DBA could decide run (change) it that way and the views would continue to work as-is: nobody would know it was changed under the hood.

      But in practice RDBMS don't support such virtualization/abstraction well, and with the way they are now, a "lowish" normalization is usually better.

  113. love em! by Anonymous Coward · · Score: 0

    GOTO, I LOVE the goto command. No messy loops, just jump straight to the line you need. But that's considered "bad programming" Pssshhh!

  114. polling by micahraleigh · · Score: 1

    I've seen polling succeed in places where complicated registration processes maintain a lot of failed connections and crash.

    Seems to work good when only a few clients are involved.

    This has mostly been with socket programming, but the web socket stuff is getting so easy to set up now it might work better than polling.

  115. 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.

    1. Re:Web Stack Sucks Rotting Eggs [Re:Bad Ideas] by Anonymous Coward · · Score: 0

      I wasn't even considering the QA aspects, maintenance burden or user experience; just the friggin' API it presents. But yeah, all that too.

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

      Good god, get a JS display component framework. I haven't cared what browser / device / resolution anybody is using in years. I like Ext-JS, but there are plenty of others just as good.

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

      Ext-JS is known to have a long learning curve, has cryptic or missing error messages (blank areas instead of messages), and is sluggish to load because of its fat libraries.

    4. Re:Web Stack Sucks Rotting Eggs [Re:Bad Ideas] by GodelEscherBlecch · · Score: 1

      Well, I can tell you that I have used it to implement a web application that is complexity-wise on par with an IDE and I have observed none of these things. I also like it because largely, when it is deficient in some area, it is fairly easily to get down under the covers and tinker. But, like I said, there are plenty of other frameworks out there - my point is that abstracting yourself from the DOM is a good thing if you are worried about browser cross-compatibility. For anything of a relatively large scale, I don't think it is worthwhile to deal directly with the DOM any more than it is to write your own XML/JSON parser, hand code AJAX requests, code directly against the JMS API, etc. Somebody else has already spent more man-hours than you will ever have at your disposal on making abstraction layers to these things, and with some judicious evaluation up front, their foibles tend to outweigh the cost and risk of roll-your-own.

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

      my point is that abstracting yourself from the DOM is a good thing if you are worried about browser cross-compatibility.

      But browsers change. Changes to their DOM engine in the future can and do break abstractions. Vendor security fixes quite often introduce unintended consequences, for example.

      And the bigger the abstraction layer, the more that can go wrong. I run into UI gizmos on other big-name sites that are broken or half broken all the time. They too used a library.

      The DOM is already a UI abstraction layer. The UI libraries people put on top of it are also an abstraction layer. Thus, it's a double layering, and both lawyers either suck or are unstable over time. Too many layers.

      Somebody else has already spent more man-hours than you will ever have at your disposal on making abstraction layers to these things

      Not enough, they suck. And even if they had an army of a billion techs, they still cannot anticipate future browser changes. Works today but trips tomorrow. And the libraries often fall out of style after a few years and lose support. You can say, "well X didn't fall", but how is one going to know ahead of time.

      Maybe the newer generation just got used to unstable UI's and accept fiddling and fudging and launching the app in browser B when it hoses up under A. Maybe I should just embrace UI suckage like the youngbies do and live with shit.

      You look at the guts of the libraries and see shit like:

      if (chrome) {
        if (version between 3.85 and 4.1) {
          fudge.fiddle(x, y, z, shoesize);
        } else {
          fiddle. kludge(x);
        }
      }
      else if (IE or Opera) {
        if (ie.version < 8.3) {
            kludgify(fiddleFactory(x, y));
        }
        foo.bar()
      } else if (firefox) {
        thingy2.rotate();
        margin.delete();
      } else {
      // guess by checking return results
        stuff = try.dom.activity7();
      // I'm not making that up: code often does
      // feature detection by trying the feature itself:
      // The test-pilot approach to programming.
      ...
      // (Slashdot F'd my indents.)
      }

      Just admit it, we are collectively doing it wrong. Humanity fucked up our UI "standard". The HTML stack was fine for general simple brochure-like pages, but is a crappy desktop app wannabe.

    6. Re:Web Stack Sucks Rotting Eggs [Re:Bad Ideas] by GodelEscherBlecch · · Score: 1

      Of course those frameworks have crazy kludge on the inside - that's the point of the abstraction layer. It's not their fault that the implementation of the HTML standard is a ruinous disaster, they just help you mitigate that and free your own time to do what you are actually being paid to do.

      You may not have noticed that I did not enter this thread in defense of HTML as the holy grail of UI, I was responding to your solicitation for other ideas. You have a lot of reasons for why enterprise-level frameworks with dedicated dev/support teams will always suck because the standard is so busted, and yet somehow these are also reasons why you are better off trying to solve the same problems yourself. I don't follow your logic, but hey - do as you will, you are not on my budget.

      I don't really want to try to debate this with you further (I get enough of that at work, and I know it is futile), but I just want to say this since you seem like a smart guy and there is a remote possibility that it will be received as honest advice, not a slight: this is a classic case of not-invented-here syndrome. If there were a DSM-IV entry for it, these would be the textbook rationalizations about how 'framework X has a subset of things I don't like' or 'tool Y may lose support' or 'too many layers'. People who come to budget arbitrage and architectural review with these types of arguments tend to have their R&D funding cut where I work. In the end, we are responsible for delivering software with high-level functionalities on a fixed timeline and budget, not being proud of writing our own TCP socket interfaces. The quantity of software demand in the world is beyond what can be achieved if we don't leverage the tools and experience of others.

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

      Of course those frameworks have crazy kludge on the inside - that's the point of the abstraction layer.

      The complexity, bugs, and instability of the underlying layer is leaking into the abstraction layer. You can only hide so much crap behind an abstraction layer. If the bottom layer were a fixed target, then one could eventually throw enough labor into the abstraction layer to work around all the problems. But it's a moving target.

      and yet somehow these are also reasons why you are better off trying to solve the same problems yourself.

      I don't understand what you are saying here. I'm not against abstraction layers, only saying they can only fix/hide so much.

      In the end, we are responsible for delivering software with high-level functionalities on a fixed timeline and budget

      I am not talking about individual projects, but rather that we need industry-wide standards better tuned to our needs. Essentially everyone wants to have/build desktop-like applications that are housed on networks instead of local harddrives/storage.

      HTML/DOM/JS was NOT originally built for that at all. They have been stretched like the mother of all taffy try to become desktoppy, but the results so far are really ugly for users, developers, and bandwidth.

      I'd like to see universities experiment with multiple draft GUI-over-network standards to try to find/build a standard that actually has the correct goal in mind.

      Ideas to try include but are not limited to:

      1. Moving the formatting/flow calculations to the server, making the client a dumb (simple) coordinate plotter of vectors and polygons.

      2. Add interactive elements to PostScript and/or PDF.

      3. Improve on X Window standard to handle input feedback latency better.

      4. Create a GUI Markup language with more of the common desktop GUI idioms like drag-and-drop, MDI (sub-windows), data tables, expansion trees, menus, tool-bars, panel tabs, right-click menus, etc. The browser/client shouldn't have to re-load the implementation code for these on every website it visits. That's not rational.

      5. Fail-friendly animations. Certain fancy animations could be built into the standard, or perhaps as add-ons, but in such a way that if they are not implemented in a given client/browser, then useful behavior still exists. For example, a button could be defined as throbbing if the mouse hovers over it. But if a client doesn't want to implement throbbing, it can default to a shade change or an outline color change on hover. In other words, throbbing is indicated as the preferred way to indicate hovering, but still have a default way to indicate hovering if the preferred indicator is not available or not installed.

      The result may end up borrowing from lessons of each of these experiments and others.

      These experiments will only happen if enough agree our current standards suck badly. It appears to me that most developers don't care because esoteric messes are job security. Easier UI building will put many of us out of work. I care because I'd rather focus on business logic (domain issues) rather then buggy scroll-bars, text that mushes together on IE 9.48237 but not IE 9.48238, dialog boxes that pop up blank on Chrome version 7.34928 or whatnot.

      GUI's have been around 40 odd years, building them shouldn't be fucking rocket science anymore. That's not rational.

      Rockets are actually easier because physics doesn't change and is the same everywhere, but not DOM. Rocket engineers are probably saying, "Guys, fix your damned rocket: this isn't DOM Science!"

    8. Re:Web Stack Sucks Rotting Eggs [Re:Bad Ideas] by GodelEscherBlecch · · Score: 1

      OK, now we are just talking past each other. As I said already, I am in full agreement with you that HTML is a clusterfuck. You solicited options (I assumed 'stop using HTML' wasn't a viable one) , I suggested one, you rejected it. No biggie. Good luck (not sarcasm).

  116. Anything to do with Microsoft's networking stack by Medievalist · · Score: 1

    From the original unscaleable unsecured NetBIOS implementation all the way to the currently supported kerberized sorta-NetBEUI over IP, Microsoft's networking stacks have always been *vastly* inefficient - both on the wire and in the node. It's a grotesquely bloated implementation of a horrific design.

    However, Microsoft has *always* (well, since Win3.11 wolverine, anyway) provided good support and consistent implementation, keeping their security patches and OS upgrades from breaking connectivity pretty reliably. This contrasted so strongly with 3rd party stacks like Novell, Banyan, &etc. that most of the 3rd parties have gone out of business! It just wasn't worth the hassle of having Microsoft updates constantly break every PC's network connectivity and having to schlep around floppies of 3rd party network stack patches, so we all settled for the really bad MS networking stack that requires far less maintenance, and made up the difference with hardware.

  117. A thunk hack by dakra137 · · Score: 1

    I think the following could be considered a thunk hack:

    This was an IBM 1130, where integers were 16 bits, but Extended Precision Floats had a 32 bit significand. I wanted to be able to float 32 bit integers. I wrote an EFLOAT(J) function in Assembler. It returned an extended precision FLOAT, but totally ignored the input parameter, except for stepping past its address when returning. Actual usage was, E=EFLOAT(K*L), where E is an extended precision float, and both K and L are integers. I knew that integer multiplication actually produced a 32 bit result spread over two particular registers. EFLOAT floated whatever was in those registers, still lying around from the function call. It totally produced the wrong result if you actually called it with just an integer variable as input.

    Would it have been less obtuse to write the function as taking two integers and multiply them inside the function, EMFLOAT(J,K)? Sure, but less fun.

  118. Hard Coded Interface by Anonymous Coward · · Score: 0

    I had to write an interface between 2 applications on an AS/400. The apps were surprisingly similar in certain key ways, and crucially in the way they defined Companies (these were explicitly multi-company systems).

    However there was a problem. Company 099 in System A could map to Co. 099 in System B, but in Sys B it was also in a different set of libraries. Uh-oh. I raised the issue in design and was directed (against my wishes) to hard-code the mapping.

    The crazy thing was, it worked! It was nasty, inelegant, hard-coded wrongness. It worked though because all the structures I mapped, were totally static in the real world. It could all have been changed theoretically, but in practice it never was. No one ever even asked to do so. Turned out to be one of the highlights of my career, an interface that was in the most sensitive part of the system you could imagine, and it never failed. Ran perfectly for 7 years.

  119. Tri-State boolean by Anonymous Coward · · Score: 0

    sometimes it just has to be done...

  120. Solution looking for problem by Anonymous Coward · · Score: 0

    First, if you have millions of jpegs (to use your example) in a single directory, and you actually have a good reason (besides laziness) to keep them all in that single directory, then you probably also have a plan to deal with them efficiently.

    Second is the issue of trust. I simply trust myself and my organizational skills more than I trust you or your software. I would never rely on some arbitrary piece of software to eliminate the "burden" of organization. Perhaps it's a reasonable approach for the computer illiterate, but for me it's yet another solution looking for a problem. What's next, the computer wiping your ass?

    1. Re:Solution looking for problem by DidgetMaster · · Score: 1

      Who said anything about all your JPEG files being in the same directory? Maybe you only have a dozen of them in your whole volume, but if you don't know what folders they are in, you might have to search through 50,000 folders and 10 million other files to find them. Even if you originally knew where you created them, some person or application can move them or rename any folder in its path. Also who said anything about the system doing all the 'organizing' for you? You are still the one who puts on any tags that you want or makes each object a member of whatever groups you want. My system simply gives you better tools for doing that rather than forcing you to put a file in some folder somewhere as a means of classification.

  121. Global variables by chriswaco · · Score: 1

    Everyone knows global variables are bad, but when you need to ship an app soon and would have to modify a dozen classes and methods to transmit one tiny piece of information from the top level of an app all of the way down to the bottom (or vice versa), a global variable works nicely.

  122. F B I == F B I == F B I by Anonymous Coward · · Score: 0

    This site is social engineering.

    SIGINT/HUMINT

  123. Worse is Better by T.E.D. · · Score: 1

    The prototypical example comes from the 1991 Usenet post The Rise of Worse is Better. The basic idea being that its better to push out something simple and get it into user hands than to always be trying to do the Right Thing. Sort of the larval stage of the concept iterative design (but without any formal planned iterations).

    I and just about every designer of Common Lisp and CLOS has had extreme exposure to the MIT/Stanford style of design. The essence of this style can be captured by the phrase ``the right thing.'' To such a designer it is important to get all of the following characteristics right:

    • Simplicity-the design must be simple, both in implementation and interface. It is more important for the interface to be simple than the implementation.
    • Correctness-the design must be correct in all observable aspects. Incorrectness is simply not allowed.
    • Consistency-the design must not be inconsistent. A design is allowed to be slightly less simple and less complete to avoid inconsistency. Consistency is as important as correctness.
    • Completeness-the design must cover as many important situations as is practical. All reasonably expected cases must be covered. Simplicity is not allowed to overly reduce completeness.

    I believe most people would agree that these are good characteristics. I will call the use of this philosophy of design the ``MIT approach.'' Common Lisp (with CLOS) and Scheme represent the MIT approach to design and implementation.

    The worse-is-better philosophy is only slightly different:

    • Simplicity-the design must be simple, both in implementation and interface. It is more important for the implementation to be simple than the interface. Simplicity is the most important consideration in a design.
    • Correctness-the design must be correct in all observable aspects. It is slightly better to be simple than correct.
    • Consistency-the design must not be overly inconsistent. Consistency can be sacrificed for simplicity in some cases, but it is better to drop those parts of the design that deal with less common circumstances than to introduce either implementational complexity or inconsistency
    • Completeness-the design must cover as many important situations as is practical. All reasonably expected cases should be covered. Completeness can be sacrificed in favor of any other quality. In fact, completeness must sacrificed whenever implementation simplicity is jeopardized. Consistency can be sacrificed to achieve completeness if simplicity is retained; especially worthless is consistency of interface.

    Early Unix and C are examples of the use of this school of design, and I will call the use of this design strategy the ``New Jersey approach.'' I have intentionally caricatured the worse-is-better philosophy to convince you that it is obviously a bad philosophy and that the New Jersey approach is a bad approach.

    However, I believe that worse-is-better, even in its strawman form, has better survival characteristics than the-right-thing, and that the New Jersey approach when used for software is a better approach than the MIT approach.

    Let me start out by retelling a story that shows that the MIT/New-Jersey distinction is valid and that proponents of each philosophy actually believe their philosophy is better.

    Two famous people, one from MIT and another from Berkeley (but working on Unix) once met to discuss operating system issues. The person from MIT was knowledgeable about ITS (the MIT AI Lab operating system) and had been reading the Unix sources. He was interested in how Unix solved the PC loser-ing problem. The PC loser-ing problem occurs when a user program invokes a system routine to perform a lengthy operation that might have significant state, such as IO buffers. If an interrupt occurs during the operation, the state of the user program must be saved. Because the invocation of the system rou

  124. Re:Jquery by Anonymous Coward · · Score: 0

    how often do you really need to customize jQuery? Seems like if you're at that point you're either doing something wrong or shouldn't be using it in the first place?

  125. Nested State Machines by Anonymous Coward · · Score: 0

    Huge, but actually quite predictable.
    With just the values of 2 variables you know exactly where your program should be executing/where to throw in a breakpoint.

  126. Goto in C by jorgen · · Score: 1

    I've used goto in C against better judgement when implementing a key derivation algorithm from an ANSI standard. The algorithm was described using some horrible spaghetti pseudo code with goto jumps between code sections which made it impossible to break it up in neat functions. I ended up writing it all as one big function with the goto's and everything. It works and is still used 10 years later, but I get to explain myself every time that function goes through a code review.

  127. Cobol/Mainframe vs new Kid with a PC by hAckz0r · · Score: 1
    On my first job as a production line parts pusher we had major problems with managing the production line and inventory. Data Processing told us that a program we needed would be impossible even with with the heavy-iron mainframes. After the second lay-off the Industrial Engineer got riffed and left behind this thing call a PC that just happened to have a 3270 terminal controller board in it. That got me thinking. I reprogrammed the controller board in ASM, and using Borland Pascal Compiler I connected it to the mainframe "pretending" is was someone typing EBCDIC key code information to pull up their worthless production inventory programs, and scraped the screens to grab what I needed. It was the tail wagging the dog kind of implementation, trying to balance the real-time control necessary with the API simplicity I needed to make programming it easy for me.

    .
    Once I had the standard application pages so that it all groked correctly, and built my temporary DB on the other partition of the Mainframe, it took me only about 6 hours to write the program that DP was telling us was impossible to do. You should have seen the face of my managers face when I walked into his office carrying a very thick ream of printouts with the all the answers he needed that day. Once the DP manger got finished being chewed out by the president of the company, that same program, utilizing the Big-Iron mainframe and with a direct connection to the actual database, it took over 6 man-months to write the same in COBOL. DP offered me a job writing Cobol, and I said no, turned professional a couple of months later and never looked back. I decided solving problems was more fun than pushing parts through a factory.

  128. Eh, most updates shouldn't be hand-written ad-hoc by raymorris · · Score: 1

    I wouldn't know the full details of which RDMS supports what types of updates, but they've always worked for me, when it makes sense for them to work. (Ie, obviously you don't update a sum.)

    But I haven't tried too many different updates of user-friendly views, because I generally design my systems where updates / insertions aren't normally done manually by ad-hoc queries. People can retrieve data with ad hoc queries if they choose, no harm in that. For inserts and updates, I want those controlled by the software anyway, with all the proper validation.

    Since the inserts are done by software, there's no problem writing the software to use the base tables. In fact, if you have even a general concept of objects in mind when writing the software (not necessarily full OOP), tables which reflect your objects may be easier than human-friendly views anyway.

    So anyway, yeah I haven't updated THAT many views, and I'm glad I haven't.

  129. You do it your way. In the kernel, we use 24x80 by raymorris · · Score: 1

    You are of course welcome to write rambling 800 procedures if you choose to do so. You won't while working for *me*, but in your software, do what you want.

    In the kernel, we use the 24x80 rule. Lines no longer than 80 characters, and functions, from kerneldoc to ending brace, should normally be less than 24 lines, shorter if they are more complex. That leaves 20 lines for the function body - if the function isn't particularly complex. Complex stuff needs to be shorter. That rule works for us. We're happy, our 85 million users are happy. If you have 85 million happy users, keep doing what you're doing.

  130. Clickbait article by Anonymous Coward · · Score: 0

    Nothing worth reading.

  131. ColdFusion [Re:Javascript] by Tablizer · · Score: 1

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

    BOTH are a matter of wrong-tool-for-the-job.

    ColdFusion (CF) was originally intended for HTML templating to make it easier for graphics designers and HTML-only coders to code for RDBMS-supplied content without having to bother the app dev for minor changes. It worked so well that CF started to be used for more general or complicated programming, and that's where you found ugly limits*.

    Similarly, JavaScript was originally designed as a light-duty glue language to handle browser events not built into the HTML standard(s). It worked well enough that people started using it as a systems language to implement entire GUI engines, and found ugly limits (which I rant about in detail elsewhere on this story).

    The same pattern played out in JS and CF:

    1. A tool is designed for a niche
    2. It's highly successful in its niche
    3. Popularity causes uses outside of original goal
    4. People complain about the ill fit, summarily blaming the tool
    5. Tablizer chews them out for painting with a wide brush

    A similar thing happened with VB classic. It was intended for smallish internal applications, but people tried to build enterprise-sized or packaged software with it, and it choked under the weight and got a bad general reputation.

    A similar thing also happened with IBM's RPG (Report Program Generator). It was intended to simplify the generation of reports. It was successful enough that others started using it for general application programming, and vendors wrote entire applications in it. Many programmers complained about it and bad-mouthed it in general.

    * CF is still well-suited for the original goal. In additional to built-in CF XML tags for populating HTML with data, one can build custom XML tags so that HTML designers/coders can use XML for common tasks for a shop instead of having to learn a "regular" programming language. One can argue they "should" learn regular languages, but if they won't or can't, CF is a nice tool for them. It has full subroutines now, and a feature set comparable to ASP classic. With some exceptions, one can even code in a JavaScript-like variant of it if you don't like XML.

  132. Throw more hardware at it by Anonymous Coward · · Score: 0

    I have seen this done many times, bad code, so just throw more CPU's, RAM, IOPS to fix it. Often cheaper and easier than getting the real problem fixed and it works - to a point when you can't add any more resources.

  133. Good Vs. Rich [Re:Bad Ideas] by Tablizer · · Score: 1

    If PHP was so awful that I wasn't able to use it to make money

    Sorry, I still don't see a strong relationship. An esoteric convoluted tool (ECT) could make one a lot of money because it's often hard to find experienced and skilled experts such that an org relying on an ECT system that needs maintenance would be willing to pay a premium for it.

    There are well-paid Java coders and poorly paid Java coders; there are well-paid PHP coders and poorly paid PHP coders.

    The supply versus demand versus difficulty relationship is complex and changes over time, and often driven by tech fads. I haven't seen any clear-cut patterns other than the rise and fall of techie supply can vary differently than a rise and fall of demand; and that if you are on the right boat at the right time, you can make good bucks.

    1. Re:Good Vs. Rich [Re:Bad Ideas] by JustAnotherOldGuy · · Score: 1

      There are well-paid Java coders and poorly paid Java coders; there are well-paid PHP coders and poorly paid PHP coders.

      And....what's your point? I thought you were discussing the merits of the language and how awful PHP is.

      And I said, basically, that I don't care if other people think it's bad.

      So, again, what's your point? Should I stop using PHP or was this just an opportunity for you to opine on what a terrible language it is?

      --
      Just cruising through this digital world at 33 1/3 rpm...
    2. Re:Good Vs. Rich [Re:Bad Ideas] by Tablizer · · Score: 1

      I was only trying to encourage you to clarify your claim(s) since earning power and tool "goodness" are not closely related.

      And I'm not trashing PHP, largely because most the mainstream languages also suck such that PHP's suckage puts it roughly on par.

    3. Re:Good Vs. Rich [Re:Bad Ideas] by JustAnotherOldGuy · · Score: 1

      ...since earning power and tool "goodness" are not closely related.

      Not always, but sometimes they are. If a tool is bad enough it'll negatively affect one's ability to earn with it.

      But I wholeheartedly agree that most of the mainstream languages also suck, albeit in various different ways.

      --
      Just cruising through this digital world at 33 1/3 rpm...
  134. Too dumb for OO? [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

    (a) you have not been exposed to good OOP code or (b) you are not smart enough to comprehend that OOP can be incredibly wonderful.

    Re (a): Show us one! Show us a practical and realistic example app. Avoid those dealing biology, physics, or geometry because those are not representative domains. Most business objects are defined by laws or market forces, and subject to a lot of changes. Physics stays the same, but intellectual property and laws do not.

    Maybe a college system that tracks students, teachers, classes, grades, etc. Then show us how OO makes it better in terms of fewer bugs, maintainability, etc. Invite readers to run some change scenarios on it.

    Re (b): For the sake of argument*, let's say some of us are just inherently too dumb to get OOP (at least OOP domain modeling). Should we just exit software development? But what if we are perfectly productive using other paradigms/techniques? Just because we suck at paradigm X doesn't mean we also suck at paradigm Y.

    And there are other skills involved in software engineering, such as people skills, writing skills, UI design, other IT skills such as server admin, and domain knowledge (knowing the customer's industry).

    We may be good at these others but suck at OO. That's not reason enough to toss us because there are other important factors the org that hires us is weighing.

    * I personally believe it's either a bunch of hooey, or a personal choice being mistaken for a universe truth.

  135. Definition of OOP (Re:Shying away from OOP(s)) by Tablizer · · Score: 1

    For what it's worth, per "OOP" here's my preferred definition of "object": a map or map-like data structure that can hold both attributes and behavior (or pointers to behavior). These units of behavior are typically called "methods". And objects facilitate easy or automatic referencing a parent object(s) for attributes or behavior not explicitly defined in a given map.

    ("Classes" are a language-specific variation or restraint on the concept.)

    In short, a glorified map data structure (AKA "dictionary").

  136. Java Lambda's [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

    Ironically, Java lambda's are often used to work around its poor OOP model. In a good OOP language, it would be easy to add an "On Click" method to a given GUI widget. Seems like a straight-forward and common feature, but Java provides no easy to let the listener know about such a method, such that one has to talk to a GUI listener directly instead via lambda's. (Maybe there's a way around this, nobody I know has solved it yet, without side-effects.)

  137. Well-factored [Re:Shying away from OOP(s)] by Tablizer · · Score: 1

    'Well factored' is, to an extent, a matter of opinion.

    Indeed. And well-factored is not necessarily the same as "useful". I've made what I thought was "beautifully factored code" and patted myself on the back thinking how clever am I.

    THEN the domain requirements changed, and went against the grain of my factoring, creating a mess. Parsimony can show you how to factor an existing abstraction, but says nothing about the future.

    The most future-proof abstractions in my observation are bunches of smaller abstractions that can be discarded as needed: a set of little functions or utilities that can be glued together as needed or ignored as needed.

    "Big umbrella" integrated frameworks are a disaster waiting to happen because they are too hard to unwind: it's all an interconnected ball of yarn. There is more annoying glue-work between the abstractions when using smaller abstractions, but they handle future changes better. It's better to live with more glue. Break big abstractions into parts that can be used independently.