Slashdot Mirror


'Here Be Dragons': The Seven Most Vexing Problems In Programming (infoworld.com)

InfoWorld has identified "seven of the gnarliest corners of the programming world," which Slashdot reader snydeq describes as "worthy of large markers reading, 'Here be dragons.'" Some examples:
  • Multithreading. "It sounded like a good idea," according to the article, but it just leads to a myriad of thread-managing tools, and "When they don't work, it's pure chaos. The data doesn't make sense. The columns don't add up. Money disappears from accounts with a poof. It's all bits in memory. And good luck trying to pin down any of it..."
  • NP-complete problems. "Everyone runs with fear from these problems because they're the perfect example of one of the biggest bogeymen in Silicon Valley: algorithms that won't scale."

The other dangerous corners include closures, security, encryption, and identity management, as well as that moment "when the machine runs out of RAM." What else needs to be on a definitive list of the most dangerous "gotchas" in professional programming?


497 comments

  1. Serious he missed the 2 biggest problems I've had by NotSoHeavyD3 · · Score: 5, Insightful

    1 who's my customer 2 What does he or she actually want.

    --
    Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
  2. Re:Serious he missed the 2 biggest problems I've h by OrangeTide · · Score: 1, Insightful

    Cowboy programmers really hate that.

    --
    “Common sense is not so common.” — Voltaire
  3. Nah by Anonymous Coward · · Score: 0

    None of these are real problems if you use the right tools. One-off errors and having to write too much glue code are more of a problem.

  4. node by MichaelSmith · · Score: 4, Insightful

    Oh christ if I get one more node.js developer claim that node is multi threaded...

    1. Re:node by Assmasher · · Score: 2

      How about people throwing 16-core AWS instances at Reddis? ;)

      --
      Loading...
    2. Re:node by Anonymous Coward · · Score: 1

      Oh christ if I get one more node.js developer claim that node is multi threaded...

      Just start multiple copies of node...

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

      You mean the ones running multiple instances of "Reddis" ?

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

      FWIW, you can indeed use threads in Node.js and even use the Web Workers API to do it. There are plenty of better reasons to hate Node.js -- such as when it will happily build 6 different versions of the same library into a project because of the insane way that it deals with dependencies. Ugh.

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

      Sure there are idiots that don't know what they're doing. But the eventloop driven architecture is just a beauty to make single core webservices and load balance them on a single machine. More simplicity in the codebase, load balancing is config.

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

      16 cores is are for school children. There are 64+ core CPU:s on the market. I doubt that it will stop there.

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

      So instead of running 2+ thread per core, 1 process per core is somehow better?

      And for many processes "4 cores" really means "2 cores with two threads each. So you can load balance 2 servers instead of running 4 thread. Yeah that sounds like a winner. Perhaps you run one server per "core" making you over commit and get even less power...

      Another example that people are convinced about things they don't really know anything about. If you know how multithreadig is implemented in modern CPU:s you would know that the only way to get the full power of your processor is to use multithreadig.

    8. Re:node by Anonymous Coward · · Score: 1

      How about leaving the winkie-face garbage over on YouTube or Facebook?

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

      And what exactly calls the callback when I invoke an fs.* function?

      I'll let you think about that for 30 seconds.

      Done?

      A different thread. Not the main task thread. Which means.... (drumroll) ... node.js IS multithreaded, just not the main task loop.

      Congrats, you've made it to Node 301.

  5. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 1

    1. Anyone with money
    2. Everything

    Next!

  6. oop by superwiz · · Score: 0, Flamebait

    the idea that functions must be bounded to data is ridiculous. data and operations are duals and each can be thought of acting on the other. polymorphism leads to code bloat and decreases readability (you always have to be mindful which class in the inheritance chain a particular method came from). Also, compile-time is way too early to make a decision on which particular way a particular piece of data will be treated. Especially if these pieces of data come in homogeneous containers. The binding of behavior to data should have been done through better syntax which would allow it to happen pretty far into the run time.

    --
    Any guest worker system is indistinguishable from indentured servitude.
    1. Re:oop by Anonymous Coward · · Score: 1
      data and operations are duals

      In my experience, data and operations tend to fight duels - often to the death! Sometimes on horseback with 10 foot lances, sometimes not. Its all good fun - if you are hiding behind the servers and peeping though the gap where the backup drive should have been!

      --
      I can't remember if I voted for Trump, but I definitely voted for weed!

    2. Re:oop by K.+S.+Kyosuke · · Score: 1

      There's not much difference between data and operations in abstract math; polymorphism/dynamic dispatch is independent on the notion of classes; and compile-time issues have been solved by Lisp and the ability to do anything at any time (run code at compile time or compile code at run time).

      --
      Ezekiel 23:20
    3. Re:oop by lgw · · Score: 1

      data and operations are duals

      In my experience, data and operations tend to fight duels - often to the death! Sometimes on horseback with 10 foot lances, sometimes not. Its all good fun - if you are hiding behind the servers and peeping though the gap where the backup drive should have been!

      Thus spake the master programmer.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    4. Re: oop by Anonymous Coward · · Score: 0

      You must have wentvto trump university

    5. Re:oop by superwiz · · Score: 1

      your joke was so funny, i decided to reply to it instead of yawning myself to sleep by the time i'd finish reading it.

      --
      Any guest worker system is indistinguishable from indentured servitude.
  7. 2 more I've seen by NotSoHeavyD3 · · Score: 5, Interesting
    1 Not being careful with floats. (Those can totally bite you including using floats when you should have used an int/uint type)

    2 Developers who decide to reinvent the wheel because "They know best". (Just dealing with code where somebody decided I don't want to use the built in stuff, I'm going to do my own date time stuff which constantly has issue. Makes you pull your hair out.)

    --
    Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
    1. Re:2 more I've seen by Lisandro · · Score: 0

      I'm amazed how most developers don't get floats at all. I used to work for a company writing billing software for Telcos which would, without exception, end up with rounding errors every single month. These added to a load of money over time, and no one had the faintest clue why.

    2. Re:2 more I've seen by LinuxIsGarbage · · Score: 5, Funny

      You should have modified the code to take those fractions of cents, and deposit them in your account.

    3. Re:2 more I've seen by ATMAvatar · · Score: 5, Insightful

      1 Not being careful with floats. (Those can totally bite you including using floats when you should have used an int/uint type)

      Some developers, when encountering a problem, say "I know, I'll use floating-point numbers!" Now, they have 1.9999999997 problems.

      --
      "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
    4. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Why does most vote tally software not use integer data types?
      Why is there a need for fractional votes?
      Check out the Fraction Magic info at http://blackboxvoting.org

    5. Re:2 more I've seen by Anonymous Coward · · Score: 0

      It's simple really. How many developers these days have worked at a low enough level to understand the Mantissa/Exponent storage method for floats?

    6. Re:2 more I've seen by Anonymous Coward · · Score: 1

      To avoid that problem they just use doubles for every possible use of floating-point numbers. Even in the iteration counter for their for loops.

    7. Re:2 more I've seen by K.+S.+Kyosuke · · Score: 1

      The Cohen summation?

      --
      Ezekiel 23:20
    8. Re:2 more I've seen by K.+S.+Kyosuke · · Score: 1

      Well, anyone dealing with numerical computation. Which is a lot of people these days.

      --
      Ezekiel 23:20
    9. Re:2 more I've seen by knightghost · · Score: 1

      Every real Software Engineer and Computer Scientist.

    10. Re:2 more I've seen by vtcodger · · Score: 1

      Betcha no one read "Numerical Methods for Scientists and Engineers" Richard Hamming, 1962.

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    11. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Kahan summation probably wouldn't have helped. The trouble here almost certainly arises from decimal fractions not being exactly representable.

    12. Re:2 more I've seen by Alain+Williams · · Score: 1

      Why do you think there were rounding errors — no faintest clue because it was well hidden!

    13. Re:2 more I've seen by AmiMoJo · · Score: 1

      It's depressing how much code stores coordinates in floating point format.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    14. Re:2 more I've seen by K.+S.+Kyosuke · · Score: 1

      It was a (slightly ethnic) joke.

      --
      Ezekiel 23:20
    15. Re:2 more I've seen by Anonymous Coward · · Score: 0

      How is that not stealing?

    16. Re:2 more I've seen by Darinbob · · Score: 3, Insightful

      Doesn't matter, this is stuff they should have learned in school. Even in high school if they decided to skip college. Even if they go to college I think they just don't bother learning. A computer to many developers is just a magical black box. If the math comes out wrong they switch from float to doubles. If they math is still wrong they complain about the computer (seriously I had professional physicists try to tell me that the VAX was broken because the numbers were coming out wrong). A lot of developers don't even understand integers to be honest, like 2's complement, overflow, fixed point, etc.

    17. Re:2 more I've seen by MichaelSmith · · Score: 1

      My latitude and longitude have arbitrary precision.

    18. Re:2 more I've seen by gtall · · Score: 1

      Hehe...reminds me of a joke a computer science professor told me once. He was an older feller and had been around the block several time. Some student came running into his office claiming the numbers in is program were all wrong. So he reached under his desk and pulled out an enormous print out, "Here are all the correct numbers."

    19. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Binary Coded Decimal (BCD) for working with money.

    20. Re:2 more I've seen by Anonymous Coward · · Score: 0

      You only need to know things like 2's complement and overflows because programming languages and hardware are poorly designed. Just like computer security, if we were doing things properly they wouldn't need to exist.

    21. Re:2 more I've seen by thogard · · Score: 1

      I've spent much of the last two decades dealing with people who are attempting to correctly deal with money. Float problems show up all the time. For the longest time all CPUs had BCD arithmetic but modern CPUs are getting away from having any but the most basic instructions and sometimes they are suboptimal and use far more cycles than they should.

      I think the largest missing feature of Go is the lack of a true currency type. The lack of that type means that every program that copes with money in any complex way has a very high probability of being very slightly wrong in some small number of cases.

    22. Re: 2 more I've seen by Anonymous Coward · · Score: 0

      :(
      That was a joke from Office Space.
      The point was, that it IS illegal.
      You should watch Office Space, it's hilarious.

    23. Re:2 more I've seen by Anonymous Coward · · Score: 0

      One of my Computer Science classes definitely covered Mantissa/Exponent storage method for float. Not sure why they would teach this to high school students though? Computer Science majors here (it's a tier 2 school) don't learn about 2's complement really. Only Electrical and Computer Engineers because they take Digital Logic Design.

    24. Re:2 more I've seen by angel'o'sphere · · Score: 1

      Floating points don't have "rounding errors".
      They have "limitations in representation", that is a huge difference.

      E.g. 1/3 is 0.33333333... there is no error in it. Floating points just can represent it more accurately.
      And calculating 1/3 -> 0.33333333... and then multiplying by 3 again yielding 0.999999999... again is no rounding error. This is MATH. Math works like that.

      E.g. 1/3 * 1/3 is 1/9, obviously. Which is closest represented as 0.111111111... there is nothing rounded wrong here again ...

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    25. Re:2 more I've seen by Anonymous Coward · · Score: 0

      I think this is the most hilarious thing I've read on /. in years. Well played.

    26. Re:2 more I've seen by Anonymous Coward · · Score: 0

      I have 1.99999999999 problems but a bitch aint one?

    27. Re:2 more I've seen by lgw · · Score: 1

      The problem is, people will write if (x * 3 then be mystified when it fails. My favorite is all the if (x bugs, failing to realize that negative zero is less than zero. Great fun.

      Then there are the NaN-related bugs, which are the sort of math errors most people overlook - like dividing X and Y by N, which accidentally is 0, then later comparing them and discovering that they're equal.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    28. Re:2 more I've seen by lgw · · Score: 3, Funny

      Freaking slashcode:

      The problem is, people will write if (x * 3 < 1) ... then be mystified when it fails. My favorite is all the if (x < 0) ... bugs, failing to realize that negative zero is less than zero. Great fun.

      Then there are the NaN-related bugs, which are the sort of math errors most people overlook - like dividing X and Y by N, which accidentally is 0, then later comparing them and discovering that they're equal.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    29. Re:2 more I've seen by lgw · · Score: 1

      I have 1.99999999999 problems but a bitch aint one?

      I have 98.9999999997 problems, but an int ain't one.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    30. Re:2 more I've seen by Dog-Cow · · Score: 1

      What type should be used instead? I suppose a double would allow for even greater levels of precision, but how many programmers using coordinates have that level of precision available for the coordinate measurement?

    31. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Some recent code I debugged:

      double x;

      ...(many changes to x)...

      if ( !x ) {

      ...

      }

      Now *mostly* it worked just fine. !x for a double is valid c code. But if x = really small nonzero number... the bugs begin.

    32. Re: 2 more I've seen by Mike+Sheen · · Score: 2

      Also Superman III, which was a decade or more earlier. I don't recommend watching Superman III, however... but Office Space should be mandatory viewing.

    33. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Rather depends what type of coordinates they are, which the idiot didn't specify. Screen coordinates would make sense as some form of integer since you can't write to a half pixel. Geographical ones, not so much.

    34. Re:2 more I've seen by AmiMoJo · · Score: 1

      It depends what format your coordinates are in. For example GPS uses degrees and decimal minutes, but other systems use degrees, minutes and seconds. In either case, I would recommend using one integer for degrees and another for decimal minutes/minutes+seconds.

      Simple reason is that integer maths guarantee you won't lose any precision as long as you pick a large enough type. You have to write some trivial functions to handle any manipulation you need, like addition or subtraction, of course.

      Alternatively if you don't ever need to do manipulation strings are fine.

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

      > you won't lose any precision as long as you pick a large enough type

      That's true for float/double just as much... The difference is only whether it fails with rounding errors or with bits cut off at the top (or in case of signed values on some systems in all kinds of funny ways).
      And the degrees/minutes/seconds system is really horribly stupid, it's almost guaranteed you'll make some mistake in the loads of ad-hoc conversions, custom addition and subtraction methods etc.
      If you want to avoid losses, go for seconds only, no point in carrying the minutes/degrees around in a separate variable!
      Plus your seconds might be fractional and you get additional issues.
      Not to mention that e.g. Android uses float/doubles in degrees, so if you go for representation in seconds you just get additional rounding errors on input/output.

    36. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Wow, great demonstration of developers not understanding float (but thinking they do).
      No, negative 0 is NOT less than 0. It is in fact equal to 0 - unless you do a special total-order comparison.

      > like dividing X and Y by N, which accidentally is 0, then later comparing them and discovering that they're equal

      (facepalm) Wow, you really don't understand floating point. AT ALL.
      Dividing by 0 will either give INF or NaN. They will never compare as equal.
      If anything your example would be that "x/N == x/N" actually returns false in those case.

    37. Re:2 more I've seen by Anonymous Coward · · Score: 0

      It's from one of the old rubbish superman movies.

    38. Re:2 more I've seen by lenski · · Score: 2

      Scaled floating point, unless you're working with an IBM Z series (does Power8 have decimal float?).

      Every modern processor has fast floating point; a double can store and express 53 significant bits, so express the floats in pennies. Or if not in USA, the smallest denomination in the money system you use. Server class machines probably do long doubles.

      ("Every" includes all Raspberry Pi models, the Odroids, Banana PIs, Orange Pis, etc.; essentially every X86 since 1991, Every Power since about 2003 and all ARM since Cortex-A.) I haven't kept up with MIPS. Even the microcontroller world has single-precision floating point hardware in wide deployment: We use Kinetis parts (ST's parts have Cortex-M4F too), so easy 32-bit ints and floats is the order of the day. A reasonably structured interrupt service function (no assembly required, BTW) executes to completion in 1 microsec... It has truly changed the nature of our deeply embedded work.

      The result: Use a commonly available toolkit competently.

    39. Re:2 more I've seen by Aighearach · · Score: 1

      And calculating 1/3 -> 0.33333333... and then multiplying by 3 again yielding 0.999999999... again is no rounding error. This is MATH.

      You're actually just arguing that floating point algorithms aren't really "math," but you're phrasing it backwards.

      1/3 does not equal what you suppose in math, it only equals that in programming because math can't actually even represent the numbers accurately using digits, and in programming we need to end up with digits. We have to quantize things that, in math, can only be approximated.

      The problem is that floating point requires extra approximations. The same math when converted into fixed-point might provide better results with less error. Don't rail about teh math unless you realize that math is besides the point, we're dealing with opposing systems of approximation that provide different levels of both accuracy and precision (measured as compared to the actual math) depending on the exact values and problem domain.

      The reality is that using floating points to represent certain types of data, such as monetary values, is stupid. It isn't just fine and the bugs are because the programmers didn't understand floating points well enough to use them; the problem is that the idiots didn't understand the math well enough to know that floating point "math" won't give the same results as... actual math would, given the same inputs. The actual math that matters is the algorithm from the problem domain, not the complicated math involved in the floating point implementation. The programmer should choose the algorithm that is best at approximating the math of the problem domain. In financial services, rounding is very critical and has well-defined thresholds taken directly from "math." Floating point is mathy, but not mathy enough for every situation! Understanding that the floating-point algorithm uses a system of math does not in any way rescue the situation and cause the same combination of inputs and operators to produce the same results that your math teacher would come up with on the blackboard.

    40. Re:2 more I've seen by Aighearach · · Score: 1

      Security might be more complicated than that, from a technical perspective, because of the basic use case of allowing the user to choose what the computer does!

      If users have choice of what work the computer does, then with no technical errors at all you'll still have security problems because of misplaced trust. A good example, the Trojan Horse. As we know, the horse was actually Greek, not Trojan. But there was no problem with the city walls; the security systems all worked as intended.

      If you want a secure computer, unplug it and submerse it in brine. There is no way a general purpose device like the thing we call a "computer" can both be useful for tasks that require security, and also be secure. It is not a matter of being "proper," it is a matter of wanting things that come together, or rejecting the whole package. Stop wanting secure computers, and instead start wanting to be very careful about what risks you take in order to activate capabilities.

      Like using banking software on a smart phone; some people get really caught up in the implementation details and deciding when it has enough safety factors, but they forget that they don't know what safety factors were needed until after exploits are published, which is often (long) after they're being exploited in the wild. You don't know what you don't know, so you don't know if it is secure or not; the part you do know is if you activated the capability. If you don't take some sort of affirmative steps to activate it, your phone won't know how to access your bank account. That's the one part that is knowable!

    41. Re:2 more I've seen by angel'o'sphere · · Score: 1

      Hello? Anyone out there?

      represent oh .... I wrote that in my third or fourth sentence ...

      1/3 does not equal what you suppose in math, it only equals that in programming
      That is wrong. It is like that in all Math, has nothing to do with computer or paper math.

      If you disagree, write me down how you calculate 1 divided by 3 on paper ... good luck.

      The reality is that using floating points to represent certain types of data, such as monetary values, is stupid.
      Of course it is ... but that was not my argument.

      My argument is plain and simple: floating point numbers have no rounding or inaccuracy problems, they have representation problems: huge difference.

      the problem is that the idiots didn't understand the math well enough to know that floating point "math" won't give the same results as... actual math would
      Define actual math then? Algebra? Using formula transformations till you end in one that is easy to calculate to a discrete result? Or doing it the hard way and calculate on paper? If you calculate on paper you come to the same result as floating points does, minus the "representation" errors. The only way to calculate "precise" is to "know" that e.g. tan(PI/3) = sort(3) ... but hollllaaa: on paper that is just: 1,732050807568877 ... or how long you want to calc. And it does not matter that a floating point number can only represent 1,732050807568876 or 1,732050807568878 ... it is not a math or rounding problem: it is a representation problem. As I said above: big big huge difference.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    42. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Power has decimal float since Power6 I believe, 7 for sure.
      But Powe6 was IBM's Pentium IV, little work for extremely high clock rates. 7 and 8 are quite good, and 9 looks better, although for a scientist like me, the most interesting part of Power 9 is hardware support for quad precision floating point (there are some problems where double precision shows its limits).

    43. Re:2 more I've seen by Aighearach · · Score: 1

      In math, 1/3 is a fraction and has utility as it is. You're missing the point because you're sprinting past the point without even considering it!

      In math 1/3 is still 1/3, and if you're wanting to convert it into an approximate decimal, you'd use something long long division, and even be able to represent the repeating portion.

      You won't be able to do that using floating-point, and you'll often get different answers than you would using actual math. This is what I was talking about when I was saying that floating point uses a system of math, but it is different than what would be used in math, and gives different answers. In a math class, you'd need a function to represent division_using_floating_points, you wouldn't be able to just use the standard operators; if you were trying to your answers would just be wrong. The reason that floating point gives "correct" results is because it is a different thing than regular math, it is a system of approximation that you can implement using math. And in programming, you can implement it so that you even use the same symbol for the operator! But 1/3 is still 1/3.

      Define actual math then? Algebra?

      You should have just deleted your comment and not posted it at this point! lol (the answer is no, math doesn't mean algebra)

    44. Re:2 more I've seen by lgw · · Score: 1

      No, negative 0 is NOT less than 0. It is in fact equal to 0 - unless you do a special total-order comparison.

      In Java, it is. So there's a bug.

      Dividing by 0 will either give INF or NaN. They will never compare as equal.

      In both Java and C#, they compare as .equal(), but not as ==. So there's a couple more bugs. Especially in Java, where you end up using Double instead of double a lot, because generics are broken, and it's best to avoid == with any of the boxed numeric types, because, well, Java.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    45. Re:2 more I've seen by lgw · · Score: 1

      Ah, by "special total-order comparison" did you mean compareTo()? In which case, fine, but that's what most Java library code seems to use.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    46. Re:2 more I've seen by angel'o'sphere · · Score: 1

      You won't be able to do that using floating-point, and you'll often get different answers than you would using actual math.
      This is actually what I said. But you seem not familiar with the problem of "representation".

      Again: floating point numbers have no rounding problem. They simply can not represent every real (or rational) number, they have to use the closes one to the number they want to represent .

      I suggest to read a bit about it: https://en.wikipedia.org/wiki/...

      And then delete your posts perhaps?

      And in programming, you can implement it so that you even use the same symbol for the operator! But 1/3 is still 1/3.
      Facepalm. Not with floating points, but you can use "real math libraries" like in SmallTalk their the type system choses the right "number type" depending on calculation.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    47. Re:2 more I've seen by Anonymous Coward · · Score: 0

      If you have a problem, and use Java to solve it, you now have additional problems.

    48. Re:2 more I've seen by DarenN · · Score: 1

      Most serious financial software uses integers with implied decimal placing based on the currency code. The ISO 8583 standards use 12 digits for this.
      so 000000010000 is 100 US dollars (which has a decimal position of 2), but that's one Unidad de Fomento (decimal position is 4).

      --
      Rational thought is the only true freedom
    49. Re:2 more I've seen by ilsaloving · · Score: 1

      The last time someone did that, he ended up building an evil sentient supercomputer and Superman had to bail him out.

    50. Re:2 more I've seen by Anonymous Coward · · Score: 0

      Representation error is a kind of rounding error. Please, stop being such a jerk about it.

    51. Re:2 more I've seen by lgw · · Score: 1

      If you have a problem, and use Java to solve it, you now have additional problems.

      Sadly, the biggest problem these days is "I need to hire kids out of college who can work on this code", so you're pretty much stuck with Java unless you're in a niche where eveyone's going to use C anyway, or you can use C#, etc.

      --
      Socialism: a lie told by totalitarians and believed by fools.
  8. Closures? by Anonymous Coward · · Score: 2, Insightful

    C'mon. Threads -- I concur wholeheartedly. But closures? Granted, you have to wrap your head around them, but then they are a docile workhorse.

    As for threads... don't unless you have to. You add the benefits of concurrence and common address space and multiply their curses.

    1. Re:Closures? by K.+S.+Kyosuke · · Score: 3, Informative

      Not only that; closures are not a problem but actually the ultimate solution to the actual problem of name scoping. Lots of approaches were tried before closures remained as the only sane idea.

      --
      Ezekiel 23:20
    2. Re: Closures? by Anonymous Coward · · Score: 0

      Yeah I don't get that either.
      Closures are fucking trivial.
      If you can't grasp them, you must have some serious brain damage.
      No ifs and buts about it.

    3. Re:Closures? by lgw · · Score: 3, Interesting

      C'mon. Threads -- I concur wholeheartedly

      I've never understood why programmers have problems with threads. Almost everything is one of two models:
      * Solve the problem as a series of queues with worker thread pools. Really hard to mess that up.
      * Entire request-to-response workflow in a thread for each request. You have to be a bit careful about locking around shared objects, but usually the answer is avoiding shared objects.

      If you can't get multiple threads on one machine right, how are you going to work on distributed systems?

      --
      Socialism: a lie told by totalitarians and believed by fools.
    4. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      Found the Go programmer! ;)

      --
      Ezekiel 23:20
    5. Re:Closures? by lgw · · Score: 1

      Never used it. When I first started coding professionally, the platform didn't have the concept of threads. Or a stack (making re-entrant code without a stack is a pain). I find threads generally easier to get right than async operations, which are apparently back in fashion again.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    6. Re:Closures? by gtall · · Score: 1

      You've never done realtime, huh?

    7. Re:Closures? by Sique · · Score: 1

      Threads always have the problem of concurrency. Keep in mind that the dining philosophers problem is still unsolved in general. Partial solutions work, but each of them has their drawbacks.

      --
      .sig: Sique *sigh*
    8. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      What has any of that to do with RT?

      --
      Ezekiel 23:20
    9. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      The two things you mention are exactly how Go solves 80% of the problem in 20% of the effort.

      --
      Ezekiel 23:20
    10. Re:Closures? by Bengie · · Score: 1

      Right there with you. I've been coding multi-threaded code for nearly a decade now. It's not the difficult. My first real-world application was threaded. Taught myself threading in 3 days, wrote my own synchronization code. Looking back, I cringe at what I did, but it worked perfectly and I have not had to touch the code in 8 years. Not bad for re-writing an existing program that had been under constant development for almost a year, in only three weeks, fresh out of college, about two weeks of experience programming, and having never written multi-threaded code before.

      I recently had to look over my code again to turn it into a library, which took me less than a day. Well written threaded code is well factored with single-responsibility taken to the extreme. I don't like more than one piece of code modifying shared state. This lends itself well to be converted into a library, so most of my work was already done for me, but some annoying coding habits that I had were annoying.

    11. Re:Closures? by hey! · · Score: 2

      I think the problem is the paradigm shift from object oriented to functional. I learned to program in Scheme many, many years ago (early 80s), although I never used it professionally. When javascript came along, people looked at the bizarre object system and thought "This is dumbed down Java." I looked at it and thought, "This is kind of like Scheme."

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    12. Re:Closures? by lgw · · Score: 1

      As it happens, I never been asked to solve philosophical problems. Real-world problems tend to be rather more boring.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    13. Re:Closures? by lgw · · Score: 1

      Well written threaded code is well factored with single-responsibility taken to the extreme. I don't like more than one piece of code modifying shared state.

      OOP really shines for this sort of thing. It's one reason concurrency is a pain in C in particular.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    14. Re:Closures? by Bengie · · Score: 1

      I'm not sure about Go, but .Net has some interesting deadlock situations with async not all of your code is 100% async. Which is annoying because most opensource .Net libraries are not async. I had to help a co-worker with some GCC Go pseudo-deadlock issues many years back. I found it rewarding to have solved a deadlock issue in a language that I had zero experience and turned out it was an implementation detail of how GCC handled "async" at the time, via threads, and when the thread-pool ran out of threads to handle go-routines, the producer and consumer could be handled on the same thread and block each other. Took me about 15 minutes. I say "pseudo" because if a routine blocked too long, the scheduler would change which routing is running, which "fixed" the issue after some hesitation. You'd get this strange jittering that got worse as more routines were running, quickly getting to tens of seconds in our test.

      Once you have a mental model of how concurrency works, it doesn't matter which platform you're on. There's only a few good ways to implement it.

      Async allows for high scaling when dealing with lots "messages" moving through the system. Context switching is crazy expensive, about 10,000 cycles on a modern CPU. That's not including a lot of other contention that's created in the kernel. To put it simply, if you want a single server handling 100Gb of traffic with millions of network states, you HAVE to use async. And yes, a single server can handle 100Gb of traffic over 100,000/s of short lived connections.

    15. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      That's because JS was originally supposed to be Scheme in the first place? But then ended up as a C-ish Scheme/Self hybrid for some stupid reasons?

      Anyway, there's a lot of orthogonality here. You have CLOS in Lisp, too.

      --
      Ezekiel 23:20
    16. Re: Closures? by Anonymous Coward · · Score: 0

      Only thing I thought was looping in Javascript/JQuery while using loop variable and not understanding why the loop variable is always the same. It took me longer than I care to admit to figure that one out when I first started web development

    17. Re:Closures? by Tough+Love · · Score: 1

      I've never understood why programmers have problems with threads...

      It sounds like you have insufficient respect for the nature of the beast.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    18. Re:Closures? by Tough+Love · · Score: 1

      Zillions of async, interacting thingies.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    19. Re:Closures? by Tough+Love · · Score: 1

      As it happens, I never been asked to solve philosophical problems...

      Whoops! Dining philosophers is not a philosophical problem, it is an illustration of a basic issue in computer science. I am not sure I would be comfortable letting you loose on a multi-threaded software base of any complexity.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    20. Re:Closures? by Tough+Love · · Score: 1

      Right there with you. I've been coding multi-threaded code for nearly a decade now. It's not the difficult.

      Sure, if you stay away from anything tricky, or you are some sort of omniscient genius that doesn't exist.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    21. Re:Closures? by lgw · · Score: 1

      I haven't played with .NET asynch yet - but what you say is about what I expected. I did only asynch operations in my first 5 years for coding, as there were no threads (those who know, know excp and wait). It scaled quite nice back in the day: 2000 active users on a (single core) machine with 200 MHz. Scaled to a modern high-end server, that would be a million active users on that box. But no one cares about (that kind of) performance any more.

      Though I have to ask - how would you cram 100Gb of networking into one box? There's no PCI slot that can keep up with 2 x 10 Gb, and a 10-slot 16x PCIe server board is exotic, to say the least. People don't care about performance, because it's easier to just spin up more machines in the cloud.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    22. Re:Closures? by Anonymous Coward · · Score: 0

      I... actually couldn't agree with this more. When I first started out with threads, the first thing I thought was, "Right, so how do I divide this into asynchronous bits and synchronous bits cleanly?" The obvious answer after quite a bit of study was, "Well... a thread-safe queue of some sort and workers to pop from it sounds reasonable." While the second approach is only slightly more tricky, with a good language to start learning them in, locking primitives (and friends) aren't too difficult to understand. TBH, the greatest challenge I had in learning threaded programming is that a lot of programmers are woefully incapable of actually teaching it without under-explaining, and/or making things sound a lot more confusing than they are.

      That said, for a lot of problems where threading (or outright forking) used to be the only solution, co-routines have made it a lot easier to slice things up without having to worry about synchronization too much. They come with their own dragons, of course.

    23. Re:Closures? by Anonymous Coward · · Score: 0

      Use a global lock, or release the first lock if you don't get the second.

    24. Re:Closures? by lenski · · Score: 1

      Sounds like a PDP-8.

      I made the mistake of coding "JMS" instead of "JMP" in a disk boot routine exactly *once*, teaching an important lesson... Three days later, I had recovered most of the files on the RK-05.

      The IBM 360 instruction set didn't have a hardware stack but the SAVE macro served well in its place.

      Async (the select/poll model) and multithreading both have their place, the toolkit should match the application.

      For the embedded world, I've discovered that run-to-completion "tasking" is so much easier these days, when the average microcontroller's clock speed is >= 120 MHz. The ARM Cortex world has such friendly exception handling that we simulate foreground/background "tasking" with ISRs.

    25. Re:Closures? by TheRaven64 · · Score: 1

      Why do you need to shift the paradigm? Closures have been part of OOP since Smalltalk. JavaScript is dumbed-down Self.

      --
      I am TheRaven on Soylent News
    26. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      If only OOP had anything to do with that kind of programming.

      --
      Ezekiel 23:20
    27. Re:Closures? by ewibble · · Score: 1

      Passing around functions are fine, having final variable are fine (technically there are no variables in true functional programing since the can't change)
      it is the lame scoping in javascript that lets you pass variables from anywhere to anything without having specify it.

    28. Re:Closures? by Anonymous Coward · · Score: 0

      When people talk about threads being a problem, they mean the shared memory model of concurrency. Your suggestion is just that if you're careful you can reproduce non-shared memory models of concurrency using shared-memory. But the less error-prone solution is to offer those concurrency styles in libraries (possibly with language support like in Rust) so most programmers aren't dealing with shared-memory in the first place.

    29. Re:Closures? by Tough+Love · · Score: 1

      Use a global lock, or release the first lock if you don't get the second.

      Glib and simplistic answers like this are more than sufficient reason to keep certain people well away from critical software.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    30. Re:Closures? by Aighearach · · Score: 1

      I do a lot of realtime embedded programming, and the way to actually achieve realtime results is mostly by not having zillions of things, and reducing interaction between what things you do have.

      Threads is a good way to be using a "realtime OS" or something, but with code that doesn't get realtime results. I'm not saying you can't do it, but it adds overhead and makes it less likely. For realtime you basically want to give up all the things that make life easy for the programmer in regular systems, and then give up whatever you replaced those things with, and finally just use what resources are locally available in hardware. And depending on the hardware, that may or may not even be enough.

    31. Re:Closures? by Aighearach · · Score: 1

      LOL were you triggered by the word "philosopher?"

      Beware of history, I mean... almost all of the set theory that is used in computing is not traditional set theory like is used in math, but the modified version that was proposed as the answer to Russell's Paradox!

      It may turn out that it is philosophical constructs all the way down, including the circuit modeling system used to design and measure physical circuits and semiconductor devices. Wouldn't that be embarrassing, if true?

    32. Re:Closures? by Aighearach · · Score: 1

      OOP works just fine in plain C, so try again. It must have been some other reason!

    33. Re:Closures? by Anonymous Coward · · Score: 0

      ur old lol

    34. Re:Closures? by lgw · · Score: 1

      You're humor detector needs its annual checkup - probably a deadlock somewhere. It's "an illustration of a basic issue in computer science" that never seems to come up. Academia is full of those.

      Meanwhile, in the real world, pick the right architecture and you can avoid being overly clever.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    35. Re:Closures? by lgw · · Score: 1

      single-responsibility taken to the extreme. I don't like more than one piece of code modifying shared state

      Yes, what could OOP possibly have to do with that kind of programming? It's a mystery. Totally unrelated: if only there were some approach to taking some state, and the only bits of code that should modify that state, and grouping them together in some sort of self-contained object. Nah, pipe dream.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    36. Re:Closures? by lgw · · Score: 1

      Only in the sense that you can use C to write an OOP language. I guess that's why they say "any sufficiently complex C program re-invents C++, poorly".

      --
      Socialism: a lie told by totalitarians and believed by fools.
    37. Re:Closures? by lgw · · Score: 1

      It sounds like you never got the hang of it, TBH.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    38. Re:Closures? by Tough+Love · · Score: 1

      It's "an illustration of a basic issue in computer science" that never seems to come up.

      You can't be serious.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    39. Re:Closures? by goose-incarnated · · Score: 1

      It's "an illustration of a basic issue in computer science" that never seems to come up.

      You can't be serious.

      He probably is. Too many devs think that threads are easy if you simply use locks/design patterns/$LANGUAGE/$PLATFORM/etc ... These people have likely either a) Never written anything non-trivial using shared-memory paralellism, OR b) Decided a long time ago that the frequency of crashes in their multi-threaded was acceptable.

      --
      I'm a minority race. Save your vitriol for white people.
    40. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      1) you don't need OOP for that style (modular languages already did that), and 2) OOP does not really prevent you from violating it.

      --
      Ezekiel 23:20
    41. Re:Closures? by K.+S.+Kyosuke · · Score: 1

      It's not possible to re-invent C++ poorly, except with new C++ standard revisions.

      --
      Ezekiel 23:20
    42. Re:Closures? by tigersha · · Score: 1

      I agree. Threads are OK IF YOU USE THEM THROUGH A LIBRARY. It is a horror if you try to go down to the primitives and lock things yourself. shared objects and threads are an absolute no-no. The problem with locks is that they look very simple but the interactions are actually very, very hard. It is like building computers from discrete logic gates. Digital logic is not hard in principle, but the emergent complexity quickly becomes totally overwhelming.

      All programmers should be required to read this:

      https://pragprog.com/book/pb7c...

      and Doug Lea's book about Java Concurrency.

      http://www.informit.com/store/...

      Lea is so good his stuff became part of the official Java Spec.

      --
      The dangers of excessive individualism are nothing compared to the oppressiveness of excessive collectivism
    43. Re:Closures? by goose-incarnated · · Score: 1

      It sounds like you never got the hang of it, TBH.

      Maybe he did a CS-heavy field of study. The problems with threads can't simply be handwaved away with "Careful locking". There is no such beast!

      Even if there was, all it fixes are race conditions. The *actual* problems are deadlock detection, deadlock intervention, thread starvation, priority inversion... and that's before we even get to profiling, code coverage and unit tests which will all execute/result differently under threaded loads.

      Threads are provably non-deterministic, which makes reasoning about non-trivial threaded code impossible (not hard, impossible) regardless of how well you think you are using them, or how closely you've guarded the queue.

      With threads, a unit that passes the unit-test for a range of inputs may not actually pass that test with the same inputs later. Without threads, a unit that passes for a certain range of inputs will always pass for that range of inputs.

      --
      I'm a minority race. Save your vitriol for white people.
    44. Re:Closures? by Anonymous Coward · · Score: 0

      > Threads are provably non-deterministic, which makes reasoning about non-trivial threaded code impossible (not hard, impossible)

      This is the kind of useless statement that gives technology people a bad name. I presume you mean in terms of formal decidability, but in real terms there are many things which are provably non-deterministic which we reason about quite happily (e.g. my public transport options to get to work).

      You can move things down a level via the usual software engineering techniques since we still need to get stuff done .For example, encapsulating changes to shared state. Eliminate shared writeable state where possible, or make it transactional.

    45. Re:Closures? by lgw · · Score: 1

      Or, c) pick a design that actually works.

      Why are you needing to take multiple locks? Why can't that be done in a way that lock ordering isn't entirely trivial? Usually the answer is that the code is overcomplicated before even considering the multi-threaded aspect of it. Poor division of responsibility, too much global state, using SQL like it was the 20th century, that sort of thing.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    46. Re:Closures? by lgw · · Score: 1

      Sure, you can do anything in any Turing-complete language. But it really helps if the language naturally provides the semantics for what you're trying to express.

      Some people think of OOP as "inheritance and polymorphism", but that's really a corner case, but the heart of it is clear expression of "here's the minimal bit of code that needs to know the implementation details of this stuff".

      --
      Socialism: a lie told by totalitarians and believed by fools.
    47. Re:Closures? by lgw · · Score: 1

      You clearly haven't been on some of the projects I have.

      * Having every function return an detailed error code (leaving the actual result of computation as an output param), as a half-assed exception passing method.
      * Passing a "jump table" around as half0assed polymorphism.
      * Using special (and quite complicated) macros instead of malloc/free to do slab allocation (and constantly policing that in code reviews), instead of just overloading new.
      * Elaborate shenanigans to avoid memory leaks instead of just using scoped objects.
      * Buggy implementation of something from an algorithms textbook instead of just using the standard library.

      For anything complicated, you really want to use something built into the language over inventing a buggy version of it yourself.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    48. Re:Closures? by lgw · · Score: 1

      Maybe he did a CS-heavy field of study.

      Fair point, if you're in academia then needless complexity might be the point of the exercise.

      The problems with threads can't simply be handwaved away with "Careful locking". There is no such beast!

      I don't need to solve the general case of all multithreaded problems, I need to get the problem in front of me to work at scale. And nearly always you can pick a design approach that makes it easy enough.

      The *actual* problems are deadlock detection, deadlock intervention, thread starvation, priority inversion... and that's before we even get to profiling, code coverage and unit tests which will all execute/result differently under threaded loads.

      Deadlocks are hopefully the result of "evolved" code that was never really designed (in its current form) in the first place, as there's really no excuse for having that problem when you can choose your design.

      Sure, you can't really write unit tests to find all your race conditions, but to the extent what you can use library code to do any manipulation of shared state, you don't have to.

      When you're in that odd corner case where there's no easy fix, just make sure to build an anti-entropy mechanism (bigger hammer to reset anything that appears hung - you don't have to know that it's e.g. a deadlock intervention).

      --
      Socialism: a lie told by totalitarians and believed by fools.
    49. Re:Closures? by Tough+Love · · Score: 1

      I do a lot of realtime embedded programming, and the way to actually achieve realtime results is mostly by not having zillions of things, and reducing interaction between what things you do have.

      That's a good guiding principle but there are limits to what you can do when your real world actually has zillions of asynchronous thingies in it, as most real worlds do.

      Threads is a good way to be using a "realtime OS" or something, but with code that doesn't get realtime results. I'm not saying you can't do it, but it adds overhead and makes it less likely.

      Threads are often the right thing to do for less resource intensive tasks because its easier to see and verify the control flow than an event driven design. Obviously, you need a real time scheduler, but that isn't hard to come by.

      For realtime you basically want to give up all the things that make life easy for the programmer in regular systems...

      No you don't, you only want to give up those creature comforts where there would be a significant benefit.

      and then give up whatever you replaced those things with, and finally just use what resources are locally available in hardware.

      Hah! You are only talking about very simple systems, where you are ok with delivering a steaming pile of write-only code.

      And depending on the hardware, that may or may not even be enough.

      I really don't like pat answers to questions that are deep and subtle. Thanks at least for the weasel words :)

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    50. Re:Closures? by Tough+Love · · Score: 1

      Really, you come across as a dangerously overconfident newb. Sorry if that seems like an attack on your self esteem, but you should think about it. You've got a few assorted complexity reduction techniques under your belt but you've barely begun to discover the issues.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    51. Re:Closures? by lgw · · Score: 1

      Given I've been doing multi-threaded or async systems programming for 25 years, I think my self-esteem is safe. You know, when you have one crowd saying "it's easy" and another saying "no, you don't get how hard this is", there are two ways that can go.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    52. Re:Closures? by Aighearach · · Score: 1

      No, in the sense that I said it. If you don't know, you're not even ready to disagree.

      You don't need to correct something that might to be true, but you don't know.

      There are examples that are very famous bits of software that even you have heard of, you just didn't know that they were written using OOP in plain C.

      I don't provide a link or tell you the name, because you're expected to already know what I'm talking about before you try to tell me I'm wrong. You apparently don't even know what OOP is. You read a comment where somebody tried to explain, but you argued instead.

  9. Buffers by Harold+Halloway · · Score: 2

    Buffers seems to cause a lot problems, particular when they overflow. As a non-programmer (well, a very long time ago programmer) I've never grasped why preventing overflows seems to be so difficult.

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

      It's not hard if you're willing to sacrifice performance.

    2. Re:Buffers by MichaelSmith · · Score: 4, Interesting

      Saw this in C:

      some_func(char *data) {
              char *buffer;
              buffer = malloc(200);
              memcpy(buffer, data, 2000);
              send_buffer(buffer);
              free(buffer);
      }

      Occasionally it would cause a crash.

    3. Re:Buffers by Cassini2 · · Score: 3, Interesting

      Microsoft wrote a bunch of code, that in hindsight was a really really bad idea. I'm not really sure that the problems were all Microsoft's fault - they probably didn't invent them. They are Microsoft's fault in that they embedded the concepts into the operating system and then widely popularized them.

      The big gotchas all have to do with limitations of C, and the twists used to optimize Microsoft's programming for the 8086 architecture. I'm thinking of:

      char string[MAX_PATH];
      What can possibly go wrong? Especially before MAX_PATH was invented.

      malloc() new() and friends
      For any non-trivial program, it's almost impossible to get correct. They only really work for something like a C compiler which will allocate a variable amount of memory, do a task, and then end. If you miss a few free() calls along the way - they will be cleaned up when the compiler terminates.

      GlobalAlloc(), LocalAlloc() and friends
      Just in case you couldn't make it work with malloc, try the operating system version of the call. Using OS calls really opened the window to some famous bugs - OpenSSH comes to mind.

      Multi-threading in C
      For any non-trivial problem - it doesn't work. Firstly, for any non-simple piece of code, it is tough to do correctly. Secondly, for a trivial piece of code, like a save operation, you need to somehow make the memory being stored immutable for the duration of the save. For most save operations, this defeats the purpose, as the first thing the user wants to do after save is to change the document. Thirdly, if you really need multi-threading, there is a good chance some of your users need parallel-processing across machines. Multi-threaded code and parallel-processing code are not the same things at all.

      Embedding code in data.
      Firstly, the x86 architecture encouraged this, by not having proper page protections. Secondly, it completely opens the system up to malicious code. ActiveX, JPEG libraries, font libraries, everywhere Microsoft had an API that embedded code in data, it was all exploited.

    4. Re: Buffers by Anonymous Coward · · Score: 1

      I see what they did ther

    5. Re:Buffers by Anonymous Coward · · Score: 1

      You are incredibly ignorant. Much of this predates Microsoft, but in any case:

      There are techniques to avoid raw pointer allocation. C++ rarely uses it, but C requires structure. For resources other than memory, all languages require it, so you might as well learn to program. If you can't fuck off and work at Walmat instead, there are far too many of you people driving the value out of software.

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

      Good comments, I'll just challenge you on one of them: multi-threading and your save example. It obviously depends on what the program is doing and whether resources are available to do this, but, one solution is to quickly take a copy of the data structure and then write it out to disk on its own thread. Alternatively, perform the save directly to a memory stream and then write that out to disk at your leisure. Of course this doesn't work well if the system is short on memory, but for intermediate data sets where it helps to keep the software snappy and responsive, it does work in practice.

    7. Re:Buffers by KiloByte · · Score: 1

      char string[MAX_PATH];
      What can possibly go wrong? Especially before MAX_PATH was invented.

      Start your path with \\?\ and see how MAX_PATH/PATH_MAX works.

      That's why Hurd guys had the right idea to remove these whatsoever, causing lots of buggy software to fail to build instead of having crashes, often exploitable, at runtime.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    8. Re:Buffers by Anonymous Coward · · Score: 1

      Well that's a great demonstration of how to pack several bugs into a small amount of code.

    9. Re:Buffers by AmiMoJo · · Score: 2

      Buffer overflows are often the result of not checking the data that is going into the buffer carefully enough, or at all. The spec says the string is max 80 characters, so someone sends 80 characters and some exploit code which runs over the end of the buffer.

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

      Yeah send_buffer() was almost certainly asynchronous.

    11. Re:Buffers by SuricouRaven · · Score: 1

      The lack of protection has an up-side: Speed. Without the overhead of bounds checking, you can do things very, very quickly. There's a reason that things like OS kernels and renderers are usually written in C or C++, and make extensive use of buffers.

      With great power comes great possibility for screwing up.

    12. Re:Buffers by Plus1Entropy · · Score: 1

      Buffer overflow is a problem that can't ever be completely mitigated, at least not in an ideal way. Basically, something is producing data and putting it in the buffer, and something else is taking the data out and consuming it in some way. As long as your consumer is at least as fast as your producer, the buffer will never overflow. Since you don't necessarily have control of both producer and consumer, you can't always guarantee this.

      That being said, the vast majority of the time it is preventable, and at the very least should be recoverable in the rare event that it does happen.

      --
      Only crack the nuts that crack. You don't put the ones that don't crack in the sack.
    13. Re:Buffers by tepples · · Score: 1

      Nor does it help where the code to serialize the document to the form that can be written to persistent storage is CPU-intensive by its nature. Then there's a synchronous freeze while serializing followed by an asynchronous write to storage in a worker thread, and adding an SSD won't help with that synchronous freeze.

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

      Because there is no such thing as a buffer really, it's an abstraction on memory. There is really just memory. Buffer overrun is just a fancy way of saying there is a bug using memory. Code uses memory. Code has bugs. Some of those bugs are writing into memory in places where they should not. Many times, because the thing that said where to write became incrementally too large due to some other bug. And so you write past the intended end, or -- you overrun the buffer. Very easy to do in any language where you are allowed to use memory directly.

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

      I disagree.

      Buffers can always be protected from overflow by using a very well-known technique: buffer chaining. (A.K.A. "double buffering", "triple buffering", "n buffering", and to the non-technical, "blast processing") With proper abstraction, the reader and writer processes can be entirely prevented from even knowing there's a buffer chain in use instead of a single buffer.

      With a plain old buffer, the writer has to wait for the reader to clear some space, or else risk losing data. With a buffer chain, the reader reads from the chain, the writer writes to the chain, and the chain allocates and deallocates buffers (or "pages") as needed. Reads never happen on the same buffer as the writer. When the writer fills a buffer, the chain swaps it into the reader queue and sets up a new buffer from the spare queue for writing. When the reader finishes with a buffer, the chain swaps it into the spare queue and starts reading from the next buffer from the reader queue.

      The trouble is, this is only useful for long-running buffered processes. Smaller buffers for user input or other immediate uses tend to A) have a fixed size, and B) need to be much more efficient (read: not have the overhead of a buffer chain). These are typically the buffers that suffer from overflow problems. The most basic example is an array of characters read from user input with a maximum length. If you don't dynamically update the length of that input buffer allocation, you must limit the input to not exceed the fixed length. If you allow input to exceed that length, you must reallocate that buffer accordingly.

    16. Re:Buffers by sjames · · Score: 1

      Most commonly, when some other function of module breaks a contract in the API, or string manipulation is in play.

      For example, a function is supposed to never return more than 2K characters but it returns 2K+1. Perhaps because someone forgot that a null char would be appended.

      Or for example, you build a string in a buffer but forget to NULL terminate it. Then you strcat a newline. Unfortunately, strcat scans the string until it hits a null somewhere after the end of the buffer and then overwrites it with newline and the next byte with zero, Exactly where that is will be somewhat random. You might get away with it for millions of iterations and then one day something elsewhere in the program mysteriously fails a few minutes after the buggy code ran.

      In part, the standard libraries are to blame. Too many functions in it don't offer any sort of sane limits. The string functions that do have limits leave off the NULL terminator if they reach them. Fortunately one of the worst offenders, gets, now causes a compiler warning.

      Much of this is because when C and it's standard libraries were created, CPU cycles were expensive. That and for every function you might want to make safer, there's a very good reason why an unsafe version is necessary.

    17. Re:Buffers by Anonymous Coward · · Score: 0

      My God, none of that post makes any sense.

      This has nothing to do with Microsoft and everything to do with people being trusted to use tools that they obviously don't k ow very well. That evidently includes you.

      Malloc and free are not at all impossible to get right. Resource management is a thing you have to learn to be a competent programmer. If if wasn't malloc and free that you couldn't handle, it would be network or database connections, or file handles or whatever. If you can't handle malloc/free, please think of the children and don't switch to another language you think is "easier." Instead, switch to a different profession.

      OpenSSH never had a bug involving GlobalAlloc or LocalAlloc: it doesn't use the win32 API at all. GlobalAlloc and LocalAlloc have their use cases (it's why they exist) and, just like any tool, you have to actually understand how to use them. You shouldn't pick up a hainsaw before reading the manual. Why would you think it would be any different when it comes to software?

      Multi threading is a thing, too. And it's not terribly hard if you (again) know what you are doing. Much like substance abuse, the first step is admitting that you have a multi threading situation on your hands. Some programmers don't understand that GUIs have all kinds of threads running around. If you write a CLI program you aren't going to have as many balls in the air at once. But once you understand the complicated environment in which you are running, you can educate yourself about the ways to protect data and code from stomping on one another.

      Embedding code in data is in fact a bad idea. But your examples have confused what you thought you were talking about (stack smashing) with poorly-implemented support for dubious document features (e.g. JavaScript in PDFs). Your examples aren't problematic because the x86 architecture allows data to be executed, those examples are problematic because people thought that scriptable-data wasn't going to raise any security concerns, then precisely for the same reason didn't bother performing a competent security review on that code.

      Please stop adding to the confusion that is evidently out there concerning the difficulty of writing software. And if you are currently employed in the software industry, please make a speedy exit, because you are a part of the problem.

    18. Re:Buffers by Tough+Love · · Score: 1

      In general, queueing is a Hard Problem[tm].

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    19. Re:Buffers by Tough+Love · · Score: 1

      Yeah send_buffer() was almost certainly asynchronous.

      Almost certainly not. Otherwise it would be called send_buffer_async and/or have a more elaborate API.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    20. Re:Buffers by MichaelSmith · · Score: 1

      Ah no not in this environment. That API would pass the buffer (pointer or contents, not sure) on to custom middlewear, which runs in a different process and transacts messages. The interface is via shared memory. There might be some local spooling as well.

    21. Re:Buffers by Tough+Love · · Score: 1

      Buffer overflows are often the result of not checking the data that is going into the buffer carefully enough...

      Buffer overflows have nothing to do with checking the data going into a buffer and everything to do with controlling the sizes and offsets of buffer accesses.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    22. Re:Buffers by Tough+Love · · Score: 1

      Buffers can always be protected from overflow by using a very well-known technique: buffer chaining. (A.K.A. "double buffering", "triple buffering"...)

      Glib answer, and wrong. For example, given finite memory a producer may outrun a consumer, no matter how many buffers you chain.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    23. Re:Buffers by Tough+Love · · Score: 1

      Much of this is because when C and it's standard libraries were created, CPU cycles were expensive.

      CPU cycles are still expensive, just look at your phone, which likely does not last through a day of normal use. What has gotten cheap is programmers with no respect for efficiency.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    24. Re:Buffers by Tough+Love · · Score: 1

      Go back and look at the code. What you are imagining would not have a ghost of a chance of working without more API glue.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    25. Re:Buffers by sjames · · Score: 1

      My phone runs 500 times faster than the mini that C was designed on.

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

      Right, but your suggestion makes my suggestion make even more sense.

      First perform a deep copy of the data structure in memory. This blocks the main thread and typically the UI. Then spin off a second thread to serialize and save the data structure. Since this second thread is working on its own copy of the structure it does not block the main thread and can take as long as it likes.

      If you want to begin to over optimize, then don't bother copying the data structure on the main thread, but instead spin up another thread immediately and put a lock on the data while it's being copied to a local reference available to that thread. The user will only see a blocked UI if they *immediately* continue editing, and chances are, the 1-2s that it takes to copy the data (again, application specific) will be "free" and the user won't even notice.

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

      I don't know C. I am C# programmer therefore not a real boy, but allocating '200' and copying '2000' has my Spidey Sense tingling.

    28. Re:Buffers by Tough+Love · · Score: 1

      My phone runs 500 times faster than the mini that C was designed on.

      So what? It still can't last 24 hours on a single charge. Reason: the application software running on it is crap written by crap programmers.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    29. Re:Buffers by greenreaper · · Score: 1

      That's potentially a problem, but probably not the problem.

    30. Re:Buffers by Anonymous Coward · · Score: 0

      Having run into this problem myself, the theory is that it's due to compiler allocation/deallocation spacing. Basically, you can't just allocate and deallocate willy-nilly or you leave unusable blocks of memory due to allocation order.

    31. Re:Buffers by Cassini2 · · Score: 1

      The user may be doing a save operation because the computer is running out of memory. This means a deep-copy may fail during the save operation. If the computer is simply out-of-memory, then the user will be left without a copy of the most recent document. If you are up against a soft-memory limit (the system is paging to disk madly), then the program will appear to stop while the deep-copy takes place. This can be a long-time. Long enough for the user to give up, end-task the application, and then lose his work.

      If the data structure is trivial, then it is safe to make the assumption the computer has lots of memory. However, in this case, the save operation will likely be quick so little advantage is gained from multi-threading. If the data structure is huge, then doubling the memory requirements during saves has significant performance advantages. But it is a no-win situation. The huge-data structure situation is also when the user would benefit from the multi-threading.

      Improvements over a Multi-Threaded Deep Copy Save

      A better solution than doing a deep copy is to duplicate only the bits of the data structure being modified by the user. Options:
      a) Under Unix/Linux, do a fork(). If the fork fails, then serially output the file. If the fork succeeds, then a different process was created with a complete copy of the data structure. Save the file in the second process, and then use any IPC mechanism to communicate success or failure back to the parent process. This is a no-cost solution, because the VM subsystem keeps track of all the duplicate and dirty pages for you.
      b) Under Windows. Design a thread-safe main data structure. This is hell. Even in Java, it is hell.

      Building thread safe main data structures is hard
      1. Performance is lost on every data structure access because the software has to check for the thread lock. This overhead can be worse than not having the data structure at all.
      2. With modern processors do delayed writes to main memory, and the delays can reach hundreds of clock-cycles. Suppose a thread-locks are placed around a non-thread safe library/data structure on a large program. How do you protect against a Write after Write bug on a multi-core CPU?

      Java's thread-locks may protect your code, but you have no idea what is happening in any non-thread safe third-party libraries. At least in C and C++, the debugger will often debug into those libraries and let you know the errors in your ways. In C# with third-party ActiveX controls, or in Java with low-level libraries, you are screwed.

      I'm not saying a multi-threaded save can't work. It is a beautiful thing when done right. It is just a hard thing to do. It works best when the data structures are small, simple, tight and easy to understand.

    32. Re:Buffers by tepples · · Score: 1

      First perform a deep copy of the data structure in memory. This blocks the main thread and typically the UI.

      That depends on a deep copy being quick, both to implement and to execute. I have a feeling that may be nearly as time-consuming as serialization itself, though I'm open to arguments as to why not.

      My first guess is that an application could keep the entire data structure in its own process and call fork() to take advantage of copy-on-write semantics in the operating system. But that'd mean a version of the program for an operating system without fork() (such as Microsoft Windows) would have to run at least the data structure process in a virtual machine running an operating system with fork(), and some platforms (such as iOS and Microsoft Windows UWP) don't support virtual machines at all due to their strict W^X policies.

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

      Great comments, thanks!

      I will say, in a lot of the languages I code with it is frustrating to find very limited support for determining whether the system has much memory remaining or not. In some cases (looking crossly at you .NET/C#) it is impossible to know or when an out of memory exception occurs, actually recover from it.

      In the scenario I proposed above it would be essential to make a decision regarding the available memory and whether to be "safe" and block the user and just get the data to disk ASAP, or, be more lase fare and run an async save.

      Your comments regarding partial data structures are solid, and by far the best, but as you say, are difficult to implement. Ultimately, (like a lot of programming/software design) it is an issue of managing complexity and deciding ahead of time where you want your bugs to be.

      ---

      NotAPK (not logged in, lazy, it's Sunday...)

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

      It's an extreme example, but imagine you have an image stored in memory as a byte array. Copying this in memory takes some time simply due to the size of the array (assuming large images) but saving to disk using a sophisticated compression algorithm may be an order of magnitude slower, and use extensive CPU resources.

      I've just finished up a C# project where we needed to make deep copies of large objects in memory. Using the standard .NET libraries for serialization I can tell you that the slowest was XML serialization, the next binary serialization, and finally: a hand-coded "clone" method that went through every child object and assigned properties by hand (doing this by reflection destroys any speed advantage) was by far the fastest. I don't want to post any detailed metrics as they'll be meaningless for any other data structure, but in our case we saw an order of magnitude between serialization and a hand-written deep-clone routine.

      ---

      NotAPK

    35. Re:Buffers by Bengie · · Score: 1

      Async isn't meant to help cpu intensive work loads. Generally, most computers have too much CPU power and not enough IO or scaling. If you're getting "synchronous freezing" from "cpu intensive" work that needs to be done prior to your IO, you have an easy problem on your hands. Get more cores. If modern CPUs are not enough for your workload, it's probably because you're horrible at coding.

    36. Re:Buffers by tepples · · Score: 1

      If you have to hand-code "clone", you're violating Don't Repeat Yourself. What tests do you have that your hand-coded "clone" method covers all properties of the object and doesn't cover non-memory resources that shouldn't be copied, such as window handles and the like? And in that case, you're still looking at a lot of calls to memory allocation, one for each object reference that makes up the document.

    37. Re:Buffers by tepples · · Score: 1

      If you're getting "synchronous freezing" from "cpu intensive" work that needs to be done prior to your IO, you have an easy problem on your hands. Get more cores.

      Shipping more cores to each user costs hundreds of dollars and can limit the physical places in which the application can be used.

      If modern CPUs are not enough for your workload, it's probably because you're horrible at coding.

      Not all computers are desktop PCs with a chassis large and heavy enough to hold cooling for the TDP of "modern CPUs".

    38. Re:Buffers by Bengie · · Score: 1

      Because there is no such thing as a buffer really, it's an abstraction on memory

      And there's no such thing as color, it's just an abstraction of the relation among different optical inputs
      And there's not such thing as thought, it's just a complex interaction of chemical reactions
      And there's not such thing as random, the Universe is deterministic
      And there's not such thing as life, just atoms moving around

      Everything we know of in this world is just a collection of characteristics that describe an abstract idea.

    39. Re:Buffers by petervandervos · · Score: 1

      What I would say about the code:

      1: the size of data is not given
      2: the code doesn't check if the malloc is valid;
      3: you malloc 200 but copy 2000, hope thats a type
      4: you don't check the result of send_buffer
      5: send_buffer is not a standard function, you have to check what it does.

    40. Re:Buffers by sjames · · Score: 1

      That's because they keep wanting to make phones thin enough to chop onions. That and instead of just some bounds checking and such, they use a Java like VM.

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

      And the buffer overflowed quite badly too ;-).

    42. Re:Buffers by Megol · · Score: 1

      Bounds checking overheads are commonly in the noise, even when it is not the difference isn't large.

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

      "If you have to hand-code "clone", you're violating Don't Repeat Yourself. "

      I disagree entirely. In this instance I'm talking about C#. There are no built in methods to get a deep clone of an object without "hacking" through serialization/deserialization or reflection. Both of which are dog-slow. If I write a DeepClone() method on my own class then how am I repeating myself? Child classes also get their own DeepClone() method and are called as needed. The code to create the deep clone only does everything once, and at no point is anything repeated. Or have I misunderstood your comment??

      "What tests do you have that your hand-coded "clone" method covers all properties of the object and doesn't cover non-memory resources that shouldn't be copied"

      Very easy to test this: start with one object, clone it, serialize both copies to disk and do a byte comparison. That's my unit test for the deep clone and it works very well. To test robustness, deserialize both objects back from disk, then back to disk (thus, 1.5 round trips each) and do the byte comparison again. If nothing is broken they should still be the same, and match their previous versions.

      Keep in mind that this particular approach is all about speed. In C# there is no other way to do it quickly.

      As for deep cloning, things do get hairy when the objects are complex, contain non-serializeable references, and even contain circular references. But, you have to do the hard work at some point. So if the structure can't be simplified, then the only way (comments welcome) is for references to be broken across the object to create a serializable form. To re-join those references after the clone, or on deserialization, then those objects whose references were discarded are tagged with a GUID, and the GUID then searched for and the reference re-created. Of course looking up those references is costly, but for the object structures in this recent project I was working on, the performance was still better than the other deep-clone methods, mostly based on serialize/deserialize.

      Anyway, I suddenly feel like I'm defending myself when the original postulation was certainly not a general rule. In this discussion we went from saving on one thread, to how saving on a second thread doesn't help if the objects have to be locked, thus locking the main thread anyway, to cloning the objects so the second thread can take its time with the save. Now we're talking about how deep cloning in C# sucks, and yes I agree it does and I'm not going to defend it one bit. As always, many situations are different and you must choose the best way to do things: that's the entire damn point of this programming malarkey anyway!

      ---
      NotAPK (3rd Time I've posted this here, browser seems to post it, but it doesn't show up when the page is refreshed...)

    44. Re:Buffers by Tough+Love · · Score: 1

      That just makes it all the more important to write efficient software. So crap programmers remains just as big a problem as the realities of physics. No excuses please.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    45. Re:Buffers by Aighearach · · Score: 1

      Don't blame MS for... the entire history of software. That fails.

      Don't blame Intel for... Turing machines! Code being data was invented by Alan Turing in 1936. x86 was introduced in 1978. If you don't want to blame Turing, you can blame Von Neumann who created the implementation that lead to modern systems and compilers. (1944-5)

      The alternative is Harvard Architecture. (1944) Most of the programming I do is for Harvard Architecture systems. You might be disappointed to learn it would make your computer cost at least twice as much and use more power, and require more programming hours to do the same things.

      One obvious mistake you make is in confusing bugs in an API that stores code as data for bugs that are caused by storing code as data. Yes, Von Neumann architecture allows bugs to escalate into security problems, because the users have misplaced trust in the computer, but the bugs themselves are not caused by it. And since Harvard Architecture requires more programming hours to do the same work, it isn't clear that the bugs would be less-bad because fixing or preventing them would cost more money! So you'd need real data before even forming an opinion there. What allows malicious code is the ability of the user to load code; it is as simple as that. If you separate code and data, you're still loading user-supplied code somehow, and that will be the attack vector for malicious code. Problem not solved.

      We (programmers) know how to solve all the known problems, including all the bugs. The problem is, solutions have costs, and budgets are not unlimited. Tradeoffs must be made, and just wanting everything to be better isn't a viable tradeoff.

    46. Re:Buffers by Aighearach · · Score: 1

      If you can't fuck off and work at Walmat instead, there are far too many of you people driving the value out of software.

      In the new gig economy, maybe he can do all three?

    47. Re:Buffers by Aighearach · · Score: 1

      Buffer overflows are often the result of not checking the data that is going into the buffer carefully enough, or at all.

      I sortof agree, in that this mistaken belief is indeed the cause of most buffer overflow bugs. ;) The sanity checking is in the wrong place, and so easily and predictably fails in places and ways that surprise the author of said code.

    48. Re:Buffers by MichaelSmith · · Score: 1

      The 200-2000 thing isn't my typo. Obviously you should check the required space before doing a malloc and memcopy. This was one of about ten functions, each for a different type of message. They all had the same boilerplate malloc, etc. I suspect the mistake was made once and then pasted multiple times. The 2k buffer was probably enough (200 might have been enough at one point). The pattern in that application would have been to #define a constant in a module level header. Pattern was not followed.

    49. Re:Buffers by K.+S.+Kyosuke · · Score: 1

      a) Under Unix/Linux, do a fork(). If the fork fails, then serially output the file. If the fork succeeds, then a different process was created with a complete copy of the data structure. Save the file in the second process, and then use any IPC mechanism to communicate success or failure back to the parent process. This is a no-cost solution, because the VM subsystem keeps track of all the duplicate and dirty pages for you.

      This almost sounds like a cheap, pseudo-time-ish approach to data structure versioning.

      --
      Ezekiel 23:20
    50. Re:Buffers by K.+S.+Kyosuke · · Score: 1

      and finally: a hand-coded "clone" method that went through every child object and assigned properties by hand (doing this by reflection destroys any speed advantage)

      Now this is what you get if your language doesn't have proper macros. :/ More work for no good reason.

      --
      Ezekiel 23:20
    51. Re:Buffers by Anonymous Coward · · Score: 0

      Are you serious...

      First we don't have any information about send_buffer (how does it know the size of buffer, for instance?).

      Second there is an obvious mistake in the memcpy call, which copies 2000 bytes of data even though a) data may be smaller, and b) buffer is only allocated 200 bytes.

      Well this is stupid.

    52. Re:Buffers by Gazzonyx · · Score: 1

      I'll repeat it because it can't be overstated; the buffer size should have been #defined with a meaningful name. This is a symptom of a lack of self discipline rather than buffers being difficult to code. Whoever wrote that code, and then copied and pasted it rather than creating a new function that accepted parameters for the value(s) that varied, is guaranteed to be the kind of developer that leaves bugs in everything they touch. That code should have been painful for them to write without using a preprocessor #define and then again when copying and pasting code with hard-coded values. IMHO, they either enjoy the pain or don't have the ability to learn from the pain they cause themselves.

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

  10. Surprised by Anonymous Coward · · Score: 1

    Surprised all of them weren't just "Seriously? I've looked like 6 times, I don't see a missed semicolon. I think the compiler is just lying now."

  11. Re:Serious he missed the 2 biggest problems I've h by mark-t · · Score: 4, Insightful

    I'd like to second that #2 problem you mentioned. Easily the most annoying problem in programming I face is functional requirements not being fully specced out before the project begins and discovering well into it that I have to redo a month's worth of work when the requirements exceed the demands of how the code was originally written. In most cases, time is usually given for these changes, but sometime's it's not... and man, are those times infuriating.

  12. Closure and Threads... by ndykman · · Score: 0

    While I agree that they can be difficult, they exist for a reason, and frankly, with some proper study of functional and parallel programming, they can be used correctly. Closures have been a part of programming since LISP and frankly, higher order functions and functional programming can solve a lot of problems quite nicely. Certainly, mutability makes that a bit more difficult, but it can be managed. Finally, figuring out what variables are captured in a closure is quite doable by static analysis, which would be a nice addition to some programming environments.

    Threads are more difficult for sure, but there are frameworks that can provide some useful higher level abstractions to make there use a bit easier. Lower level usage can be quite difficult, but a bit of actual thought and design goes along way. Also, there are some really powerful tools for multithreaded debugging, they just aren't freely available.

    Mainly, I've found that people that can't manage these abstractions just don't have enough background in operating systems (which also discusses basics of concurrency) and functional programming, topics that used to be required in CS education. They can be learned and it can increase your overall code quality and reduce some frustrations.

    1. Re:Closure and Threads... by MichaelSmith · · Score: 1

      with some proper study of functional and parallel programming

      Yeah but for every person who does that there are 10000 wannabees who just want a bigger paycheck.

    2. Re:Closure and Threads... by K.+S.+Kyosuke · · Score: 1

      Closures have been a part of programming since LISP

      Since Scheme, I believe. Lisp "at large" tended to be dynamically scoped before Scheme, with predictable (deleterious) results. The improvement was so substantial that this was one of the novel things adopted in the Common Lisp standard, beyond the "lowest common denominator" unification of extant dialects.

      --
      Ezekiel 23:20
    3. Re:Closure and Threads... by gtall · · Score: 1

      LISP doesn't have closures, at least it didn't back when I learned it, it had dynamic binding, precisely what will shoot closures dead. Scheme had/has closures.

    4. Re:Closure and Threads... by garethjrowlands · · Score: 1

      It's the other way round: closures shot dynamic binding dead. In general, lexical scoping is better for programming languages than dynamic scoping, in both theory and practice.

      There's lots of information on the Internet about this but here's a quick link: https://courses.cs.washington....

      Javascript has both lexical and dynamic scoping: 'this' is dynamically scoped and everything else is lexical. While 'this' is used extensively in Javascript, it's really a mistake. You can do all the useful 'this'-style things with closures alone, and it's easier to reason about.

  13. Four hard problems in programming: by rastos1 · · Score: 5, Funny

    As far as I know, there are four hard problems in programming:

    1. caching
    2. naming (i.e. how do I name that variable/method/class)
    3. off-by-one errors

    1. Re:Four hard problems in programming: by mbone · · Score: 3, Informative

      As far as I know, there are four hard problems in programming:

      1. caching

      2. naming (i.e. how do I name that variable/method/class)

      3. off-by-one errors

      Or, as old Fortran programmers would put it, insisting that the first item in a list have an index of 0.

    2. Re:Four hard problems in programming: by AmiMoJo · · Score: 4, Interesting

      The best but if advice I've ever had for variable naming is to put the units in the name. If you are handling values in millimetres, use a _mm suffix. For area use _mm2. For graphics use _px for pixels etc.

      I've seen so many programmers get hopelessly confused because they can't remember what units they have when doing maths or trying to render data on screen. On some systems pointers can use byte or word addressing too.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    3. Re:Four hard problems in programming: by bidule · · Score: 1

      Ah, true hungarian notation. The other use case being suffixes such as _raw vs _validated.

      --
      ID: the nose did not occur naturally, how would we wear glasses otherwise? (apologies to Voltaire)
    4. Re:Four hard problems in programming: by vtcodger · · Score: 4, Insightful

      How about?:
        4. Race conditions
          Often very hard to spot using static analysis and not guaranteed to show up during testing.

      The bane of embedded and command-control systems.

      --
      You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
    5. Re:Four hard problems in programming: by lgw · · Score: 1

      Pigs are flying, Hell is frozen solid, and I agree with AmiMoJo. Putting units in your names is the best advice. (But I can still argue with you - you "_" using heretic! Eeeeeeevil!)

      --
      Socialism: a lie told by totalitarians and believed by fools.
    6. Re:Four hard problems in programming: by Xrikcus · · Score: 3, Insightful

      Or, even better, put them in the type. This is one thing that makes std::chrono hard to use incorrectly.

    7. Re:Four hard problems in programming: by aix+tom · · Score: 1

      One of our software vendors seemed to have that Idea, which is why we still have some variable and column names around that use the _dm suffix for "Deutsche Mark", almost two decades after the values stored in them switched to Euro. ;-)

    8. Re:Four hard problems in programming: by Proudrooster · · Score: 1

      Yes... off-by-one... bit me last week, Google decided to define January as month zero, so all queries need a month+1... maddening.

    9. Re:Four hard problems in programming: by Plus1Entropy · · Score: 3, Informative

      Agreed that race conditions can be very tricky to spot. But there is one case I've run into a couple of times...

      If you're trying to debug something and you start putting in some print statements or breakpoints, and suddenly the bug goes away... It's probably a race condition, which was inadvertently "fixed" by you slowing down the execution with your breakpoints, etc. I like to think of it as the CS equivalent of the Observer Effect.

      --
      Only crack the nuts that crack. You don't put the ones that don't crack in the sack.
    10. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      So you're saying you'd walk a mile for a camel(case)? -PCP

    11. Re:Four hard problems in programming: by Hognoxious · · Score: 1

      Fucking rubbish. Use a struct/class/type or whatever, with two fields: one for the number, the other for the unit.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    12. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      As far as I know, there are four hard problems in programming:

      1. caching

      2. naming (i.e. how do I name that variable/method/class)

      3. off-by-one errors

      Or, as old Fortran programmers would put it, insisting that the first item in a list have an index of 0.

      These problems can only be attributable to human error.

    13. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      Use a system verification tool that allows you to model your system and dynamically analyze the system. I use SPIN as a model checker and Promela as the modeling language.

    14. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      Ahh yes, I had one of these to solve this week. I was so ticked at the person who wrote it; myself. Needless to say I cursed myself out for about two days while I reworked the code to fix it.

    15. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

          Often very hard to spot using static 4. Race conditions analysis and not guaranteed to show up during testing.

      The bane of embedded and commaHow about?:nd-control systems.

      Fixed that for you.

    16. Re:Four hard problems in programming: by Sique · · Score: 3, Informative
      Off-by-one errors are not solved by having the first item in a list indexed by 1. You still have the mathematical feature that all natural numbers have an ordinality and a cardinality. If you insist, that the ordinality of a number equals the cardinality, you have to start with 0 as the first index.

      (For people not much into set theory: The cardinality is the answer to "how many elements are in a given set?", and the ordinality answers "how many predecessors does the number have?")

      --
      .sig: Sique *sigh*
    17. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      it's actally
      1. caching
      2. race conditions
      2. naming
      3. off-by-one-errors
      4. race conditions

    18. Re:Four hard problems in programming: by Anonymous Coward · · Score: 0

      Yeah, but using camelCase doesn't really work here -- widthMm is not the same as widthmm.

    19. Re:Four hard problems in programming: by serviscope_minor · · Score: 2

      The best but if advice I've ever had for variable naming is to put the units in the name. If you are handling values in millimetres, use a _mm suffix. For area use _mm2. For graphics use _px for pixels etc.

      That works and has generally been my go-to method.

      An interesting alternative is where the units are part of the type, and I've been getting to the C++ std::chrono library which makes heavy use of it. It's actually rather nice. It models durations and time points as separate concepts, but not only that, it models durations as a type family. So, you can do this:


      auto delay = 10ms;
      auto next_timeout = system_clock::now() + delay;

      which is guaranteed to be correct and not lose precision no matter if you port it to a system with a different system clock tick rate. The thing is the underlying units actually don't matter. At the time you want something more concrete, e.g. the timeout for a select() call, you can convert to a specific time base (e.g miliseconds) and get the number of ticks.

      --
      SJW n. One who posts facts.
    20. Re:Four hard problems in programming: by AmiMoJo · · Score: 1

      Wow, that's really nice. I'm going to look into it, see if we can use it on our micros.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    21. Re:Four hard problems in programming: by StormReaver · · Score: 1

      Or, as old Fortran programmers would put it, insisting that the first item in a list have an index of 0.

      Or, as those who fail to learn how computers work would put it, insisting that the first item in a list have an index of 1.

    22. Re:Four hard problems in programming: by garethjrowlands · · Score: 1

      This advice assumes that the type system can't keep track of the units. If you have a programming language that can do that - and many the better ones can - you should let the compiler do the work.

    23. Re:Four hard problems in programming: by Black.Shuck · · Score: 1

      Or, as old Fortran programmers would put it, insisting that the first item in a list have an index of 0.

      There's a real-world problem that helped this logic make sense for me.

      When I was learning to drive I was told that a good rule for keeping a safe-distance from the car in front, regardless of speed, is 2 seconds. To count those seconds you would watch the car in front pass a sign-post or other reference point, and count until you reach that reference yourself. Over time you get a feel for the right safe distance at any speed.

      But when I counted I would start at "1" and not "0", meaning I was slowly training myself to have only a 1 second break between myself and whoever was in front of me. How many stop-watches have I ever used start counting from 00:01:00? Precisely one. I mean zero.

      Anyway, long before I figured out how stupid I was, I had heard from others that they thought the same rule was 3 seconds, not 2. Presumably they were taught by driving-instructor who understood that people are always off-by-one when they measure time.

    24. Re:Four hard problems in programming: by Bengie · · Score: 1

      I've only had an issue with a race-condition once, and that was when I only had a few weeks experience programming. Write you code in a way that guarantees that race conditions can only occur in certain locations and that problem is easy. I have not had to use a debugger to fix a race condition in years now.

      My most recent project was extremely async and parallel for highly scalable IO. I told my manager it would take me at least 1 month to write it, I was given a week. I slapped that thing together, stuck it in prod and hoped for the best. Now, 6 months later, Someone had an odd difficult to reproduce issue. I looked at the stack-trace, got a bit perplexed for a few minutes, then realized the problem. Five minutes later I had it fixed. This pretty much describes every race condition I have ever had. Only a few times have I had to use a debugger, and that's because the issue actually existed in someone else's code, to which I did not have access.

      My co-workers describe me as having a super-human intuition for debugging code. I seem to have a knack for being able to debug non-reproducible errors in system to which I have never seen the code, nor know the architecture. Based solely on the characteristics of the issue, I can infer the architecture and the nature of the problem. I've never understood other people inability to debug these issues. I just think of many mental models to solutions for the system, then pick a mental model that would have the same symptoms as being described. Nearly every time, the mental model I choose very closely matches the design of the system. People just need to get better at creating viable mental models.

    25. Re:Four hard problems in programming: by TranquilVoid · · Score: 1

      Not going to disagree, but in my experience C printfs and Fortran PRINT/WRITE statements have on occasion masked memory and stack corruption bugs. I have vague memories of a previous job where a PRINT was ultimately submitted (not by me) as the fix :)

    26. Re:Four hard problems in programming: by michael_wojcik · · Score: 1

      It's funnier in the original formulation.

      Some years ago, Phil Carlton said: "There are only two hard problems in Computer Science: cache invalidation and naming things."

      Obviously, that qualifies as a wry observation, but not full-on nerd hilarity. So variations started making the rounds.

      In 2014, Jeff Atwood tweeted this one: "There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors." I don't know if he coined it, but his was extensively retweeted, so at least he helped propagate it. Note how it follows Carlton's formulation and doesn't belabor the point.

  14. arrogance is tops by Anonymous Coward · · Score: 1

    people are by nature flawed and some chained by hubris. Creating software can inculcate a self perception as someone with higher insight into patterns and abstract thoughts. Problems occur when that self perception exceeds known reality.

    1. Re:arrogance is tops by ATMAvatar · · Score: 4, Interesting

      That is part of the Dunning-Kruger effect, exacerbated by the software industry's propensity to follow a Logan's Run-like purging of more experienced developers.

      --
      "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
    2. Re:arrogance is tops by JaredOfEuropa · · Score: 1

      the software industry's propensity to follow a Logan's Run-like purging of more experienced developers.

      Wow... if there ever was an apt analogy, this is it. Actually, it is a little bit worse than that. In most places I worked, programming is not just seen as a young man's game, but as a job that you do before you get a real job like manager or team lead or architect or business analyst. A bit like getting started working in the mail room. After a year or 3 of coding you are an "experienced programmer", after 5 you are a "senior developer", and after 8 years... you are a loser. Small wonder so many of our software development projects turn to utter shit.

      --
      If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    3. Re:arrogance is tops by Cassini2 · · Score: 3, Interesting

      A related problem is that there is no way for the hiring manager to tell the difference between a very good programmer and a good programmer. All of the first year CS resumes say the candidates are skilled in C, Java, and a few more buzzwords. Every software project has a life-cycle, and the better programmers move between projects. This means all the experienced resumes show people with many projects. This makes it hard to tell the difference between a competent person that makes meaningful contributions then moves on, and a less competent person that is a good talker and drifts.

      It's a real problem for the hiring manager. It essentially means that you can't pay more for better programmers. Economists even have terms for this. Product differentiation. If you can't show you are an A+ programmer as opposed to an A programmer or a C programmer, then it becomes difficult to make the case that the A+ programmer is worth four C programmers. It even becomes difficult to tell who the A+ programmers are. This tends to drive out experienced programmers into other careers.

      This problem really affects software engineers. I can tell the difference between a skilled electrician and an unskilled electrician in minutes. Great architects win awards. Develop a great piece of real-time engineering on a safety-critical system - no one is ever going to see your work. Sure, you might save lots of lives with your code. But the hiring manager for your next job can't tell the difference.

    4. Re:arrogance is tops by JaredOfEuropa · · Score: 1

      That's an interesting perspective. I interviewed coder job applicants at some point in my life: and found that you can figure out who is competent and who is not to some degree: the less competent drifter can be exposed by just talking about details of previous projects. No bloody coding tests required, either. But exceptional skills are not so easily uncovered from a resumé or in an interview; they can sometimes proven by reputation or publication, for example contributions to FOSS projects.

      However, that changes once the exceptional programmer gets to work. And even then I found that exceptional programmers don't get paid substantially more than the merely adequate.

      --
      If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    5. Re:arrogance is tops by xtsigs · · Score: 1

      No sure way to avoid this, but here's some ideas that have helped me (could be just my style and not for everyone).

      1) Give applicant code samples of some complexity and ask them what it does. A decent coder will be able to tell you. A better than decent coder will be interested in making improvements or ask questions of why it was done this way and not that way.
      2) If you can, hire early and get the coders working on prototypes even before project is fully defined.
      3) It is difficult to let a middling coder go in the middle of a project, but do it anyway. It will save in the long run.
      4) Try to keep on good terms with your A & A+ coders and rehire them for future projects.
      5) Keep stats on how much your top coders are saving the customer, rather, how much poor coders cost the customer and delay the project. Use that information to insist on top pay for top people. It is better to have fewer well treated highly competent coders than many who will introduce more problems into the process.
      6) Pair up experienced A & A+ coders with less experienced, but teachable, younger ones. Usually the best want to work with the best and enjoy sharing their knowledge. The inexperienced, but bright and teachable, will respond.
      7) This will be controversial: focus on self-taught, or work-experienced taught, and avoid university and, especially, tech school taught. It is smart for the best to take classes, but the formal "computer science" education tends to turn out really fucked up programmers, and it is hard to undo that conditioning.

    6. Re:arrogance is tops by Anonymous Coward · · Score: 0

      During hiring it is hard. After working with people for 6 months it is pretty darn easy. But there are very, very few companies that are willing to pay say 3x as much to a programmer (say 375k/year instead of 125k) even if you can prove they are adding that much value. There are also very few people that are worth that much. There is a much bigger section of people that are worth say 1.5x as much as an average programmer.

      And the key in hiring is being willing to fire bad programmers.

  15. Multithreading is a solved problem by melted · · Score: 4, Insightful

    And it's not that hard. Some people make it hard because they're incompetent. The golden rule of multithreading is: your multithreading set-up has to be very simple. Don't optimize (and for the love of god, unless you really understand cache coherence, don't use atomics), aim for clarity, use mutex locks for shared data, and if you have to use several, make sure you acquire them in the same order. 99.9% of the problems disappear if you follow this simple advice.

    1. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      ^ this guy knows his shit.. ++1

    2. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      Or just use go and all those problems disappear as well.

    3. Re:Multithreading is a solved problem by K.+S.+Kyosuke · · Score: 2

      The most important thing is that you shouldn't even be exposed to these primitives in application programming. You just shouldn't. Likewise, the collective amnesia that makes programming people forget useful concepts invented in the past such as pseudo-time doesn't help any. (I'm pretty sure someone will reinvent that one in near future, with great fanfare!)

      --
      Ezekiel 23:20
    4. Re:Multithreading is a solved problem by bigbang137 · · Score: 1

      If I am not mistaken, Go uses message passing and that is fine, but sometimes what you want is shared memory.

    5. Re:Multithreading is a solved problem by Lisandro · · Score: 1

      You can do shared memory in go, locks and all. But yes, it encourages the use of signals.

    6. Re:Multithreading is a solved problem by Puff_Of_Hot_Air · · Score: 1

      Yes, and if you follow this golden path, what does it give you? Nothing more than asynchronous behaviour. And there are much better and more robust mechanisms to achieve this (such as co-routines, or their virtual equivalent such as async await in C#, message passing, etc etc). What it doesn't give you is any kind of scalability across multiple cores, and the level of complexity is all out of proportion to the gains. Multithreading particularly in combination with OO, has largely failed, because the paradigms were simply not good enough.

    7. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      The most important thing is that you shouldn't even be exposed to these primitives in application programming.

      Right, but abstractions are leaky...

    8. Re:Multithreading is a solved problem by buddyglass · · Score: 3, Insightful

      I'm not willing to chalk it up to a lack of education. Concurrency is legitimately more difficult than straightforward single-threaded code. Some developers can handle it; some can't.

    9. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      And it's not that hard. Some people make it hard because they're incompetent. The golden rule of multithreading is: your multithreading set-up has to be very simple. Don't optimize (and for the love of god, unless you really understand cache coherence, don't use atomics), aim for clarity, use mutex locks for shared data, and if you have to use several, make sure you acquire them in the same order. 99.9% of the problems disappear if you follow this simple advice.

      If your shared data is accessed infrequently enough, then locks are fine and highly recommended. If not, then maybe you can change to something like a many producers N consumers model. The produces has variables it rights. Each consumer has variables it writes, none of the threads write to each others variables, though they may read some of them. In the general case, the producer must check all the consumers to see what part of a circular buffer is now ready to be overwritten. (Each consumer will keep track of how many data chunks it has consumed.) Also, things like points written/read need to be I64s, in general. (A mod operation is generally required to translate the I64s back to a physical buffer though a local copy may also be used such that when you hit the buffer size -1 the variable goes to 0.) Of course this kind of thing assumes adding one to an I64 is atomic. I've not seen any case where it is not, but I don't think I ever formally proved it.

      But yah, in general, just use locks unless your really sure you understand everything that is going on. Avoiding locks can be much faster, but it is certainly not without considerable risks..

    10. Re:Multithreading is a solved problem by phantomfive · · Score: 1

      Threading is hard because cyclomatic complexity is increased by an order of magnitude as soon as you add a thread. That's so many more test cases you need to add.
      It's manageable, but wise programmers tend to avoid threads when there is another option.

      --
      "First they came for the slanderers and i said nothing."
    11. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      Provided you only want to target Intel. Pointless language.

    12. Re:Multithreading is a solved problem by Proudrooster · · Score: 1

      And make sure there is a PID (process ID) lookup table so you can verify that a lock holder isn't dead holding a lock on shared memory/other resource. You can design it well but you need this verification to make it more bullet proof.

    13. Re:Multithreading is a solved problem by K.+S.+Kyosuke · · Score: 1

      It sounds like an abstraction problem. If you have stateful, ordering-dependent code, you're going to hit ordering problems. But the original formulations of problems solved on computers don't generally assume any ordering. That's an artifact of converting specifications into implementations. The idea of a "thread" of "instructions" better never enter your mind before compiler eats the source file.

      --
      Ezekiel 23:20
    14. Re:Multithreading is a solved problem by sribe · · Score: 1

      Or just use go and all those problems disappear as well.

      BWAHAHAHA! They disappear, right up until the moment you send mutable references across channels instead of deep copies, then poof you're right back to having to get your locks correct!

      OTOH, "Or just use Erlang and all those problems disappear as well." would actually be a correct statement.

    15. Re:Multithreading is a solved problem by UID30 · · Score: 1

      Interestingly, when you dig down deep enough you find that the hardware really isn't quite up to snuff. A year or so back I was tasked with performing a ludicrous number of calculations on an on-going basis ... back of the napkin math told us that our existing system would take ~1.5 years to perform 1 set of calcs and we needed them every 3 months or so. TPL in C# was up to the task and I was able to squeeze the calcs down into 22 hours running on my development desktop. Deploying the solution to a medium sized server brought to light the limitations of NUMA architectures in multi-processor systems. If your app breaks that NUMA barrier, performance drops so much that its really not worth scaling out.

      --
      "Glory is fleeting, but obscurity is forever." - Napoleon Bonaparte
    16. Re:Multithreading is a solved problem by Anonymous Coward · · Score: 0

      http://www.erlang.org/

    17. Re:Multithreading is a solved problem by Raenex · · Score: 1

      What a load of horse shit. This is like when C/C++ programmers say avoiding memory corruption is right as long as you are competent and follow a few simple rules.

      The issue is that code quickly becomes complex, humans are far from perfect, and it is *very* easy to make a mistake and break one of the "rules", and you end up with code that can run fine 99% of the time and then shit the bed and corrupt data in ways that are hard to reproduce or track down, often in a production environment.

    18. Re: Multithreading is a solved problem by Anonymous Coward · · Score: 0

      Google's backend is almost entirely C++. Doesn't "shit the bed". Your argument is invalid.

    19. Re: Multithreading is a solved problem by Raenex · · Score: 1

      Google has a fuckton of servers. If one of them misbehaves on a search, it doesn't matter. They have bugs just like everybody else.

    20. Re:Multithreading is a solved problem by Bengie · · Score: 1

      I love using atomics, but the biggest issue I have with them is the assumptions I make are based on x86 or x64 memory ordering guarantees. Please don't use my code on ARM.

      The reason I like using my own atomic thread sync code is I like to write my threaded code to not require exact ordering where possible, as long as the result is the same. Sometimes this results in duplicate work being performed and one of the results effectively discarded, but the reduction in locking overhead is a huge win for scalability.

  16. Naming by Lisandro · · Score: 2

    Seriously, i spend more time thinking on this than anything else lately.

  17. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 1

    1 who's my customer
    2 What does he or she actually want.

    What you mention are not programming problems.

  18. Missed "The fix is ALWAYS more code!" by Anonymous Coward · · Score: 0

    I've run into WAY too many programmers whose only solution to ANY problem is to write more code.

    Not fixing the broken crap they've already written, not buy faster hardware because the current system is too slow.

    It's always, "I MUST write MORE CODE to solve this problem!"

  19. List is pretty random by Anonymous Coward · · Score: 0

    Multithreading isn't easy, but it's not exactly Nobel Prize material. It's probably like contract law for lawyers - it takes a while to develop competence.

    Throwing that in with NP-complete and security (and the latter two with each other) is nonsense. Security is obviously going to always remain unsolved as long as technology keeps advancing, because the attackers are wily humans who use their creativity to probe for new weaknesses. And NP-complete basically means that no scalable solution exists, so you have to simplify or work around whatever it is you were originally trying to do, or settle for small problem sizes.

  20. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 5, Funny

    Haha, you should be more Agile! It's not Agile to find out what your customers need first. Just throw a bunch of shit at the wall, make it flatter, and dump it into production to let your customers do your testing and chip away at the things they complain about.

    They'll definitely give you useful feedback and not switch to another software product instead. If there's one thing that's always been true about customers, it's that they're fiercely loyal to their software vendors.

  21. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0, Insightful

    What do women want?

    But that's the domain of pop music, TV sitcoms and movie rom-coms, and stand up comedy.

  22. one liner by Anonymous Coward · · Score: 0

    last minute one liner that won't harm anything, wink wink.

    1. Re:one liner by fyngyrz · · Score: 1

      ...compounded with "I know it'll work, I'll just build and ship, THAT doesn't need to be tested!"

      --
      I've fallen off your lawn, and I can't get up.
    2. Re:one liner by michael_cain · · Score: 1

      Years back, a telephone switch company made a three-line change in some exception-handling code and pushed it without testing. Somewhat later the exception happened, was handled improperly, and the problem propagated from one switch to another, eventually taking down long-distance phone service for most of the East Coast. Ultimately put the company out of business.

      Absolutely one of the hardest programming problems is in distributed real-time systems, making sure that errors are caught and damp out rather than propagating.

  23. It's probably because you suck at it by Anonymous Coward · · Score: 1, Informative

    Script kiddies spent their whole fucking lives in Javascript are terrified of threads...just like they are of Trump. All good software is multithreaded. All useful software is multithreaded. Threads have been around for fucking decades. Just because ppl got all chicken shit and decided to go all "single threaded non-blocking V8 engine jackoff" means squat. If you can't do threads you suck as a programmer and should either work really hard to figure it out or find something else to do.

    1. Re:It's probably because you suck at it by Anonymous Coward · · Score: 1

      Our web application is a disaster, the world is laughing at us. It's the worst web application in history. Believe me, Trump can fix it, he will make it great again.

    2. Re:It's probably because you suck at it by MichaelSmith · · Score: 2

      Wow. The script kiddies where I work are doing all their backend programming in coffescript, running in js interpreters. Every branch and loop they write creates a new callback (which they call threads) so there is no way to predict which order they run in. Half the applications are tricks to put order of execution back into a meaningful sequence and avoid race conditions.

    3. Re:It's probably because you suck at it by Anonymous Coward · · Score: 0

      Callbacks creating race conditions? They're RACIST!!!!! #ThreadsMatter

    4. Re:It's probably because you suck at it by K.+S.+Kyosuke · · Score: 1

      Sounds like continuations. :)

      --
      Ezekiel 23:20
    5. Re:It's probably because you suck at it by thejynxed · · Score: 1

      Sounds like they need smacked upside of the head, er, I mean shown a better way and getting them hooked into using it.

      Unfortunately from what I've observed of the younger IT staff at my regular employer, you'll probably have to come up with some trophy-based ego boosting reward as a means to get them to do so.

      --
      @Mindless Drivel: 100% of Twitter posts ever Tweeted.
    6. Re:It's probably because you suck at it by K.+S.+Kyosuke · · Score: 1

      Sounds like they need smacked upside of the head, er, I mean shown a better way and getting them hooked into using it.

      So...teach them Racket?

      --
      Ezekiel 23:20
  24. Everyone runs with fear from NP problems by NFN_NLN · · Score: 4, Funny

    > NP-complete problems. "Everyone runs with fear from these problems because they're the perfect example of one of the biggest bogeymen in Silicon Valley: algorithms that won't scale."

    Customer: Why is this problem not scaling?
    Programmer: It is NP-hard we are basically just brute forcing it.
    Customer: If you can't solve this "NP-hard" problem, then I'll just find someone who will.
    Programmer: Sure, let me know when that happens.

    1. Re:Everyone runs with fear from NP problems by Anonymous Coward · · Score: 0

      So why not use a polytime approximation? Sometimes good enough is good enough.

    2. Re:Everyone runs with fear from NP problems by Anonymous Coward · · Score: 0

      Customer: Why is this problem not scaling?
      Programmer: It is NP-hard we are basically just brute forcing it.
      Customer: If you can't solve this "NP-hard" problem, then I'll just find someone who will.
      Programmer: Sure, let me know when that happens.

      Replace "customer" with "boss" - you will be replaced with some BS artist.
      The other "solution" is "we'll just buy a bigger/faster computer." Suits can't grasp exponential curves except on fiscal projections..

      So why not use a polytime approximation? Sometimes good enough is good enough.

      Suits are so used to hacking approximations that they don't believe there are problems where there are no polytime approximations (e.g., integer packing problems.).

    3. Re:Everyone runs with fear from NP problems by bheerssen · · Score: 2

      > NP-complete problems. "Everyone runs with fear from these problems because they're the perfect example of one of the biggest bogeymen in Silicon Valley: algorithms that won't scale."

      > Customer: Why is this problem not scaling?
      > Programmer: It is NP-hard we are basically just brute forcing it.
      > Customer: If you can't solve this "NP-hard" problem, then I'll just find someone who will.
      > Programmer: Sure, let me know when that happens.

      Customer: GTFO&DIAF
      Programmer: Well, shit.

      --
      (Score: -1, Stupid)
    4. Re:Everyone runs with fear from NP problems by Anonymous Coward · · Score: 0

      This is what AI is for

    5. Re:Everyone runs with fear from NP problems by Anonymous Coward · · Score: 1

      Nobody much "gets" exponentials. Just think of all the people who think x% growth in population/consumption/other is somehow indefinitely sustainable,

    6. Re:Everyone runs with fear from NP problems by Anonymous Coward · · Score: 0

      And the customer goes to someone who implements faster approximation, customer does not mention the difference and is left happy. And the first programmer is taken for a fool

    7. Re:Everyone runs with fear from NP problems by dargaud · · Score: 1
      --
      Non-Linux Penguins ?
    8. Re:Everyone runs with fear from NP problems by 14erCleaner · · Score: 1
      The classic "Computers and Intractibility" book by Garey & Johnston (1979) gave three ways to explain to your boss:
      • I can't find an efficient algorithm, I must be too dumb.
      • I can't find an efficient algorithm, because no such algorithm is possible.
      • I can't find an efficient algorithm, but neither can all these famous people.

      Some of us have been going around saying "I must be too dumb" when we get stuck for a few decades now.

      --
      Have you read my blog lately?
  25. These are all horseshit by tietokone-olmi · · Score: 1

    Multithreading's issues in particular are a matter of education, not technology. The rest are related to programming only vaguely; in particular, NP-completeness is mostly a CS thing and very rarely encountered in software engineering.

    1. Re:These are all horseshit by tinkerton · · Score: 1

      I think in large programs multithreading can be very hard. Not to make it work, and not even to fix once you've got a good handle on the problem at hand, but you never know how much problems are still lurking there are being newly introduced while the code is evolving and each problem is hard to locate. At the same time CPUs are increasing their number of cores forcing you to make use of multithreading.

      I agree I don't see the problem with NP completeness. Normally you're happy with a good but not perfect solution and that can be found in reasonable time, so you can avoid tackling an actual NP completeness challenge.

    2. Re:These are all horseshit by Lisandro · · Score: 1

      NP-hard problems are easy to run into everyday problems. Its just a matter of identifying them; most people seem unable to.

    3. Re:These are all horseshit by tietokone-olmi · · Score: 1

      See now, that's what you get for your lack of education.

      Prevention of multithread-related bugs is exactly as dead simple as prevention of bugs related memory addressing, or array indexing. The answer is: only do things that have a defined meaning in terms of the concept space of the bug category at hand. So for array indexing, ensure that your index variable is always known to be in a valid range; for memory access, design the program in such a way that for each pointer it's known what they're supposed to point to, if the pointer variable can be NULL, and what that means if true or what ensures non-NULLness otherwise.

      For multithreaded programming, the programmer must ensure that shared data is only accessed under exclusion. This is easily achieved by making each operation a distinct function with an API that communicates its conclusion so that the caller can adjust its behaviour accordingly. There are sexy newfangled methods around like RCU and atomics and transactional memory, but they're rather complex compared to just plain old mutexes. The main complexity of multithreading comes from the primitives which are used to achieve exclusion, such as for mutexes the requirement of a consistent locking order and trylock failure handlers for operations that would violate that order.

      Now you know. Go, and fear threads no more.

    4. Re:These are all horseshit by tietokone-olmi · · Score: 1

      Such as for example?

    5. Re:These are all horseshit by Lisandro · · Score: 1

      Variants of the exact/set cover problem, or travelling salesman. There's also a good bunch of NP-hard problems when you start working with graphs and trees.

    6. Re:These are all horseshit by tietokone-olmi · · Score: 1

      I meant, examples of those everyday problems. Now you're just listing common NP-complete problems from academia.

    7. Re:These are all horseshit by Lisandro · · Score: 1

      Again, set cover problems arise frequently - optimizing costs when you have suppliers with different costs for combinations of materials is one case i actually worked on. Hell, even Sudoku is NP-complete.

    8. Re:These are all horseshit by K.+S.+Kyosuke · · Score: 1

      The interesting question often is whether the problem can be solved efficiently with a bounded error. Given the fact that the optimal solution, when implemented in the real world, will necessarily result in a deviating outcome in practice (costs change, batches can be found partly defective, actual time spent on tasks has variations etc.), going for a mathematically accurate solution is often impractical.

      --
      Ezekiel 23:20
    9. Re:These are all horseshit by Anonymous Coward · · Score: 0

      Shipping:
      We have packages of various dimensions. What combination of packages will best fill the space of trailer of a given volume? Moreover, given several sizes of trailers, what combination of sizes will minimize unused space?

      Purchasing:
      We need to buy various items in various quantities from several vendors. Vendors off quantity discounts, but we need to meet certain thresholds. Given the base price of each item, the threshold of the quality discount for the seller, and the quantities we need, what order configuration will offer the lowest price?

      Delivery:
      You have to deliver 100 packages. What route will deliver all packages with the minimum distance travelled.

    10. Re:These are all horseshit by Anonymous Coward · · Score: 0

      Multithreading's issues in particular are a matter of education, not technology.

      imperative languages (ie a technology) turn multithreading into a minefield

    11. Re:These are all horseshit by Anonymous Coward · · Score: 0

      One point to remember with NP problems is that they are not really a problem
      until your data starts to grow. I personally have never been in a project where a NP
      problem would bite. 1k*1k is still only 1M. And microcontrollers these days have speeds
      of several MHz.

    12. Re:These are all horseshit by K.+S.+Kyosuke · · Score: 1

      The formulations of the problems in practice needn't be identical to their pure forms. Just like IEEE-754 isn't exactly the same thing as real numbers.

      --
      Ezekiel 23:20
    13. Re:These are all horseshit by Anonymous Coward · · Score: 0

      Found the Microsoft programmer!

    14. Re:These are all horseshit by tinkerton · · Score: 1

      oI'm not an expert in multithreading but I have the luxury to be able to just ask experts. On our complex projects there are some intersection points between threads left because these can be very hard to detect. It gets a lot worse when the code was not conceived to run multithreaded originally. It explains why good coders can not always get rid of all the mt problems and once you have a low level of endemic mt problems it's hard to get rid of them because they are hard to detect and work on them. No decent scenario. So yes, there are reasons to fear threads.

    15. Re:These are all horseshit by Lisandro · · Score: 1

      Yes, but they scale to a problem fast. Minimizing boolean expressions is NP-complete (a set cover problem, in fact) and once you go above 2-3k terms, which is little really, you need to resort to approximate solutions in order to get results in a reasonable amount of time.

  26. Re:Serious he missed the 2 biggest problems I've h by zwarte+piet · · Score: 3, Insightful

    3 : It has to be ready 2 weeks ago so we'll forward that untested alpha version to our high risk clients who will sue the fuck out of us if anything is not right. 4: Oh can you make a feature that does X for client A. I'll be here for another hour. 5: assumes input from external program is correct by glancing over the xml of 1 example record. 6: we will make that split between a development version and a stable version when all the features on the list are done. (read in 4 years) We want the new features out as quickly as possible. etc....

  27. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    And does it support Azure?

  28. Re: Serious he missed the 2 biggest problems I've by ChrisBrooking · · Score: 4, Funny

    Re: Serious he missed the 2 biggest problems I've h

    Arbitrary truncation of data...

  29. C++ and conservative garbage collection hooks? by Anonymous Coward · · Score: 0

    The Boehm garbage collector can set mark hooks. Now do the garbage collection functionality in some base class. Some derived class marks its own members.

    The base class sets up a hook for marking. The asynchronous nature of garbage collection means that this marks the time from which on the hook may be called. But base classes are constructed before data members are constructed. If you have something like

          std:vector blubber;
          virtual void derived_mark const () { for (auto i = blubber.begin (); i != blubber.end (); i++) mark_fun (*i); }

    in a class derived from a garbage collector managing class, then by the time derived_mark may start to get run (via the garbage collection managing base class), blubber may still be a bunch of uninitialized memory.

    Which is really awkward.

  30. NP is the new P by ziggystarsky · · Score: 2

    Modern SAT solvers are able to solve SAT problems with millions of variables in seconds. Yes, there are hard problems with some hundred variables that are too hard to solve. But as it turned out, most useful problems are easy to solve. So if you have an NP-complete problem, you should just try to put it into minisat. If it can't be solved easily, there's still time left to despair.

    1. Re:NP is the new P by garethjrowlands · · Score: 1

      Mod parent up. Turns out that problems that are impossible to solve in the general case often have solutions for most common cases. It's hard but really smart people have made real progress. And you can use the fruits of their efforts in SAT or SMT solvers. (As a programmer, your tools might well be using them without your knowing.)

    2. Re:NP is the new P by K.+S.+Kyosuke · · Score: 1

      Yep, just like quicksort is O(n^2) in (some limited) theory but O(n.log n) in practice.

      --
      Ezekiel 23:20
  31. 7 problems - counting from 0 or 1? by Anonymous Coward · · Score: 0

    -nt

  32. Re:Serious he missed the 2 biggest problems I've h by knightghost · · Score: 0

    Customers are happy as long as they don't find out that Agile costs 4x more and you're spending 90% of your time code refactoring. Or worse, not refactor and watch the system implode.

  33. Re:Serious he missed the 2 biggest problems I've h by ShanghaiBill · · Score: 4, Insightful

    1 who's my customer
    2 What does he or she actually want.

    What you mention are not programming problems.

    I am a programmer and I deal with these two issues way more than any problems with multi-threading and NP-completeness. Multi-threading isn't that hard if you have some experience and a good library. NP-Completeness is more of a math problem than a programming problem. For programming, there is no optimal way to do NP-complete, so you just use a heuristic for a "good enough" solution.

  34. dates by buddyglass · · Score: 4, Insightful

    Dates, including time zones and daylight savings time. Constant source of bugs.

    1. Re:dates by Anonymous Coward · · Score: 1

      My first date resulted in a bug list a mile long. It seems that not holding the door open is like a root kit to the rest of the relationship.

    2. Re:dates by lgw · · Score: 2

      Dates, including time zones and daylight savings time. Constant source of bugs.

      The only safe way to deal with dates/times is to use a 64-bit int for milliseconds (UTC - always UTC). No time zone nonsense, not DST issues, safe to subtract to get a duration, easy to add a duration to, always the right answer.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    3. Re:dates by MichaelSmith · · Score: 1

      What if I need sub-millisecond resolution?

    4. Re:dates by lgw · · Score: 1

      For microseconds, a long works fine too (just make sure your names include the units). For nanoseconds, it's a pain, but how often does sub-microsecond resolution really come up?

      --
      Socialism: a lie told by totalitarians and believed by fools.
    5. Re:dates by angel'o'sphere · · Score: 1

      Or use a language like java that has a "Date" library like JodaTime.

      By defining your own int based time solution you are only forced to repeat all the bugs other developers have ironed out in their code already.

      It is unfortunately a reality that months have different lengths and that even days vary from 23h to 25h lengths ... so your so simple idea at the first glance: simply does not work. You have to know when to add 23h, to get to the next 00:00 time, you have to know if you need to add 31d to get to the first day of the next month etc. p.p. using a milliseconds representation in int64 helps you _nothing_ in that regard.

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

      Ah, you must work in a different problem domain than I do. I've never had to care about display dates except to, well, display them. I need things to time out after the correct number of milliseconds, even if DST happens, or it's a leap day, or the user changes the time zone.

      Do you work with something horrible like GUIs or accounting? My sympathy.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    7. Re:dates by Soft · · Score: 1

      The only safe way to deal with dates/times is to use a 64-bit int for milliseconds (UTC - always UTC). No time zone nonsense, not DST issues, safe to subtract to get a duration, easy to add a duration to, always the right answer.

      Except every couple of years when a leap second occurs. (There will be one at the end of this year, BTW.) Using TAI instead of UTC may help, but conversion back to dates is harder.

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

      When working with FPGAs the place&route tool (like a compiler) will tell us the length of a path between two flip-flops in picosecond accuracy, the tool itself does the calculations in femtoseconds.

    9. Re:dates by K.+S.+Kyosuke · · Score: 1

      But these computations have nothing to do with time zones, right? Laws of physics should be time-invariant. You baseline could have started just a few seconds ago.

      --
      Ezekiel 23:20
    10. Re:dates by angel'o'sphere · · Score: 1

      I did hundred of things that involve "human" times.

      The simplest problem is making a schedule for a plane crew.

      E.g. after a 8h flight a crew is required to have a 36h rest. (Numbers invented, don't remember the actual numbers and my job regarding it was 20 years ago).

      So you have flights going from Berlin to NY, from NY to Hawaii, from Hawaii to Tokyo. All "flights" have local time start dates and (another) local time landing dates.

      For every flight you have to calculate the travel time. Then you have to determine if a normal overnight stay of 8h - 12h is enough for the crew (and find the next best flight to assign them too) or if they have to have an extended rest (according to international rules for flight personell) ...

      You basically only calc in local times and convert that to UTC to get the sleep times etc. right.

      I guess I could write a book about problems regarding time ... but there is an excellent site about it "100 things you can get wrong with time" or something. The author wrote several blogs about similar topics e.g. about human names.

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

      Until there's a leap second and your code fails.

  35. Theoreticals aside? Practical application by Anonymous Coward · · Score: 0

    See subject: One I've encountered in my professional days (long ago over, my money works for me, not the other way around) - the "picking problem" - look it up boys, I won't do YOUR HOMEWORK for you...

    * They overlooked THAT one... especially in industrial application (keyword application, PRACTICAL real-world application, where the "rubber meets the road"...)

    APK

    P.S.=> "Onwards & UPWARDS"... as I am a "show me" person - theory be damned, follow the data etc. - et al... apk

    1. Re:Theoreticals aside? Practical application by K.+S.+Kyosuke · · Score: 1
      --
      Ezekiel 23:20
    2. Re:Theoreticals aside? Practical application by Anonymous Coward · · Score: 0

      That's not industrial application. Learn to read please. Change it to boys for yourself. They are what you prefer.

  36. Re:Serious he missed the 2 biggest problems I've h by F.Ultra · · Score: 0

    Still not "programming problems", they are project management problems. You are going to be hit by them as a programmer but that is not due to your programming but because someone at management screwed up.

  37. You'd be surprised what people try though by NotSoHeavyD3 · · Score: 1

    For example I worked on code where the guy decided he could use a Boolean (yes in C/C++) for thread synchronization. (Just no, please.)

    --
    Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
  38. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    1. Idiots

    2. They don't know- And the worst possible way to find out what they need is to ask them.

    Welcome to programming.

  39. message passing by Anonymous Coward · · Score: 0

    I found myself re-inventing some kind of message passing when I worked with threads. Then I read about Erlang. I've never coded in Erlang, but it's my understanding that's the model there and it's very robust and not so easy to shoot yourself in your foot. That validated my approach. I'm sure it's not a silver bullet; but whenever I've had to deal with threads I've thought in terms of MP, and I didn't end up with a shitfest of memory leaks and race conditions so I must have done something right.

    1. Re:message passing by Anonymous Coward · · Score: 0

      You should really try Go.

  40. The fact that they say Rumsfeld's is correct... by Anonymous Coward · · Score: 0

    is proof that they hate us. The Bush Crime Family made him their boy because he is a violent thug that wants to see every person that isn't a white male die. He was wrong when he said there are known unknowns and unknown unknowns. That doesn't make any sense. Only stupid people believe that garbage. Bush Jr is such an idiot.

  41. 2 More by Anonymous Coward · · Score: 0

    1) Real-time Inbox (different types of data need to be displayed differently...also depends upon the user's role...custom "quick-access" functionality/workflow/routing/approvals based upon data type and role...testing)
    2) Scheduling (permutations of cases and exception cases [e.g. blue moon on a Thursday except in months that start with a 'J' and where the day is prime]...order of operations...testing)

  42. Performance Optimisation by BlackHawk-666 · · Score: 1

    Writing performant code without obscuring the algorithm or introducing CPU / OS dependencies that will break when you port it.

    Writing code that understands cache coherency and is structured for memory locality.

    --
    All those moments will be lost in time, like tears in rain.
  43. Reporting by Oxygen99 · · Score: 1

    Seriously. I've worked in many departments for many different employers and seen many different reporting implementations. All of which have been different. All of which have been terrible. Layers and layers of impenetrable abstraction over some "generic" "engine". Every. Single. Fucking. Time. I swear it's the same person.

    --
    I had a dream, bright and carefree, but now there's doubt and gravity
  44. Re:Serious he missed the 2 biggest problems I've h by JaredOfEuropa · · Score: 5, Insightful

    Only if you think you can apply Agile and 2 week sprints to *everything*, including the "thinky parts". What that leads to is incomplete software architecture, and class / data models that do no cater well to all use cases => nasty refactoring. I found that in a lot of software projects I participated in, as well as my own projects... I am a terrible cowboy coder.

    However, I've had a few projects that have been very well designed from the get-go, with a thorough design that stands up to chaning requirements. Agile is a perfectly fine approach to develop or extend that kind of software.

    --
    If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
  45. Ignorance abounds by IHTFISP · · Score: 5, Insightful

    Closures are not a ``problem''. Ignorant or incompetent implementations of closures is the problem.
    Just as ignorant or incompetent implementations of garbage collection and memory management is a problem.
    And ignorant or incompetent use of arrays/vectors/buffers and pointer arithmetic and access permissions and ...

    So here is an alternative list:
    1. Low-skilled programmers (``script kiddies'') who write profound amounts of buggy code.
    2. Low-skilled language ``designers'' who re-introduce the known bugs of the past and introduce new innovative bugs as well.
    3. Low-skilled managers who reward high output over high quality, thus ensuring an on-time, under-budget hairball and bugs nest.
    4. Low-skilled educators who teach ``coding'' rather than computer science, thus ensuring another generation of the above.
    5. Low-skilled professional organizations who reward and encourage incompetent industry leaders to unduly influence the field.
    6. Low-skilled investors who reward incompetent technology from dominant, monopolistic companies.
    7. Low-skilled consumers who flock to buy flash-in-the-pan shiny stupid gimmicks but won't invest in sound technical innovation unless it's flashy.

    This is why C students should never be allowed to graduate w/ a degree. They only go on to further muck up the world. Color me bitter. ;-)
    P.S. That `C' above refers to grade level / professional competence, not the language (which should really be named D or D minus minus). *smirk*

    --
    Error: NSE - No Signature Error
    1. Re:Ignorance abounds by K.+S.+Kyosuke · · Score: 1

      Wait, are you trying to say that D (the language) is worse than C (the language)?

      --
      Ezekiel 23:20
    2. Re:Ignorance abounds by Anonymous Coward · · Score: 0

      This is why C students should never be allowed to graduate w/ a degree. They only go on to further muck up the world. Color me bitter. ;-)

      Some of the worst code I have ever encountered was developed by someone with a phd in computer science.

      (Contrariwise, some of the best code I have ever encountered was developed by someone with a phd in astrophysics).

    3. Re:Ignorance abounds by Anonymous Coward · · Score: 0

      If you are so great why don't you do all the work including designing a new programming language, managing yourself and marketing the product?

      Anyways, next time Xcode crashes on me, I'll blame you and the other "A" programmers who were let loose on the project.

    4. Re:Ignorance abounds by xtsigs · · Score: 1

      True dat. Incompetence is by far the biggest problem. All the other problems stem from that. The cycle is reinforced by all those things mentioned above, but especially the educational system which insists on releasing hordes of code eating locusts every year and on managers who keep on hiring them in spite of all the evidence that it is a bad idea.

    5. Re:Ignorance abounds by UnderCoverPenguin · · Score: 1

      Low-skilled investors who reward incompetent technology from dominant, monopolistic companies.

      Investors "reward" any business that gives them a return on investment - the bigger and faster, the better. this pushes managers to seek out the cheapest, faster way to get a product into the hands of paying customers. This also pushes them to focus more on adding features than on fixing problems. As long as the product works well enough that customers are buying it. Whether sales slow, increase or stay the same, there is always more pressure to add features to boost sales. When sales cease to increase for too long, ongoing development will be stopped and the money reallocated to other products that are still seeing increasing sales.

      Some investors are more patient than others. But, in return for their patience, they expect a higher return on investment. Usually this means more features, not fewer bugs.

      --
      Don't try to out wierd me, three-eyes. I get stranger things than you, free with my breakfast cereal. --Zaphod Beeblebr
    6. Re:Ignorance abounds by lordmage · · Score: 1

      Lets go even further. Some of the best code I have seen is by people who have never gone to college. Some of the worst code as well.

      Environment equals quality. If the environment does not encourage quality, then quality will not be the output. No matter if you are an A student, PHD, a high school student, etc. If the environment is put together fast and quick, and expects fast and quick... that is what the output would be.

      --
      I can program myself out of a Hello World Contest!!
  46. fraud by Anonymous Coward · · Score: 0

    Half of you seem to be talking slang rubbish that you have invented yourselfs,that seems to have variable meanings to different groups.
    I consider all of you as a great waste of time,resources,you appear to have created an entire system(s) of rubbish.
    Why is there not just one language and one code system that anyone with the right knowledge can use properly to give guaranteed results if you do a+b+c =d,every single time ?
    Why are there more and more different systems and languages every year which less and less of you fully understand.
    Why can there not be one "universal" system of code that can be used to do anything ?
    As you have guessed,I'm not software trained,have little understanding of higher level maths etc.
    But I have lived in the " real world" for 57 years and I can only say that thankfully the rest of the world seems to work on a totally different idea to the ones you have invented.
    Coding is just engineering with binary language,lucky for you lot that the rest of us work on the basis that a+b+c=d,and if it doesn't,things fail spectacularly,lucky that you lot are not in charge of building things that just have to work,from the simplest bedside cabinet to the power systems that you lot all rely on to power the chips that you all rely on to run the dogs dinner of crud that you have created over the generations of apparently bodging stuff just enough that it kind of works the majority of the time as you reckon it should..
    Seems like the biggest waste of human brain power yet ..
    I know many of you will jump down my throat about this and that,but try looking at your world from the view point of a total outsider,you would not be impressed with what you saw..

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

      Because everyone else is stupid. Except you.

    2. Re:fraud by Lodragandraoidh · · Score: 1

      There are many excellent points here - and as a programmer since I was a teenager and also in my 50s now - I have also thought about this problem a long time.

      A good visual analogy to a computer system is Russian nesting dolls. Each doll can be equated to an underlying system and associated languages. At the deepest innermost layer you have microcode - running on an extremely simple state machine that has code written for it to emulate a Von Neuman central processing unit (CPU). Next comes binary numbers that can be inserted into registers and memory using the CPU. Up from that is assembly language - which is another extremely simple langauge used to communicate with the CPU in native binary. Above that are a plethora of compiler based languages - that essentially convert their human understandable grammars into native binary (or intermediary assembly language - and then to binary...details). At the same level there are also interpreters - which are interactive languages that can be programmed 'on the fly' one line at a time; each line is acted upon immediately when you enter it - and were used effectively for teaching students... Basic being one such language. They could also be used for high performance computing - LISP being an example. It's important to point out at this point - all languages don't have to be loaded on a given system - these are just the possibilities.

      Now things get really interesting: virtual machines. A virtual machine is a simulated CPU that has its own simplified instruction set that an applicable language can compile against. The nice thing about a virtual machine, is it can be deployed across many different hardware architectures without the need to recompile your programs. Examples are Java's JVM, Python's virtual machine, and Javascript V8 virtual machine.

      Finally you have application frameworks - collections of libraries and other functions that allow you to quickly build applications with less work - because most of the heavy lifting is already done for you. In this category I would also lump code generators - like the Unified Modelling Language (UML) - that has tools which takes a program defined using the UML language - and generates code in a specified programming language.

      There are far more complexities to this than I've listed here. However, you can think of this in almost archaeological terms - each layer over time making it easier or faster for someone to build applications using a computer. Spreadsheet programs are a good example of building systems that allow an end user to leverage the power of the computer to handle complex calculations with little need for the user to understand programming at all.

      That being said, I agree there are a lot of extraneous languages, frameworks, and development environments out there that makes it more likely that people will create buggy code. The farther away from the CPU - in terms of abstraction - the less you will know about what your application is really doing 'under the hood'. As a result, I do suggest a clear bias towards simplification in the selection of languages used to build the underlying systems for the use of people to solve problems, coupled with perhaps certification programs to make sure what is being built is being built good.

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
  47. Definitely nah by fyngyrz · · Score: 4, Insightful

    Yes, this. the threading comment struck me more as indicative of an amateur in the area than any real flag of a problem area.

    if you understand threading, you can work just fine within it, do appropriate things, don't do inappropriate things. You also have to understand the problem you're trying to solve, but again, that comes down to your skills - not any inherent "Dragon-ness" of threading.

    I thread the heck out of my software. Works great. Cross-platform, too. Relatively easy stuff - image processing - and really hard stuff, real time signal processing where all manner of stuff is happening concurrently that depends in one way or another on the other stuff that's happening concurrently. I'm not talking about some thread off doing network management, either.

    For me, it's strictly a matter of not going in there casually and carelessly. The appropriate planning and thinking - IOW, design first, then write software - pays off every time.

    Of course, if you treat threading casually (as with many other things), it immediately becomes a footgun. Well, that's why Darwin gave us multiple feet, sonny. :)

    But the whole point is we're supposed to be good at this. You have to pay your dues to get there. Programming Javascript on a web site isn't going to build the required skillsets.

    --
    I've fallen off your lawn, and I can't get up.
    1. Re:Definitely nah by west · · Score: 1

      > more as indicative of an amateur in the area than any real flag of a problem area.

      Alright, but then the innovation of multithreading (and each innovation that increases complexity) has relegated more programmers to the status of amateur. And at the point at which you have a feature that's very difficult for the majority of programmers to handle, you have a dragon.

      It's also a matter of scale. Sure, almost any program nowadays is likely to require half a dozen threads to do anything, and that's not an incredible burden. But as the push comes to make *every* aspect of the program multithreaded, it's pretty easy for the complexity to rise exponentially, rendering all but 0.001% of th programmers incapable of handling the program.

      So, as more and more of us become 'amateurs' by dint of increasing complexity, the dragon is getting bigger and bigger.

    2. Re:Definitely nah by Anonymous Coward · · Score: 0

      Pretty much this.
      Every time I hear about multi-threading being this impossibly difficult task, all I can think is that that person doesn't understand multi-threading.
      Sure, there are a couple of gotcha's but no more than in other areas, like modifying arrays in a loop, using global variables, or managing memory.

    3. Re:Definitely nah by fyngyrz · · Score: 1

      Alright, but then the innovation of multithreading (and each innovation that increases complexity) has relegated more programmers to the status of amateur.

      Entirely a good thing.

      The way I look at it is that programming is a discipline with a wide range from very limited skill to professional level competence. As with any field that is both innovative and active, staying at or near the upper tiers is going to be an increasingly difficult challenge. That's natural. So yes, if you can't grasp some of the most powerful tools available to your craft, you're going down-rank, fast. As it should be.

      If someone doesn't want to be caught in such a slide, it behooves them to learn how to handle whatever challenges the face before they go writing production code all willy-nilly. There was a time when threading was new to me. I asked questions, wrote a crapload of test code, listened to the caveats I was told about, and wrapped my head around it. That's the path I suggest anyone take, and particularly so when even the most cursory research about the tool turns up well-known gotchas. Honestly, if you just take a few minutes to google it, you immediately run into mutex techniques and rationales, cache behavior across cores and multiple CPUs, etc. If you can't be bothered to train yourself to use your tools well, is there any truth at all in calling yourself a professional?

      --
      I've fallen off your lawn, and I can't get up.
    4. Re:Definitely nah by michael_wojcik · · Score: 1

      Indeed. The whole list can be summarized as "these are things that you have to understand and think about if you're going to use them, and, gosh, that seems like a lot of work".

      Honestly, if you don't understand closures (and not knowing where they come from is a good sign you don't understand them, Mr Wayner), then don't try to use them. Work on applications and in languages where they don't offer any particular advantage. The same goes for security (security features, that is - all practitioners are responsible for understand the common security flaws of the platforms they're using; anything less is inexcusable), cryptography (really, "encryption"?), and the rest.

      It's a bunch of vague handwaving toward some of the aspects of computer science that are more directly applicable to programming. Yes, we get it, computer science is hard. Sometimes you need to understand technical concepts. Mathematics might even make an appearance! Probably best to just write HTML.

  48. Wait physicists? by NotSoHeavyD3 · · Score: 1

    I mean floats are scientific notation on a computer with sig figs and such. That's stuff I would expect physicists (and chemists) to be experts at.

    --
    Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
    1. Re:Wait physicists? by Anonymous Coward · · Score: 0

      Not exactly. Typically floats are base-2 internally, even if displayed in some type of decimal/exponent format. Mathematicians and physicists think in terms of scientific notation powers of base-10. So the base-2 to base-10 conversion produce some artifacts.

    2. Re:Wait physicists? by ewibble · · Score: 1

      floats use scientific base 2 not base 10, so it is obvious why 0.1 = 0.100000001490116119384765625,
      its because it has to represented ?.??????????????????? x 2^x where ? is either 0 or 1, if we counted in base 2 it would be fine but we don't so we get non obvious results.

      also in scientific notation there is no negate zero

  49. atomics have nothing to do with cache coherence by Brannon · · Score: 1

    I think you mean "memory consistency".

  50. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 2, Insightful

    Reminds me of my last job.

    Boss: this isn't what I wanted, did you read the spec?
    Me: you gave me a ticket that had 3 sentences in it. That's not a spec.
    Boss: that is too a spec. Go back and read it.
    Me: this leaves a ton open to interpretation. This isn't a spec. You need to clarify this with a lot more detail.
    Boss: come on, you knew what I meant.

    And that's partially why I quit.

  51. Yeah. Was:Definitely nah by DRichardHipp · · Score: 3, Interesting
    > if you understand threading, you can work just fine within it

    If you understand pointers and malloc(), you can work just fine within them too. But that hasn't stopped people from disparaging them relentlessly and trying to come up with new "safe" languages that don't have pointers and memory allocation.

    Added irony: With pointer and memory allocation bugs, the problems are at least reproducible. Can't say that about threading bugs.

    still cannot figure out why the Java developers thought they needed to do away with pointers and (application-controlled) memory allocation, but then turned around and encouraged the use of threads. It's kind of like saying to children: "Don't play with those scissors, you might cut yourself. Use the power saw instead!"

    1. Re: Yeah. Was:Definitely nah by Anonymous Coward · · Score: 0

      How do you defragment the memory of a process that you don't want to restart, if you are using malloc and pointers?

      And how do you do that and other memory management in hardware, without disrupting the software?

      Comparing malloc with managed memory is similar to comparing software rendering to OpenGL. If you have a software only implementation of OpenGL your comparison works. If you any time in the future wants to switch to another implementation, such as one using hardware acceleration you'll have to rewrite the solution that wasn't designed to be flexible.

      There are several processors on the market with hardware-assisted memory management. Oracle Sparc M7 being one of them.

      This is one problem: Developers that only look at the task ahead without seeing the long perspective. Resulting in applications with poor hardware support.

  52. Who's on first? by fyngyrz · · Score: 1

    Normally you're happy with a good but not perfect solution and that can be found in reasonable time, so you can avoid tackling an actual NP completeness challenge.

    You don't tackle NP-completeness challenges. NP-completeness challenges tackle YOU!

    --
    I've fallen off your lawn, and I can't get up.
  53. Wow. Missed #1 by Anonymous Coward · · Score: 0

    Employee theft. #2, Employees not showing up for work. #3 Employees that can't do anything.

    See a pattern?

  54. Re:Serious he missed the 2 biggest problems I've h by gtall · · Score: 4, Insightful

    NP-Completeness becomes a programming problem when the people who do the programming cannot spot a NP-problem and then spend countless hours to beat it.

  55. Seven? by Anonymous Coward · · Score: 0

    Event-driven interruption of routines,
    Multithreading
    Buffers
    syntax conflicts with pointers to pointers
    Managers who are not programmers
    Things like Agile, which ignore pre-design
    Corporations that thnk it only takes an hour to put in a change
    Each customer wanting their own lttle change ( scope creep anyone?)
    This why programming is not engineering - Engineers design before they build. Programmers and some managers/bosses tend to add the chimney after buildng the house....

  56. Re:Serious he missed the 2 biggest problems I've h by GuB-42 · · Score: 1

    I am a programmer and I don't deal with it more than common sense requires me to.
    I have a boss, that's his job. He is better at dealing with customer demands, I am better at programming. That's why he hired me, and that's why I prefer this to being self employed.

  57. Profile to avoid premature optimization by raymorris · · Score: 1

    > Writing performant code without obscuring the algorithm or introducing CPU / OS dependencies that will break when you port it

    That can sure be annoying. I hate writing stuff that's much slower than need be, and I like it to be clear.

    Fortunately, 90% of the time is spent in 4% of the code. For the other 96% of the code, performance really doesn't friggin matter. I like performant code because it's beautiful. And it doesn't matter. Unless it's the roughly 4% of the application where it does matter, performance (1ms reponse rather than 2ms) is purely for my own enjoyment. Therefore I must be willing to let go of that when it conflicts with other priorities.

  58. Cloud billing, race conditions, database deadlocks by Proudrooster · · Score: 1

    I would like to add a small list:

    1. Cloud billing, yes just try and figure out your AWS cloud bill.
    2. Race conditions (but technically this is a multi-threading problem).
    3. Database Deadlocks, yes I know most RDBMS try to resolve deadlocks but they still happen
    4. Semaphores / Spinlocks and Deadlocks
    5. BIOS insecurity, yes you can decompile an EFI bios, change it, and reload it back on a motherboard
    6. Firmware/Hardware security and trust issues with Intel CPUs, USB devices, and expansion cards. No hardware is secure thanks to the cesspool of firmware and rowhammer.
    7. New data breaking old programs, such as unicode characters
    8. The incredible pace of obsolesce in hardware, software
    9. Windows 10.... who the hell knows what the O/S is doing? Sit and watch task manager on a fresh install for 30 minutes and you will be amazed at the stuff that goes on, Windows Telemetry anyone?
    10. Apple removing legacy ports from hardware and encouraging everyone else to do the same so we all end up in dongle-hell.

  59. CSP, aka pipes by davecb · · Score: 1

    I just started doing some work with "communicating sequential programs" from 1978, in the form of pipes inside a language. Gee, something we know works, that was ignored by everyone but the Unix folks for 33 years.

    Blech!
    I now plan to create a time machine and go back and kill the unrestricted-multithreading folks (;-))

    --
    davecb@spamcop.net
    1. Re:CSP, aka pipes by Proudrooster · · Score: 1

      Pipes, named pipes, and shared memory for IPC (Interprocess Communication), just work.

    2. Re:CSP, aka pipes by K.+S.+Kyosuke · · Score: 1

      Uh, Go subsumed it, if I'm not mistaken. (Then again, you'll probably call them "Unix folks", too...)

      --
      Ezekiel 23:20
  60. Re: Serious he missed the 2 biggest problems I've by Dunbal · · Score: 2

    It's not arbitrary it's becau

    --
    Seven puppies were harmed during the making of this post.
  61. Re:Serious he missed the 2 biggest problems I've h by Dunbal · · Score: 0

    And divorce lawyers.

    --
    Seven puppies were harmed during the making of this post.
  62. Hardest problem by Carewolf · · Score: 1

    All of the "vexing" problem boils down the same thing:

    Programmers who never learned computer science, and think doing their job is HARD.

    1. Re:Hardest problem by Lehk228 · · Score: 1

      Not only that, there is also recklessness in the name of performance.

      --
      Snowden and Manning are heroes.
    2. Re:Hardest problem by Lodragandraoidh · · Score: 1

      Not all 'computer science' cirriculae is equal either - particularly in recent years.

      This is why I've long advocated never being 'just a programmer', or any other pigeonholed job for that matter. Define your work on your own terms as much as possible. When I first started working as a system admin / technical support specialist on the night shift (yeah - they had me doing two jobs at once) -- I took the time to automate a number of things, including the then current paper ticket system they kept in a binder and passed from shift to shift, as well as many of the systems checks and maintenance activities. As I moved to new jobs in the company, I continued to do this - providing value add, as well as easing my own workload burden along the way. I wouldn't say I'm indespensible - but I've managed to survive through 20 years of reorganizations, layoffs, and offshoring that severely impacted my 'just a programmer' peers.

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
  63. Seven problems? by PPH · · Score: 1

    Heptapods enumerating software issues using their tentacles.

    --
    Have gnu, will travel.
  64. A double has more precision than an int32_t by tepples · · Score: 1

    I wonder how much of this is pre-C99 code, where there wasn't even a dedicated type for 64-bit integers, or pre-x86-64 code, where use of 64-bit integer calculations in an inner loop caused slow subroutine calls to a 64-bit arithmetic library. A double has more precision than an int32_t, or in the case of pre-C99, whatever integer type a particular ABI guaranteed to be 32-bit.

    1. Re:A double has more precision than an int32_t by ewibble · · Score: 1

      Doubles my have more precision, you start getting inaccurate very quickly when you start using decimal points,
      if you want accuracy for things like currency you are better to use something like cents instead of dollars, than a double 0.01 is actually
      0.01000000000000000020816681711721685132943093776702880859375, that may not seem like much out but start multiplying or doing running totals you will get out significantly. Of course if you stick to integers doubles will be fine as long as you do not exceed a 53 bits.

      There are a lot of decimal number that you cannot represent exactly a binary decimal, just like you can't represent 1/3 in decimal, but easy in ternary 0.1

  65. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    The parent comment is underrated. -PCP

  66. Threading can cost 245 GBP per developer by tepples · · Score: 1

    I've never understood why programmers have problems with threads.

    Having to code for a platform that lacks a worker thread library might be part of it. Until very recently, neither the C standard library nor the C++ standard library supported threads. Not until C++11 did C++ gain any sort of threading support intended to work across both POSIX and Microsoft Windows. And even nowadays, the C++ compiler already installed on a particular system isn't guaranteed to implement C++11 let alone C++11 threads, and cross-platform threading on some platforms thus costs 245 GBP per developer.

    1. Re:Threading can cost 245 GBP per developer by lgw · · Score: 1

      If was never hard to ifdef around Windows and Linux threads. Back when you also had to care about all the Unix platforms (some of them fairly primitive) that was a pain.

      --
      Socialism: a lie told by totalitarians and believed by fools.
  67. Re:Serious he missed the 2 biggest problems I've h by Hognoxious · · Score: 4, Funny

    Put everything in one huge massive universal class of doom. Kiss refactoring goodbye!

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  68. Memory allocation is far more common by tepples · · Score: 1

    For resources other than memory, all languages require it, so you might as well learn to program.

    I think the traditional argument is that allocations of memory outweigh allocations of resources-other-than-memory by orders of magnitude, to the point where one feels justified in making allocation only of memory a language feature. Then your unit tests need to test only correct allocation of resources-other-than-memory, not of memory.

  69. Fast, safe, choose any two by tepples · · Score: 1

    Rust developers would then ask why you can't have both speed and safety.

  70. C syntax by david.emery · · Score: 1

    Because innocuous typos can still produce legal (but very incorrect) programs.

    But more generally, there's a tension between some people's need for conciseness and other people's need for assurance that the program actually does what the author intended. And that's closely related to the tension between ease of creation vs ease of reading/understanding/change.

  71. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    1 have product
    2 this is what you want

    create the trend

  72. Re:Serious he missed the 2 biggest problems I've h by Kjella · · Score: 3, Informative

    NP-Completeness becomes a programming problem when the people who do the programming cannot spot a NP-problem and then spend countless hours to beat it.

    To be honest, it's often the programmers who hear "optimally solve it" when the requirements actually are "sufficiently solve it". For example I just suggested for a knapsack problem at work we use a simple overflow algorithm instead. It doesn't matter that we're not perfectly sizing the chunks as long as they're below the max size, it's like a 10-20% deficiency on a 50-fold improvement. Sure with infinite time and resources we might have done it perfectly, but really it's just a workaround for limitations in another imperfect system. And particularly when it comes to any human scheduling, were it often turns out that there are some unsaid requirements which means they'll look at a time table and say this won't really work anyway.

    --
    Live today, because you never know what tomorrow brings
  73. Re:Serious he missed the 2 biggest problems I've h by geoskd · · Score: 5, Interesting

    Easily the most annoying problem in programming I face is functional requirements not being fully specced out before the project begins

    This is one of the most fundamentally misunderstood problems in software design. Probably because it is not really a software problem at all, but a business problem, and the solutions require intelligent business decisions which seem to be beyond everyone.

    The solution to the specification problem is not more detailed design specs. The reason is simple. The people writing the detailed spec are not the people using the software, and they are not the people writing the software, so they are in no way competent at providing communications between the two. All of the successful software designs that I have seen are the result of competent programmers becoming involved in the completion of a task that software automation would apply very well to. Those people then subsequently write the software applying their first-hand knowledge of how the software will be used, and what the users needs are.

    If you want your software to be very well designed, sit the programmers down to perform the job of the people who will use the software. They need to become proficient at this job, so a 1 week training course aint going to cut it. You need them to spend at least a month doing the job.

    If you have the software developers do this, you will get exceptional results without the need for any kind of specification, or other real involvement, because the programmers are naturally very good at optimizing processes, otherwise they wouldn't be good at programming at all. The client gets the features they need, want, and didn't even know they could have. The software design itself is cleaner and faster because the developers have a fully fleshed out idea of what the software needs to do, and can design to meet the need instead of designing to meet a spec that may or may not remotely resemble what is feasible , practical, or correct.

    --
    I wish I had a good sig, but all the good ones are copyrighted
  74. Re:Yeah. Was:Definitely nah by Anonymous Coward · · Score: 0

    If Java didn't have threads, it would just be strongly typed javascript.

  75. Re:Yeah. Was:Definitely nah by Fruit · · Score: 2

    Added irony: With pointer and memory allocation bugs, the problems are at least reproducible. Can't say that about threading bugs.

    Sounds like you never had to debug a use-after-free bug.

  76. Here's another problem by Anonymous Coward · · Score: 0

    How come computers still respond in perceptible time? How come things aren't instan-fucking-taneous? I mean shit like opening a window on a desktop, why can I still see the icons being populated?

  77. Each tool is suited for particular jobs by raymorris · · Score: 1

    Some people, and programming languages, force OOP where it doesn't fit or isn't needed. One example being langauges in which ints are objects. That's silly.

    On the other hand, for GUI design, the idea of a GUI widget as class, with each form field having field.value makes perfect sense. Radio_button and check_box being subclasses of widget is a great idea.

    There are many systems for which object-oriented programming does not make sense, and many for which it does. Much like a screwdriver is very much the wrong tool for nailing shingles. Throwing out the tool entirely costs you significantly. If you never use OOP because you're really missing out, and working too hard. Much like a handyman who threw the screwdriver in the trash when he found out it wasn't good for installing nails.

    1. Re:Each tool is suited for particular jobs by superwiz · · Score: 1

      On the other hand, for GUI design, the idea of a GUI widget as class, with each form field having field.value makes perfect sense. Radio_button and check_box being subclasses of widget is a great idea.

      It does make sense in certain situations to closely tailor functions to operate on very specialized data. But it's not accomplished better by binding these functions to the said data. Discriminated unions with explicit dispatch mechanisms would be a much better solution than having platform-dependent discriminators (pointers). It would have trivialized the serialization and would have increased re-use through duck-typing. Simply treating memory locations as such instead of blessing them to be some compile-time fixed types only reduces code reuse and forces a whole lot of extraneous syntax details which go largely unused. C should have been extended by allowing direct access to the space where the return value is to be written from the with the scope of the functions (maybe optionally a write-only access to allow for promises to enable optimization). a.plus(b) would then work regardless of the type of a. And there would be no need to worry about whether 'a' is a primitive or a derived type. But because 'plus()' became a method bound to some abstract idea of a class (which exists only in the imagination of a programmer), you can't do something like a.plus(b).minus(c) unless you have syntax for returning the rval reference of a from `plus()`. That's a lot of cool verbiage, but if `plus` just had language-provided syntax for writing to the memory represented by `a`, this would all be a non-issue. C++ ended up needing templates to accomplishes what it should have done from the get go. Except the syntax for it is atrocious and it still fixes behavior at compile time.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    2. Re:Each tool is suited for particular jobs by Anonymous Coward · · Score: 0

      It is absolutely clear that you speak from a perspective of academia, and probably have written nothing practical in your life. You shit on polymorphism, but then you spew shit like "Discriminated unions with explicit dispatch mechanisms would be a much better solution..." You can't be serious.
       
      " It would have trivialized the serialization and would have increased re-use through duck-typing"... Oh, I see. You want all classes to be serializable, regardless the fact that some members hold code, because it would make it more platform independent... except it wouldn't. Even if we were talking just x86 compatible processors, what you think you want to achieve would fail due to so many factors.
       
      "Simply treating memory locations as such instead of blessing them to be some compile-time fixed types only reduces code reuse and forces a whole lot of extraneous syntax details which go largely unused"... so you want C to be typeless without the need for casting? You know what I see? A bad idealist programmer that wants to make C become javascript, and really don't understand how or why things are the way they are. You can keep on trying to make your elephant fly.

    3. Re:Each tool is suited for particular jobs by Aighearach · · Score: 1

      In Ruby the ints mostly get used just as ints, but there is a bunch of OO layering on top of that if you want to access it. It isn't obvious to me at all that the negative you point out automatically follows from making ints into objects. OO is a style of structured programming, after all, not an implementation. Like in Ruby, when you pass an int to a method with the same name as a function in the C standard lib it is probably just passing the raw int without any extra overhead.

      Maybe worrying about the ints is premature optimization?

      Reminds me of the guy with a fancy multi-tool always railing against the guys with hammers and screwdrivers, without realizing that both the other guys have complete toolboxes and only grabbed that tool because it was the right tool for the job.

      A lot of the best OO code I've seen was written in plain C. You don't seem to even have a good grasp on what OOP is. It isn't an implementation or a language feature, that's for sure.

      For GUI fields to be subclasses of some generic widget class is an implementation detail that doesn't make sense, or not make sense, in isolation. It is 100% arbitrary and neutral. It has no semantic meaning in the problem domain that the application does work in. It is pure implementation detail. Even if we knew that the GUI system is OO, it would still be meaningless; there are lots of ways to structure an OO system. The inheritance is actually irrelevant to OO, the thing that makes it OO is storing the data and code together in an "object." As long as that object can act as some sort of structure, token, or system for getting to both the code and the data, then it is OO. That often leads people to include inheritance in their OOP system because it is a convenient way to reuse code, but that varies widely.

    4. Re:Each tool is suited for particular jobs by Aighearach · · Score: 1

      It is absolutely clear that you speak from a perspective of academia...

      I've been asking people for decades, "Why was there a `rule' about having only one return statement?" and the vast majority of people said, "I dunno, was that ever a rule?" And a few people who knew that it was a traditional practice gave answers. The one answer that made sense, historically, was because of punch cards.

      So now, finally, I found the academic who presumes that the limitations of punch cards would be better. Not based on real-world problems with multiple implementations that can be compared, but based on pure word salad. Wow! So, an amateur academic.

      One thing to note, you can do OO in plain C by convention, and it works really well. It is true that types "exist in the mind of the programmer," but all of computing is just constructs that exist in the minds of the engineers. After all, "digital" is just a promise, not a technical difference; the electrons (and other charge carriers) are all analog, as are all the storage mechanisms, switches, communication lines, users, and user interfaces. Even the analog circuit design is just a human construct that only continues to appear to be true on account of the different engineers keeping their promises! It all exists in the mind of the programmers and engineers, and so a thing being only in their minds is only to say that it might exist! ;) Any sort of system, language, utility, or practice that benefits programmers does so because it is in their minds, and that includes the implementation details!

    5. Re:Each tool is suited for particular jobs by K.+S.+Kyosuke · · Score: 1

      Some people, and programming languages, force OOP where it doesn't fit or isn't needed. One example being langauges in which ints are objects. That's silly.

      No, that's uniformity. OOP languages tend to require ints to be object so that special cases are eliminated. Special cases are generally considered harmful in programming.

      On the other hand, for GUI design, the idea of a GUI widget as class, with each form field having field.value makes perfect sense. Radio_button and check_box being subclasses of widget is a great idea. There are many systems for which object-oriented programming does not make sense, and many for which it does.

      One might actually make a case that you don't have a beef with OOP here but rather with one of the several inadequate ontologies which have been hardcoded into mainstream OOP languages.

      --
      Ezekiel 23:20
    6. Re:Each tool is suited for particular jobs by superwiz · · Score: 1

      It is absolutely clear that you speak from a perspective of academia,

      Fuck you with a cherry on top. Just because I write code, doesn't mean I don't think about how we could all save ourselves time by having a better language. Oh, and fuck you. Did I mention the "fuck you" part? Ok, good. Because I thought I didn't tell you "fuck you," just yet. That would me an omission on my part.

      so you want C to be typeless without the need for casting?

      No, I want to be able to write to the memory location instead of having the value copied to the stack and then either thrown away or copied to a yet another memory location. Yes, you can do it by passing an extra parameter, but avoiding passing of this extra parameter is the main reason people use C++. The only feature of C++ which is not present in C is an automatic calling of a method (destructor) upon exiting the scope.

      regardless the fact that some members hold code

      No, they don't. Some code is bound to "classes". But it need not be. Structs and unions don't hold code. If the type of your return value was a struct and you could write to the elements of that struct directly (a la matlab syntax), you would have functions which are not bound to classes and which operate on specific data without having to jump through all the dumb syntax hoops that you jump through to write C++.

      --
      Any guest worker system is indistinguishable from indentured servitude.
  78. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 1

    Haha, you should be more Agile! It's not Agile to find out what your customers need first. Just throw a bunch of shit at the wall, make it flatter, and dump it into production to let your customers do your testing and chip away at the things they complain about.

    I know you're just trying to troll, but that's actually what you have to do sometimes.

    The problem is that those specs your analyst gave you isn't what the users want (even if they are complete). What the users told your business analyst isn't what they want. The reason is that users often don't know what they want. Users know what they have done up until now, and everything they ask for will be framed in the context of what they have been doing all along, especially because they'll frame everything as a solution rather than a set of problems and goals. Often, the users have no idea you can transform their experience into something better because they don't know technology like you do.

    Instead, you need to sit down with some users and get a grasp of what they need to accomplish. This should be done both before and after you put some software in front of them.

  79. Security isn't hard, it's a solved problem by ka9dgx · · Score: 1

    The rainbow series of books lay out all you need to know about security. Just study them, and you'll do just fine, as long as you don't network anything. ;-)

  80. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 2, Interesting

    I was taught, for a spec to be good, you could give it to two different developers and get the exact same result. Otherwise, you need to improve the spec.

  81. Re:Yeah. Was:Definitely nah by Anonymous Coward · · Score: 0

    Java was a good tool in its day before multi threading was a main stream concern. Java has evolved away from those primitives in libraries to maintain backwards compatibility.

    You can see the evolution of this thought at the language level if you look at Go / Erlang

  82. Normalization of existing data by JBMcB · · Score: 1

    You have a 20 year old AS/400 system with millions of customer records using hand-typed-in data that needs to be correlated on a new system. Company names, customer names, addresses, routing numbers with variable use of dashes, periods, part numbers, account numbers, prices with variable decimal places, etc...

    Not a strict programming issue per se, but an issue that is expected to be solved with programming, with extremely variable results.

    --
    My Other Computer Is A Data General Nova III.
    1. Re:Normalization of existing data by K.+S.+Kyosuke · · Score: 1

      What you're describing reminds of Gerry Sussman's efforts into systems that should yield correct or almost-correct answers whenever presented with almost-correct inputs.

      --
      Ezekiel 23:20
    2. Re:Normalization of existing data by Anonymous Coward · · Score: 0

      "Almost" only works well with horseshoes and very powerful explosive devices. Or, sometimes, when the magical fumes are just right, Google searches

    3. Re:Normalization of existing data by K.+S.+Kyosuke · · Score: 1

      Human beings actually seem to do well with almost-correct answers and their repair.

      --
      Ezekiel 23:20
  83. Re:Serious he missed the 2 biggest problems I've h by hey! · · Score: 5, Insightful

    Well, that's because Agile is not supposed to solve technical issues like architecture or data models. It's supposed to help software development efforts track changes in organizational priorities and incorporate things they learn into their plans as they learn them.

    If you rely too much on any methodology it's not going to work.

    I have often thought the most important quality a software developer has to have is caring about the people who will be affected by their work. If you're only interested in technology you'll find an excuse to use the latest thing. If you're a prig about methodology you'll end up going through the motions. When you care about your users you'll always find a way to not let them down.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  84. "closures"? Are you F'ing kidding me? by engineerErrant · · Score: 4, Insightful

    One of the biggest, most vexing problems in computer science is newbies who equate basic programming to the hardest problems of the field.

    OK, I realize this is arcane. Let me give an equivalent situation in, let's say, agriculture.

    Farmer: "OK, young intern, today we'll learn how to water plants!"
    Intern: "Waaaaah! This is as hard as the manipulation of space-time with thought alone!"
    Farmer: "...Grab a goddamned watering can, moron."

    1. Re:"closures"? Are you F'ing kidding me? by Waccoon · · Score: 1

      I've found that most programmers are really, really bad teachers.

      Actual conversation witnessed on ICQ (not mine):

      Newbie: I'm having trouble with the db layer in my code trying to do [blah blah]
      Pro: Pastebin [doesn't care if newbie has a Pastebin account or not]
      Newbie: Here you go... [link]
      Pro: Throw that shit out and read "Learning Python the Hard Way"
      Newbie: Okay, but do you have any advice on what I'm doing wrong?
      Pro: I didn't even look at it

      I facepalmed pretty hard, especially since Learning Python the Hard Way only teaches you Python syntax, and nothing about programming, let alone database layers

    2. Re:"closures"? Are you F'ing kidding me? by engineerErrant · · Score: 1

      Yes, 100% this. However, we pros learn new things on an almost daily basis, and most have found de-coupling their learning process from other people to be an essential skill in programming. I realize that's far easier said than done, and requires a certain critical mass of knowledge and experience in order to become self-sustaining. I relied on senior people for my own on-the-job training.

      BUT, when I was 22, I would never have thrown up my hands and equated mastery of multi-threading to solving P vs. NP. I would much more likely have erred the other way: being overly cocky and assuming I knew better than everyone else what to do. That's also not optimal, but far better than being defeatist, since it drove me to learn independently ("I guess I'm going to have to do this myself!").

  85. Distributed Processing by Northdot · · Score: 1

    Multi-threading when you're sharing memory space is pretty easy.

    Efficient distributed computing with locks, shared state, transparent failover, etc. between separate computers is non-trivial. Hats off to those who get it right.

    1. Re:Distributed Processing by serviscope_minor · · Score: 1

      Multi-threading when you're sharing memory space is pretty easy.

      Said nobody ever. It's easy for limited things. Thankfully, for what I do, it IS easy, since #pragma parallel for solves about 95% of my problems. 4% more are then solved by using more nuanced directives with scheduling. The other 1% (for me) however...

      If you're not working in scientific computing and have less structured problems, it's really REALLY hard. Mozilla had to create a brand new language to make their browser engine multithreaded since it's simply too hard in languages which give enough performance.

      --
      SJW n. One who posts facts.
  86. Re: atomics have nothing to do with cache coherenc by melted · · Score: 1

    I meant what I've written. Read up on MESI protocol. It's all about cache coherence.

  87. Re: Cloud billing, race conditions, database deadl by Anonymous Coward · · Score: 0

    You're part of the problem for referring to ports as "legacy". Just because tge hipster twats who work at Crapple think that anything other than their Bluetooth USB-C Chunderbolt gash is somehow outdated doesn't give them the right to deem it "legacy". Who defines "legacy"? Where does it end? A few years ago I was hearing about "legacy-free" motherboards (=no PS/2 sockets)...

  88. Re: atomics have nothing to do with cache coherenc by Pulzar · · Score: 1

    I meant what I've written. Read up on MESI protocol. It's all about cache coherence.

    And, he's right. Atomics have nothing to do with cache coherence.

    --
    Never underestimate the bandwidth of a 747 filled with CD-ROMs.
  89. Appologies to... by TiggertheMad · · Score: 1

    I got 98.99999999 problems, and a float ain't one......

    --

    HA! I just wasted some of your bandwidth with a frivolous sig!
  90. ARRRRGHH! by TiggertheMad · · Score: 5, Funny

    Dammit, 30 seconds after posting that I realized it was even better as... I got .99999999 problems, and a float ain't one......

    --

    HA! I just wasted some of your bandwidth with a frivolous sig!
    1. Re:ARRRRGHH! by Anonymous Coward · · Score: 0

      I got .99999999 problems, and a float ain't 1.

      Where can I buy that on a T-shirt?

    2. Re:ARRRRGHH! by Anonymous Coward · · Score: 0

      That's the best thing on slashdot ever ...

  91. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 1

    If you recall that when programming courses teach about code, they never tell you what reasonable assumptions have to be made.
    For example, write a program that computes the profit, given sales and cost. Is there a tax? What is the number of digits for input value, output value, what should be done if there are errors in the data and so on., are never ever discussed. So, multiple solutions appear but the instructor is mad that he did not get what he wanted.
    Had he worked say, in a restaurant, he or she would know the details. The observations here are valuable.

  92. Huh? by Anonymous Coward · · Score: 0

    You mean programming?

    Yeah, it's a minefield. Obvi.

    RIP Slashdot...

  93. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    I once inherited one huge access/vb application that was this....thousands and thousands of lines in one procedure.....ye ha! The history was it was the same contractor that would come in every 3 months to fix something or add more over the course of 10 years....so it was just 10 years of bandaids pretty much. All procedural, just figuring anything out could take days....

    In his defense the owner/ceo was an idiot and pretty hard to work with, my best guess is he just didn't care and figured it was easy money....made my life interesting thats for damn sure.

  94. Re: Serious he missed the 2 biggest problems I've by lgw · · Score: 3, Insightful

    Reminds me of my last job.

    Boss: this isn't what I wanted, did you read the spec?
    Me: you gave me a ticket that had 3 sentences in it. That's not a spec.
    Boss: that is too a spec. Go back and read it.
    Me: this leaves a ton open to interpretation. This isn't a spec. You need to clarify this with a lot more detail.
    Boss: come on, you knew what I meant.

    And that's partially why I quit.

    So you didn't ask your boss what he actually wanted before you started coding? You didn't ask for clarification for each ambiguity you discovered during coding? You just shat something out at random?

    --
    Socialism: a lie told by totalitarians and believed by fools.
  95. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    They know what women don't want.

  96. Please read this paper by melted · · Score: 1

    And until you do, please don't embarrass yourself in public voicing your opinion on topics you don't have a foggiest clue about.

    http://www.puppetmastertrading...

    1. Re:Please read this paper by lgw · · Score: 1

      Atomics are cache-piercing, or they're pretend-atomics, which is about what that doc says. That's why they're particularly slow on a multi-socket system. The coder doesn't need to understand how it works, other than it's slow. The coder does need to understand that the compiler optimizer might not guarantee ordering around atomics, however, though it's rarely an issue.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    2. Re:Please read this paper by melted · · Score: 1

      No THEY ARE NOT "cache piercing". That's literally the whole point of the paper. The goal of atomics (and the various memory orders that they offer) is to minimize cross-core cache synchronization and only keep cache coherent when you have to. What's in RAM is completely irrelevant -- the CPU cores never actually directly see the memory, their view of memory is what's in the cache.

    3. Re:Please read this paper by lgw · · Score: 1

      Hmm, perhaps we're using different terms. In modern Intel architecture, the INC instruction isn't guaranteed to be atomic unless you decorate it with some other instructions, so, sure, x++ can end up not being threadsafe. I wouldn't call it an atomic operation.

      OTOH, use lock exch instead and you get the guaranteed-atomic behavior. That's why you lean on the "atomic" stuff in your platform library, such as InterlockedIncrement or AtomicInteger, and leave it to the compiler writers to do the platform-specific instructions to get the guarantee you need.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    4. Re:Please read this paper by melted · · Score: 1

      Yes, it's not thread safe for sure. Whether it's atomic or not depends on the architecture and type of "x" (I bet there are more ARM devices out there today than Intel, so let's get on with the program). Worse, compiler is free to reorder or otherwise rearrange the code you've written as it sees fit, as long as in the single threaded case the result is the same. Worse still, machine code is then executed out of order too, so if your X is read from another thread, you can't guarantee the increment has already happened even if the compiler happened to put it where you expected it. And if that wasn't bad enough, if the other thread is on another core or socket, without synchronization you can make no guarantees about one thread seeing the results of another thread's instructions, even if they have already executed. Worse still, you may be seeing _partial_ results, as in, torn writes and the like. That's why you have barriers and have MESI and other cache coherence protocols that people have come up with: to keep the relevant bits in sync and ordered in time, and to tell the compiler which instructions are OK to move upwards or downwards across any given barrier, while at the same time not ruining peformance by requiring that everything stays coherent all the time.

      For 99.99% of people all of the above is irrelevant detail: just use mutex locks, and you'll be fine. And the performance of your code will likely be fine, too. With low contention mutexes are actually pretty fast nowadays. For the rest, I strongly recommend reading the aforelinked paper repeatedly until it is fully internalized.

    5. Re:Please read this paper by lgw · · Score: 1

      I think a better way of saying this is: "Atomic operations do not magically fix race conditions. Locks are almost always what you want."

      --
      Socialism: a lie told by totalitarians and believed by fools.
  97. Re:Serious he missed the 2 biggest problems I've h by blindseer · · Score: 3, Insightful

    I agree. These problems are something my architect brother spoke about. His way to deal with it was to listen to what the customer asked for and then come back with three options for them.

    The first is give them EXACTLY what they asked for. If they wanted a staircase to nowhere and a conversation pit in the garage then that's what they'd get. The second option is to offer them what he thinks they really wanted. Some people just don't know what they want but with experience my brother could get an idea of what people liked and needed. The third option is he'd give them what he wanted to make. He'd take their input but then come up with something he'd find interesting or would like to see experimented with. He said few people would take his first option.

    I've also seen this in healthcare. People complain about how hospitals and their staff do things among other complaints on how they are treated. I can trace many of these complaints to a single cause, they are not the customer. The insurance company is paying the bills and so they are the real customer, and many of those in healthcare know this. This then creates a problem because the patients will not complain to the insurance company because they don't realize that their "customer" is not the hospital, but the insurance company. This is why I fear government healthcare, it adds another layer in this chain with one of them being the people that brought us the DMV and the poor customer experience we've all come to know from it.

    That's not exactly where I intended to go with this but it is where I happened to end up. As a "customer" of government healthcare through the VA I can tell you that is not where you want to be. I will say that VA care has improved but it only took people dying of negligence and suicides for a enough US Senators to notice and care enough to act.

    --
    I am armed because I am free. I am free because I am armed.
  98. He not only missed the problem with frameworks... by EmperorOfCanada · · Score: 1

    This guy is a massive supporter of frameworks as somehow a good idea. This guy is clearly someone fresh out of school or works for the government. I would say to that, all frameworks are easily the #1 thing keeping me employed. Frameworks are great if you are making a restaurant website, or an app that tells people what the upcoming plays are at your little dinner theater. Organization after organization take on a big project, One of their geniuses pulls out his favourite framework, and poof 90% of the project is done in less than a week. Then for the next two years (with an original schedule of 6 months) they are putting out shaky crap that is missing critical features, breaks all the time, and takes any new developer months to get a vague understanding of what the hell is going on.

    Basically the framework is great if they are doing what the developers of the framework intended. Stray 2 feet from their intended sidewalk and you are now walking in the middle of the road. It takes bandaids, restructuring, tunnels, and magic to get to where you wanted to go.

    It is much harder to, instead just choose one or more great libraries, and then handcode the whole thing into existence. Harder at the start, not harder in the end; they key being that you get to the end.

    This guy has another article that talks about 9 bad habits that programmers love. One was using "goto". Nobody uses goto. Nobody in any modern programming language, doing anything modern in any way at all. Maybe there is someone who ported QBasic to android and they are using goto. I have yet to meet someone who doesn't use "goto" as the measure of a fantastically crappy programmer.

  99. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    If you have good developers, and a good project manager, then it doesn't matter whether you use agile or waterfall, you succeed either way.

    If you have bad developers, or a bad project manager, then it doesn't matter whether you use agile or waterfall, you fail either way.

  100. What Do You Do When the Computer Runs Out of RAM? by Anonymous Coward · · Score: 0

    Go hire a shepherd!

  101. Re:Yeah. Was:Definitely nah by angel'o'sphere · · Score: 1

    There is nothing wrong with multi threading.
    And languages that support it of the shelf with language constructs and a sound library are obviously easier to handle than raw C or assembly.
    still cannot figure out why the Java developers thought they needed to do away with pointers and (application-controlled) memory allocation, but then turned around and encouraged the use of threads.
    That is a rather silly comment. First of all "Java Developers" are not the language designers or developers of the Java Virtual Machine, at least not until Java 1.2 or 1.4 came out.
    But to answer your curiosity: why the fuck (sorry for the language but it is appropriated here) should I waste my time with mental masturbation and allocate and deallocate my objects manually? Just to show of to my coworkers: "see! what I can do!! A Bug free manually memory managed application! Suck it you losers!"??? In a typical C program, a programmer needs about 30% of his time to get malloc/free right. In C++ with all the new features you can reduce that greatly. However: they only introduced all those new features when the realized how productive Java/C# and friends is.
    On the other hand: why the funk should I code an application that will run on a multi core system single threaded? When I have a language where doing multithreading is close to trivial? And keep in mind: in my country universities still teach how multithreading works in the 3rd or 4th semester if you study computer science. But I know: you live in a country where "programming" is neither considered "science" nor "engineering" ;D just nitpicking :D
    Note: I never had a bug in a Java multithreaded app by wrongly used language/library features, and I can't remember one where there was a conceptional bug regarding MT itself.
    In modern Java programming you should rely on the libraries anyway, and let the experts (stream library e.g. or Spring etc.) do the "hard work". I'm sure the same is possible in the .Net world.
    I rather spent my time with architecture and business requirements than fiddling with pointers and primitive thread constructs ... and under my watch I let no one waste his time with that either ;D (it is just as I pointed out above: mental masturbation)

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  102. 1&2&3&4&5&6&7&8&9& by I'm+New+Around+Here · · Score: 2

    The title of this message is originally "1&2&3&4&5&6&7&8&9&0&1&2&3&4&5&6&7&8&9&0&1&2&3&4&5&".

    I can't type another character into the title box.

    It all shows when I hit Preview, but I won't know if it makes it until I hit Submit.

    --
    If you think I voted for Trump because of this post, you're wrong. I voted for Dr. Jill Stein of the Green Party. Again.
  103. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    He didn't want to delve too deeply when the first sentence was "Find gay porn on the internet."

  104. Disk Space by Anonymous Coward · · Score: 0

    Ever check for free space on disk before writing? Of course not, you just assume you can write that file until BOOM! no more space left

  105. Re: Serious he missed the 2 biggest problems I've by Dog-Cow · · Score: 2

    I've worked with lots of people like that boss. If you try and get more detail, you're chided for not working quickly enough, or for bothering them. My policy is always to give such people what they ask for. If they can't or won't learn, that's not my problem. Their spouse/parents/pet can change them. It's not my job.

  106. Re: Serious he missed the 2 biggest problems I've by lgw · · Score: 1

    If you try and get more detail, you're chided for not working quickly enough, or for bothering them.

    Well, you'll never get very far if your boss is entirely unprofessional, to be sure. But "not working quickly enough"? Sounds like there isn't a schedule. "Bothering them?" doesn't take much time to answer a few questions - most people are happy to explain what they want, feels like leadership.

    My policy is always to give such people what they ask for.

    While passive-aggressive bullshit is a common approach among programmers, it's still a bad approach.

    --
    Socialism: a lie told by totalitarians and believed by fools.
  107. Concurrent by Anonymous Coward · · Score: 0

    >Multithreading. "It sounded like a good idea," according to the article, but it just leads to a myriad of thread-managing tools, and "When they don't work, it's pure >chaos. The data doesn't make sense. The columns don't add up. Money disappears from accounts with a poof. It's all bits in memory. And good luck trying to pin >down any of it..."

    Erlang
    http://www.erlang.org/
    Learn it

  108. dumb stuff by Spazmania · · Score: 4, Interesting

    Ooh, dragons.

    1. Multithreading. In some languages (e.g. Java) multithreading is no worse than any kind of parallel processing. Can you be a buffoon and fail? Yes you can. But you can do that in a single-threaded program too.

    In other languages (e.g. C) the chance of errors impacting some completely random data structure are so high that it's frankly important to stay away from anything that would confuse the control flow, such as multithreading.

    2. Closures. Okay, you're talking about Javascript here. javascript is a hideous language which should not be used to the maximum extent practical. Why complain about closers when all of javascript is bad mojo?

    3. Too big data. Also known as lazy-ass programmers who don't want to be bothered to deal with the possibility that their program may be called upon to process a large data set. Solutions for processing large data sets explicitly on the disk (not with virtual memory) are well understood. You just have to choose to use them.

    4. NP-complete. There's no particular dragon there... the elephant in the room is those programmers too ignorant or clueless to bother computing the big-oh running time of their algorithms, so they write software that appears to "lock up" as soon as anyone gives it a useful data set to process.

    5. Security. Correct security implements defense in depth. Break one level so what? Even patched slowly, it's patched before enough layers can be broken to grant access.

    Programmers make two classes of stupid mistake:
    a. They assume they don't need defense in depth because they've written secure software.
    b. They carelessly implement functionality that cuts through all layers of security. Like single-sign on.

    6. Encryption. The odds of a long-surviving conspiracy to hide mathematical breakthroughs which bypass encryption are essentially zero. You can relax on that score. You can also expect one-time-pad encryption to remain unbreakable regardless of mathematical improvements. Because no analysis of extremely long strings of random bits is meaningful.

    You have to be pretty bone-headed to mess up security in this day and age. Yes, many many programmers are bone-headed. But that's not encryption's fault.

    7. Identity management. The only thing which makes this hard is its constant misuse. No authentication is perfect, so correct programming makes authenticated actions reversible instead. The more critical the action, the more critical it be reversible.

    8. Measuring hardness. Now we're in to mumbo-jumbo territory. A simple big-oh evaluation will tell you whether your algorithm is usable. Trying to figure out whether it will be easier or harder to solve one problem or another, neither of which have a known useful algorithm? Silliness! Problems like that are solved when someone finally has the key insight. Inspiration is not a product of work, it's a product of the creative mind.

    9. The authors can't measure. They claimed 7 but listed 8 things.

    --
    Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    1. Re:dumb stuff by c · · Score: 1

      In some languages (e.g. Java) multithreading is no worse than any kind of parallel processing.

      I know of one large Java system which took the appproach of "threading is hard, so we'll write the app for a single thread first and then add threading later".

      Yeah, you know that's not going to end well...

      And that, in a nutshell, is arguably the most vexing meta-problem in programming... "we'll add it later". You think a hard problem will get easier once you've built the entire system without a solid understanding of the stuff you'll be bolting on when you eventually get a handle on it?

      --
      Log in or piss off.
    2. Re:dumb stuff by Anonymous Coward · · Score: 0

      > 9. The authors can't measure. They claimed 7 but listed 8 things.

      That's the joke! AKA:

        "There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

    3. Re:dumb stuff by Spazmania · · Score: 1

      The problem with Java is not the language, it's the developers. Java is so good at doing things for you that it allows even incompetent developers to thrive. Which is unfortunate, because they're just as incompetent in java as they were in other programming languages and while their software runs to completion it often runs incorrectly and produces wrong results.

      I know several Java gurus, folks I'd hire to write software for me any day of the week. But I know so many more incompetent hacks who claim java expertise and if you're not an expert software developer yourself its very hard to tell which is which.

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
  109. Code on code violence by Anonymous Coward · · Score: 4, Interesting

    They missed the most vexing problem of all. Hiring a skilled and talented old timer programmer to come solve the problems that fresh faced recruit coders created. Then offering the same rate as they paid the fresh faced recruits, not being able to grasp that the ability to solve, often under tightest of all deadlines, messes left by inexperienced programmers. In some cases less! I have personally had the extreme joy to explain to a physicist that the code he wrote, while it would solve his problem, was written in a manner that the solution was of order O n squared. While the problem could be solved in an manner that mathematically provided the same solution but was order O n. The physicist then said he wanted to test both solutions. His was actually faster on a data set of 100 items. (Lots of fixed constant cost was involved, my solution had more precalculation setup, so for small sets of data, my overhead was more) He proclaimed himself the winner deriding my science. I asked (already knowing) what the normal sample size was they analyzed? What, 100,000 samples? Sure let's use one of those... 20 minutes later mine was finished, I cleverly asked to run first since I lost the prior test. He ran his. It took a while. The next morning his finished. The results were the same. Save the physicist was a mixture of miffed and conciliatory. Very brilliant physicist. Not so great at mathematics. I've even encountered programs implemented in a manner to be non-deterministic when a deterministic solution existed. Vexing is working with some programmer that thinks they know everything. Which really annoys the ones that do.

  110. Re:1&2&3&4&5&6&7&8& by hackwrench · · Score: 1

    When will Slashdot fix all of the problems with its by now obscene code. Or any? When is the last time Slashdot had a meaningful update instead of delivering unasked for "features"?

  111. Re:Serious he missed the 2 biggest problems I've h by Raenex · · Score: 1

    Multi-threading isn't that hard if you have some experience and a good library.

    When I see comments like that, I translate that to: Has bug-ridden threaded code that causes intermittent problems that get ignored because they are intermittent and hard to track down. Probably not even aware that they are caused by multithreading bugs.

  112. Lack of common sense by iamacat · · Score: 1

    All of the other problems can be solved with redundancy, fault isolation, defense in depth, argument and result verification, approximate solutions, backups and so on. Threading problems even in most naive code are rare in practice. You are probably running something in a thread because it's quite slow, and the probability it will finish and try to update a shared data structure just when you are using it is low. The trick is to avoid writing corrupted data to database if it does happen.

  113. Re: Serious he missed the 2 biggest problems I've by arglebargle_xiv · · Score: 2

    It's not truncated, he used strcpy() and it's overflowed into the next memory block, along with the nop sled and 0day exploit.

  114. its me by hraponssi · · Score: 1

    One of the biggest problems is reading stories like this on Slashdot, about how everyone solves NP by approximating it over the lunch, pulls some deep-learning with N types of layers and nets out of their bottom just for fun, knows 15 different programming languages perfectly, changes to the latest shiny language every year just because, and switches their frameworks and programming paradigms 5 times a year, while effortlessly solving any math problem they last heard about 15 years ago, in their 5 minute agile iteration, in perfect multi-threaded and distributed synchronization, etc.. Me, I just try to do something useful with whatever I know, while learning some selected new stuffs (with proven benefits) when I have time. Often it is not even (directly) programming related. Boohoo-hoo, so the problem is me, of course! :)

  115. Re:Serious he missed the 2 biggest problems I've h by JimToo · · Score: 1

    So you are comfortable writing code when you 1: don't know the customer and 2: don't know what they want ... after all this is just a management problem.

  116. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    My boss is the customer. If the customer requests something the USER didn't want, that's not on me or my boss, it's on their boss for not getting confirmation from the users before he signed off and told my boss to have make it.

    You don't get to tell the lumber supply guy to cut the boards in half when you meant thirds. Well, you do, but he's still charging you for both too. Just because you may not understand the difference between bits and boards doesn't mean you get your money back.

    Now, if you hire ME to PM, I'll annoy both bosses and teams with follow up questions, fragile, unscalable mock ups and proof of concept every step of the way. If they don't give up, they'll find the last round of what they thought was spec extraction actually leaves them with a working product. But half of clients give up when they realize they need to fix their process, not automate it. Which is why I bill each step as a discrete, non refundable sub project.

    Quit in step 7? Fine, since I'm already paid through step six as per our agreements.

  117. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    How does that help?
    If you get the same completely useless piece of code from 2 different developers, your spec is actually WORSE than a spec where you get completely different results.
    You describe a PRECISE spec, which is worse than useless without it also being a CORRECT spec.
    And the latter is the far bigger problem and far more important thing than the former, even if you'd really like both

  118. Naming by Anonymous Coward · · Score: 0

    After np complete, second largest obstacle in programming is appropriate variable naming.
    Most likely it is one of inner circles of hell

  119. Re: Serious he missed the 2 biggest problems I've by Cederic · · Score: 5, Insightful

    For a spec to be that good it's got to be written to the same precision as a computer program.

    So just write the fucking code.

  120. Threads & shared objects by Anonymous Coward · · Score: 0

    > You have to be a bit careful about locking around shared objects, but usually the answer is avoiding shared objects.

    But exactly this is the raison d'Ãtre of threads. If you don't need shared objects you don't need threads -- concurrent processes are the way to go (if you're doing threads with message passing and no shared state, you are basically doing concurrent processes, the "threads" part is just a technical detail).

    Shared objects (and thus threads) are arguably unavoidable when your objects are so heavy that you've got to share them. But then you buy into a sizeable amount of pain.

    I stay by my claim: threads onyl if you must.

  121. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    You honestly expect that the conversation would have gone differently if he had asked? Oh you're right it would have been followed with a "just throw something together and we'll tweak it afterwards".

  122. Re:Serious he missed the 2 biggest problems I've h by carlos92 · · Score: 3, Interesting

    Agile is meant to help you learn about the problem domain. If you already know everything about the problem, there's no need for Agile. If somebody else already knows everything about the problem and you can hire him/her, the do it - no need for Agile. If nobody knows everything about the problem because it's a new problem that no one else has worked on yet or a new approach to a known problem, then you definitely need Agile or something similar to help you produce something that works at the same time that you are learning about the problem.

  123. Re:Serious he missed the 2 biggest problems I've h by carlos92 · · Score: 1

    I would put it like this: if you have a good PM, he or she will choose the right tools for the project (Scrum, XP, Kanban, pair programming, waterfall, whatever) and the right people (developers, QA, BA, etc), and will customize the tools as needed. If you have a bad PM, or the budget doesn't allow for putting together a good team, then it doesn't matter which tools are used.

  124. Re:Yeah. Was:Definitely nah by Anonymous Coward · · Score: 0

    I spend a LOT of time in Java messing around with the garbage collection as well.
    Hey, why do I have a memory leak? Oh, it seems I am keeping a pointer around here, and the compiler can't see it will never be used again.
    Hey, why does my program crash? Oh, it uses more memory close to the Java heap limit and the VM just kills itself when doing GC becomes too difficult.
    Hey, why is my program using a lot of memory kept alive by weird references? Oh, it's classes with finalizers, and the GC never got around to calling all those finalizers.
    Hey, why am I running out of disk space? Oh, the above problem means that all those files I just deleted are actually still there because the OS thinks they are still used.
    Hey, why is my program so slow? Oh, I have a new in the inner loop and GC can't handle it. Well, looks like I'll have to write my own memory allocator! As bonus, I get all the disadvantages of new/delete back!
    Well, as a first hack I can also throw in random calls to the garbage collector. Of course you're strongly advised to not do that. Well, why don't you assholes write a working garbage collectors first (since you decided to design a language needing it) before advising other people?
    C/C++ at least has great tools like valgrind, the Java tools are utter crap pretty much across the board (CPU profiling tools: slow you program down to a crawl, but can't even give you line numbers. Heap profiling tools: usually can't even tell you which code allocated the object. Compiler: doesn't even do trivial optimizations, so the binaries are bloated like hell, build systems: bug infested crap, with every new version of gradle there is a some bug that breaks things etc., etc.).

  125. Re: Serious he missed the 2 biggest problems I've by carlos92 · · Score: 2

    I currently work in a project where:
    - there are no schedules or estimates,
    - everyone seems to believe that tickets with a three-word title and an empty description fit the definition of "spec", and
    - answering questions with just "yes" or "no" sometimes takes weeks, even if the ticket is urgent and not answering the question blocks further work on the ticket, and
    - the codebase shows attempts at following every programming technique, concept, trend or fad from the last 10 years.

    Fortunately, it's not as bad as it sounds because all the current BAs, developers and DBAs are making a great effort to improve things, but it's still bad.

  126. Re:He not only missed the problem with frameworks. by Anonymous Coward · · Score: 0

    Goto is used in C (especially kernel) to handle the error cases in a consistent way.
    It tends to be a lot better than the alternatives (it also cannot lead to "spaghetti" code since it's always a jump forward, and usually to a single target).
    Java and C++ might rather go with exceptions, but the basic issues and resulting code flow are the same, and especially for C++ it actually has a couple of additional issues like performance and the risk of leaking memory unless you designed anything that might end up in a temporary to clean themselves up properly automatically when going out of scope.

  127. Re:Ignorance abounds - insightful by cjonslashdot · · Score: 1

    Well said!

  128. Well, sorry, but acttally... by Hauke · · Score: 1

    he missed out on the programmer as the biggest problem:
    a) underestimates the work.
    b) overestimates personal abilities.
    c) lacks the exerience to prevent a+b.

  129. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 1

    Nope. I've worked with a lot of developers and when they make their own decisions they get it right. Mix project management into it and you have a single point of failure that usually don't get neither the customer nor the technology.

  130. Legacy systems by Anonymous Coward · · Score: 0

    Using a 4GL with unnormalized data

    In a deplorable insurance company that actually exists, maintaining assembler code on ibm 360 architecture, where the base registers are maxed out, and where splitting up the modules is not an option, and where re-writing the code in a higher level language is not an option.

    Taking a 48 hour job and whittling it down to 12 hours on the same computer.

    Maintaining machine code without a compiler on a legacy rocket system

    In a shop with bad management, putting new code into production without system test.

  131. Re:Serious he missed the 2 biggest problems I've h by LoztInSpace · · Score: 1

    Oops. Undoing troll mod. Meant insightful

  132. Forget Closures by shawnhcorey · · Score: 1

    OO is closures on steroids; why continue to use them?

    What is a closure? It is a way of preserving data which can be accessed later via a single function. What is an object? It is a way of preserving data which can be accessed later via many methods. OO is augmented closures.

    --
    Don't stop where the ink does.
    1. Re:Forget Closures by K.+S.+Kyosuke · · Score: 1

      Yes, but which OO? I'd vote for CLOS, or some extension of it.

      Also, memorably: Part 1, how to get rid of closures, and Part 2 how to get rid of objects.

      --
      Ezekiel 23:20
  133. Re:Serious he missed the 2 biggest problems I've h by xtsigs · · Score: 2

    This is often compounded by:

    1. Customer changes as the project goes along and the importance gets kicked up the chain in customer's hierarchy, or, the VP loses interest and kicks the project down the chain wherein the project is suddenly confronted with reality.
    2. Once a demo/prototype is running, the customer says, "That's great, but it has to do x as well."

    Both problems are we called the Moving Target problem which can be solved by spending a lot of time up front specifying the scope and specifics. Too often this portion is done badly by salespeople trying to close the deal and move on to their next victim. Deadlines are established with too vague an understanding of what the target is, and project managers are left with an impossible task which they solve by compromising in the aforementioned areas--especially in hiring sub-par coders just to meet a deadline.

  134. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    Well not everyone can quit or get fired which is the only other option. That's what happens if you don't give them something. If you like to keep your job giving them what you think they want is the only way.

  135. Re:Serious he missed the 2 biggest problems I've h by xtsigs · · Score: 1

    Agreed, up to a point.

    The problem comes in when the customer wants to do an update, extension, or major fix. Someone else comes in and your code is a mess because you were focused on a happy customer and delivering something that worked well enough at the time for less cost.

    In the long run, your lack of method cost the customer more (or they had to go without the update, extension, major fix) because it takes too much time to figure out the code, or it is just better to redo it all from scratch.

  136. Re: Serious he missed the 2 biggest problems I've by xtsigs · · Score: 1

    For a spec to be that good it's got to be written to the same precision as a computer program.

    So just write the fucking code.

    The spec is as much for the customer as for the programmer. It defines goals, not how to reach those goals. But, yes, it can take as much work as actually writing the code. Your solution is actually not a bad one if the problem is small, but it doesn't scale well to larger projections.

  137. Re:Serious he missed the 2 biggest problems I've h by hey! · · Score: 1

    Well, I'd be the last person to advocate jettisoning methodologies, any more than I'd advocate jettisoning architecture, although I've seen both abused by people who make fetishes of them.

    My point is that software development is multidisciplinary. You can't rely on one kind of discipline to ensure success.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  138. Re:Serious he missed the 2 biggest problems I've h by zifn4b · · Score: 1

    1 who's my customer 2 What does he or she actually want.

    Sadly this is a problem that is NP, therefore we must solve P vs NP to satisfy it.

    --
    We'll make great pets
  139. Re: Serious he missed the 2 biggest problems I've by zifn4b · · Score: 1

    Arbitrary truncation of data...

    640k oughta be enough for anyone

    --
    We'll make great pets
  140. Let's try for a better list by Anonymous Coward · · Score: 0

    Multithreading (I agree with that)
    Security (If he means bugs causing holes, yes)
    Focusing on the understanding the problem and the customer is (see usability)
    Schedule estimating and execution (see making a baby with 9 folks in 1 month)
    Excessive cleverness (see all the features in C++)
    Fear of learning curve causing thing to be redone instead of reused.
    Not understanding what a computer is and how it works (Especially pointers, malloc, free, but other things as well)

    Secondary items:
    Execution time
    Architectural purity
    Language choice
    Agile versus not
    Offices versus team rooms
    Most everything else on the article's list

  141. Multithreading by zifn4b · · Score: 1

    The only reason multi-threading is considered a hard problem is because people are grossly under-trained and overly optimistic. If you're just like "I want this to run asynchronously so it's not blocked and get more performance so I'll throw it in the thread pool" you are going to end up with nightmare code. Proper multi-threading that is high performance requires good orchestration of tasks much like an OS task scheduler. You also have to think in a parallel computing mindset. For example let's say I have a composite operation that consists of Task A, B and C but I don't care what order they finish. They way to do this is to have a structure that houses these tasks and when the last one completes there is a callback function that signals something else to continue onward processing. It's actually not that difficult but most people can't be bothered to learn how to do things like this properly.

    --
    We'll make great pets
  142. Re:Serious he missed the 2 biggest problems I've h by omnichad · · Score: 1

    It's a well-known sales tactic to put the preferred option in the middle of a higher and lower option. They can still feel like they're saving money, but are paying more than the bare minimum.

  143. Re: Cloud billing, race conditions, database deadl by Anonymous Coward · · Score: 0

    AFAICT, legacy is defined as "old shit we're not allowed to get rid of".

  144. Incomplete requirements.... by peterofoz · · Score: 1

    and an associated endless stream of unmanaged change requests. There's a real dragon for you.

  145. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    I could not agree more!

  146. Re:Serious he missed the 2 biggest problems I've h by suutar · · Score: 1

    He's not saying that, he's just saying it's not a pure "programming problem" if you really need to pull in non-programmers (in this case, the customer) to address it.

  147. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    That list is redundant

  148. virtual memory by Anonymous Coward · · Score: 0

    Anyone mention that whatever nitwit wrote this article doesn't understand what virtual memory is at all? When he says virtual memory, what he appears to mean is physical memory allocated on the disk rather than in RAM, that is, swap space.

  149. Biggest problem: building maintainable systems by Anonymous Coward · · Score: 0

    Most people can glom together a bunch of code and get it to work. The hard part is making the logic easy to follow. Clarity of code is the key.
    * If there's a bug, and the code is clear, the bug will be easier to find and fix.
    * If it's on the wrong platform, and the code is clear, it will be easier to port.
    * If it's too slow, and the code is clear, it will be easier to streamline.
    * If it needs a new feature, and the code is clear, it will be easy to add.
    etc.

    Remember, the audience of your code isn't the compiler or interpreter. It's the intern who will be reading it two years from now. Don't be clever. Be clear instead.

  150. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    You were taught wrong.

    Or you mistook a fairy tale for a lesson.

    Unicorns don't exist in the real world...

  151. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    I resemble that remark pardner...

  152. Re:Serious he missed the 2 biggest problems I've h by lucien86 · · Score: 1

    I remember my computer teachers talking about this exact same problem - way back in 1986.. Nothing has changed.

    --
    Below the speed of light Special Relativity is one of the most accurate theories in physics - above the speed of light..
  153. Re:Serious he missed the 2 biggest problems I've h by lucien86 · · Score: 1

    Healthcare based on insurance is an inefficient system to begin with. You have the basic contradiction of poacher/gamekeeper (cover is only profitable on healthy people) and you need a massive bureaucracy to contain the thing. That's why socialist healthcare systems tend to cost about half of what insurance based ones cost..

    --
    Below the speed of light Special Relativity is one of the most accurate theories in physics - above the speed of light..
  154. Objects != OOP, per Alan Kay by raymorris · · Score: 1

    Your definition of object-oriented programming is in direct conflict with the definition used by the guy who coined the term in the first place, Dr. Alan Kay. You've confused the an object vs object-oriented programming. Most every program has functions, very few properly use Functional Programming. Similarly, according to Kay (and any random textbook you choose to consult), just because call something an object doesn't make it OOP, any more than calling your hour-long meeting a "scrum" makes your process Agile.

     

    1. Re:Objects != OOP, per Alan Kay by K.+S.+Kyosuke · · Score: 1

      You argue with Kay, yet you claim that ints shouldn't be objects? That's interesting doublethink.

      --
      Ezekiel 23:20
  155. Re:Serious he missed the 2 biggest problems I've h by lsatenstein · · Score: 1

    My view is that programming cannot be considered a career. My analogy is the clothing sweatshop. You have the sewing machine operators (programmers) trying to sew garments (the sub-problem) and the two parts do not fit together.

    Who wants to be a life time sewing machine operator anywaY?

    --
    Leslie Satenstein Montreal Quebec Canada
  156. Re: 1&2&3&4&5&6&7&8&am by Anonymous Coward · · Score: 0

    I hear that some websites support obscure foreign characters, like the symbol for UK currency: £

    Maybe even really obscure stuff, like the Euro symbol: â

    At this rate, we'll have a man on Mars before Slashdot supports Unicode.

  157. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    Bravo! YES.... Listen to the people who pay the bills. The money trail inevitably leads to one or more key business areas.

  158. Re:Threads? by Anonymous Coward · · Score: 0

    Isn't RUST supposed to make threads 'safe'? Statements from RUST team say that newbies can write thread safe programs in RUST.
    Now that the tools are available why not use them?
    How many 'buffer overflow' exploits would not happen if code (even kernel code) used 'safe' string handling routines, (or better safe string objects?)
    No point in blaming your tools if you keep using a hammer to break the board when you could be using a saw to cut it.

  159. My problem: EEs who think they can architect by DutchUncle · · Score: 1

    Well, they can program, sort of, for limited data sets and valid input and careful usage. Then they are totally shocked when programming for realtime continuous data and corrupted input and full protocol validation isn't as simple. And once in management can't understand why their schedules never work.

  160. Re: Serious he missed the 2 biggest problems I've by bondsbw · · Score: 2

    Write the code, but for the love, make it readable. Make it so readable to the point that you can show an implemented business rule to the guy who will be using it, and he should be able to make out what's going on even with no programming experience. (Not lower level database access, UI code, etc.)

    --
    All my liberal friends think I'm a conservative, all my conservative friends think I'm a liberal.
  161. Re:Yeah. Was:Definitely nah by DarenN · · Score: 1

    But to answer your curiosity: why the fuck (sorry for the language but it is appropriated here) should I waste my time with mental masturbation and allocate and deallocate my objects manually?

    Because the garbage collector is bad, and you can't specify when it should run so Java programs get all bloaty.

    --
    Rational thought is the only true freedom
  162. Re:Serious he missed the 2 biggest problems I've h by Big+Hairy+Ian · · Score: 1

    Yep they also missed refactoring Spaghetti Code

    --

    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.

  163. It's Kay's title, it can mean what he wants by raymorris · · Score: 1

    Kay created the title Object Oriented Programming as a label for his system of ideas. He's the authority on what Object Oriented Programming means - even if I find some applications of OOP annoying at times. Even if I thought all of his ideas were stupid, still his ideas would be called Object Oriented Programming.

  164. 53-bit integer cents still bigger than US debt by tepples · · Score: 1

    if you want accuracy for things like currency you are better to use something like cents instead of dollars, than a double 0.01 is actually
    0.010000000000000000208

    I am aware of the problem you describe if you try to store euros/dollars in a double. But if you store cents in a uint32_t, you can't hold values greater than about 42 million euros/dollars.

    Of course if you stick to integers doubles will be fine as long as you do not exceed a 53 bits.

    Exactly. I don't see how storing integers in double was so bad, especially in pre-C99 code. JavaScript code has to do this, as does PHP code running on a 32-bit architecture. Storing integer cents in a double is fine out to 90 trillion dollars, which still exceeds the U.S. national debt. (For now.)

  165. The list of fields in all four places by tepples · · Score: 1

    If I write a DeepClone() method on my own class then how am I repeating myself?

    Your source code contains the list of all fields in four places: first, the definition of the class's fields; second, the definition of DeepClone(); third, the definition of serialize; and fourth, the definition of deserialize. Do you have a means of keeping these four places in sync automatically, such as by reading the definition of the class's fields and generating the other three from that? Or do you spend a lot of time manually fixing defects that your 1.5 round trips test finds?

    1. Re:The list of fields in all four places by Anonymous Coward · · Score: 0

      I see what you mean now, thanks. You are of course technically correct (the best kind) in your assertion, but the problem is speed. I would love to have a generic DeepClone method that uses reflection to make a "perfect" copy of the object tree. Unfortunately, that is not fast enough for my needs. In the end the objects I'm working with are not particularly complex, so the DeepClone methods have not been difficult to maintain.

  166. Re:Serious he missed the 2 biggest problems I've h by ilsaloving · · Score: 1

    The Agile method is God's gift to Time and Materials contracts.

  167. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    Put everything in one huge massive universal class of doom. Kiss refactoring goodbye!

    I've found this works great, as long as I use goto statements to move around within the class.

  168. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    Shitted, not shat.

  169. Re: Serious he missed the 2 biggest problems I've by Anonymous Coward · · Score: 0

    Sitted, not sat.

  170. Re:Yeah. Was:Definitely nah by angel'o'sphere · · Score: 1

    Sorry, you are wrong.
    The Java garbage collectors are very good and you can chose between about 10, and parameterize them as you like.
    And on top of that: of course you can specify when they run. Facepalm.

            System.gc();

    But why would you?

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  171. Compile-time reflection by tepples · · Score: 1

    Do you have a means of keeping these four places in sync automatically, such as by reading the definition of the class's fields and generating the other three from that?

    I would love to have a generic DeepClone method that uses reflection to make a "perfect" copy of the object tree. Unfortunately, that is not fast enough for my needs.

    Then perhaps I wasn't clear enough. You could write a program that instantiates each object, uses reflection to find what to clone, and outputs a corresponding DeepClone method in C#. Then the slow reflection stuff happens on the developer's PC, and its output gets compiled into your executable.

  172. Re:Serious he missed the 2 biggest problems I've h by Anonymous Coward · · Score: 0

    Also, quit hiring MBA PMs who know nothing about user experience or software development.

  173. Re:Yeah. Was:Definitely nah by DarenN · · Score: 1

    That you think that the System.gc() call invokes the garbage collector is the kind of thing I hate about the garbage collector.
    The System.gc() call does not call the garbage collector, it notifies the collector that there is garbage to be collected and the JVM still makes the scheduling decision. In practice it may lead to immediate garbage collection, but that is not necessarily the case.

    Secondly, you CAN specify your own garbage collector or specify one-of-the-many that exist, but an explicit call to System.gc() usually forces the collector to check if all the objects still allocated are reachable so the process can be quite inefficient. If you're using Java, calls to System.gc() should be very rare.

    Lastly (to clarify something i said above, and this is not the garbage collector's issue) the JVM heap size rises independently of the Java allocations so garbage collecting doesn't return heap to the system.

    --
    Rational thought is the only true freedom
  174. Re:Yeah. Was:Definitely nah by angel'o'sphere · · Score: 1

    The System.gc() call does not call the garbage collector, it notifies the collector that there is garbage to be collected and the JVM still makes the scheduling decision.
    a) depends on the VM
    b) of course it does, otherwise it would not make any sense at all.

    the JVM heap size rises independently of the Java allocations so garbage collecting doesn't return heap to the system.
    Of course it returns heap space. What other kind of space should it return? It does not shrink the size of the heap, though if you mean that. And why should that make sense anyway?

    usually forces the collector to check if all the objects still allocated are reachable so the process can be quite inefficient.
    That is why you don't call it ;D but let the memory management system decide. OTOH, if gc() really gets executed, it just behaves like "the real thing". In other words, if you have a generational collector, the standard, it checks only the youngest generations, and it only runs till it decides there is enough free memory ... actually it usually does not run at all.
    It is an anti pattern to call System.gc() ... or at least bad style.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  175. Re: Serious he missed the 2 biggest problems I've by ananamouse · · Score: 1

    Eatted, not et.

  176. Re: Serious he missed the 2 biggest problems I've by ananamouse · · Score: 1

    >Unicorns don't exist in the real world...
    Yes they do, they are also known as rhinoceros, are ugly as homemade sin, and mean.

  177. Still EATING YOUR WORDS boy? by Anonymous Coward · · Score: 0

    See subject: Yes, & in a (now even more) 142++:1 ratio against you https://slashdot.org/comments....

    * NOW THAT IS FUNNY!

    APK

    P.S.=> Change your diet K.S Kyosucky - EATING YOUR WORDS != GOOD NUTRITION, lol... apk

  178. Units as class metadata by Gazzonyx · · Score: 1

    +1. Units are metadata if they're not part of the object model/structure. The variable name should tell me what a thing is, not how it's configured. There's absolutely nothing about a variable name that guarantees any compile or runtime safeties to be sure that what you think you're dealing with is what you're dealing with.

    I typically make my units (or "non-object-model" metadata when appropriate) a member of the class/struct/whatevs as an enum. As a bonus, in most modern languages your enum is a class that can be extended to have methods/functions so you can add support for type/unit conversion into the enum itself. The icing on the cake is that you can write fast, scalable, easily readable code by checking the units in a switch statement where you might otherwise be inclined to have a bunch of "if" statements that become messy as you must support additional units.

    --

    If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.