• qwerty (unregistered) in reply to sharkoftheday
    sharkoftheday:
    That's not entirely true, they're also NSDictionary/NSMutableDictionary to the Objective-C people.

    CAPTCHA: conventio Because Apple has their own special conventions that you must obey.

    NSDictionary comes from the Smalltalk-80 class library (Dictionary). The lineage was Smalltalk-80-> Stepstone / Brad Cox -> NeXT -> Apple.

  • modifiable lvalue (unregistered) in reply to DrPepper

    In the real world, there are a number of issues that should be considered before copying/pasting code.

    Depending upon the context, you might want to avoid claims of plagiarism in college, violation of copyright, intellectual property or licensing... These could cost your scholarship/student fees, your job and your future.

    Additionally, anyone can post content to the internet. I could go onto a forum (where I see students ask questions every day) and post complete gibberish (which I also see every day). As a result of believing me, they'd fail. There ARE idiots who use their "master programming foo" on the internet to raise their self esteem. They might even be injecting vulnerabilities, whether purposely or not. By copying their code and committing it without reviewing it, you're allowing their idiocy to be projected onto you. I like to hope that people with sufficient experience who can see that keep tallies for the purpose of justifying their judgement.

    CAPTCHA: Validus, n. One who produces valid code.

  • (cs) in reply to Someone
    Someone:
    You could make a case that the mathematical term isn't what you should use, because math folks don't have destructive updates and don't talk about things with side effects and such. Said another way, a CS "map" supports a wider range of operations than a math "map".
    It's not that hard to model a destructive update in math, but mostly you don't bother and instead use an operation that returns a new map that is the same except for the desired change. Like you'd do in Haskell or any language that has a strong immutability focus. (It's updating from multiple threads without a lot of locking that has a tendency to bizarre semantics.)
  • Someone (unregistered) in reply to dkf
    dkf:
    Someone:
    You could make a case that the mathematical term isn't what you should use, because math folks don't have destructive updates and don't talk about things with side effects and such. Said another way, a CS "map" supports a wider range of operations than a math "map".
    It's not that hard to model a destructive update in math, but mostly you don't bother and instead use an operation that returns a new map that is the same except for the desired change. Like you'd do in Haskell or any language that has a strong immutability focus. (It's updating from multiple threads without a lot of locking that has a tendency to bizarre semantics.)
    I agree, but at the same time that's not the update functions which are supported by maps in "normal" programming languages.

    (Maybe I should have said that mathematical "maps" support a different set of operations instead of fewer.)

  • (cs) in reply to chubertdev
    chubertdev:
    Someone:
    QJo:
    "Map" is actually the term used for this pattern in mathematics, otherwise known as a "function". Plug in a value, get another one out, which is how a map works.

    "Dictionary" is cute and understandable by muggles, but has more than three times the number of letters in it.

    You could make a case that the mathematical term isn't what you should use, because math folks don't have destructive updates and don't talk about things with side effects and such. Said another way, a CS "map" supports a wider range of operations than a math "map".

    Indeed, not all math majors know what a KeyNotFoundException is.

    It would take a particularly shitheaded fuckwit not to be able to work out what a KeyNotFoundException is from its name.

    Having said that, I've known some mathematics majors who really are unbelievably stupid, so yeah, maybe.

  • Z (unregistered) in reply to Nagesh
    Nagesh:
    synp:
    Maciej:
    I'll take "The Real WTFs" for $200.

    What is C# ?

    C# is lazy man's java! If you're lazy and want to code in language that used to resembel java, then C# is for you.

    So what you are saying is that by doing twice the work in java, you can get half the results and half the reliability as what you get in C#.

    All programmers are lazy. That is why we don't code directly to memory in binary anymore.

  • The Big Picture Thinker (unregistered)

    A dictionary is just a hashtable that accepts strongly-typed keys and values.

    A regular hashtable in .NET is the same time, except it accepts "Objects" (any data type for the key and value).

    A dictionary does the same thing, except it's faster because there's no boxing or unboxing involved.

    For example (from memory):

    Dim dict As New System.Collections.Generic.Dictionary(Of String, Integer)
    

    That will accept strings as keys and the values are integers.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    chubertdev:
    Someone:
    QJo:
    "Map" is actually the term used for this pattern in mathematics, otherwise known as a "function". Plug in a value, get another one out, which is how a map works.

    "Dictionary" is cute and understandable by muggles, but has more than three times the number of letters in it.

    You could make a case that the mathematical term isn't what you should use, because math folks don't have destructive updates and don't talk about things with side effects and such. Said another way, a CS "map" supports a wider range of operations than a math "map".

    Indeed, not all math majors know what a KeyNotFoundException is.

    It would take a particularly shitheaded fuckwit not to be able to work out what a KeyNotFoundException is from its name.

    Having said that, I've known some mathematics majors who really are unbelievably stupid, so yeah, maybe.

    It's very easy to figure out in hindsight.

  • (cs)

    Since it wasn't mentioned in the article, I assume everyone involved was smart enough not to tell management about any of what was going on here, lest they try to decide which of the two was the problem employee.

  • linepro (unregistered) in reply to eViLegion
    eViLegion:
    Unisol:
    OK, being C# illiterate I had to look it up, so I'm leaving it here for the next guy: C# Dictionaries are called Maps by Java folks and associative arrays by the rest of the world.

    The rest of the world already know all this.

    What with "dictionaries", "associative arrays" and "maps" all being interchangeable for any object class that solves "the dictionary problem", I would suggest that the word dictionary is actually pretty common.

    Wikipedia:
    In Smalltalk, Objective-C, .NET, Python, and REALbasic they are called dictionaries; in Perl and Ruby they are called hashes; in C++, Java, Go, Clojure and Scala they are called maps; in Common Lisp and Windows PowerShell they are called hash tables; in PHP all arrays can be associative; in JavaScript all objects behave as associative arrays; in Lua they are called tables; in Visual FoxPro they are called Collections
    You left out PL SQL Tables...
  • jimmy (unregistered)

    TRWTF is that in the lately these articles end with shit like "was able to get things done 15 minutes before they went live".....

    I read this as "it was never tested".

    In fact, most places I've worked even the most planned change basically needs 3 days lead time and thousands of approvals to even make it from the last test environment into the real world.
    Anyone who thinks it's safe to deploy something you finished 15 minutes ago (even if you're the most awesome coder on the face of the planety) is stark fucking raving mad!

  • Ken (unregistered) in reply to eViLegion
    eViLegion:
    Unisol:
    OK, being C# illiterate I had to look it up, so I'm leaving it here for the next guy: C# Dictionaries are called Maps by Java folks and associative arrays by the rest of the world.

    The rest of the world already know all this.

    What with "dictionaries", "associative arrays" and "maps" all being interchangeable for any object class that solves "the dictionary problem", I would suggest that the word dictionary is actually pretty common.

    Wikipedia:
    In Smalltalk, Objective-C, .NET, Python, and REALbasic they are called dictionaries; in Perl and Ruby they are called hashes; in C++, Java, Go, Clojure and Scala they are called maps; in Common Lisp and Windows PowerShell they are called hash tables; in PHP all arrays can be associative; in JavaScript all objects behave as associative arrays; in Lua they are called tables; in Visual FoxPro they are called Collections
    In C they are called crap because we're gonna roll our own purpose-specific data structure. It's the only way to guarantee efficiency.
  • ddddave (unregistered) in reply to DrPepper
    DrPepper:
    Mike:
    spending 30min searching for something is much better than spending "only" 15 min making it yourself since invariably there will be some subtle edge case they'll have to think about more, time for testing, generating testing data etc. vs taking something from a known tested source.

    YES!!! the best line of code you write is the one you DONT write (because you refactored the code, used a library call, pulled a bunch of code from the web, etc).

    A line of code you write needs to be tested (so unit tests, manual tests, etc); run through QA; bugs against the code need to be retested, a fix created, retested by QA, etc etc etc.

    A line of code you don't write needs none of these things.

    Consider (for c# people) writing a loop, vs using a linq statement. Linq provides tight, concise code with very little that could go wrong, vs a loop with lots of statements, control structures etc.

    Until something goes wrong. Then you spend a lot more than 30 minutes figuring out where in that huge mess you copied did something break.

    caecus: that prickly feeling you get when trying to find out where the bug is.

  • mfg (unregistered) in reply to JeffB
    JeffB:
    That depends on whether the one triangle and one square have the same perimeter.
    Not even. Just depends on whether their sides are the same length
  • Surely (unregistered) in reply to eViLegion
    eViLegion:
    Did Nagesh just say something clever?
    He forgot to log out and use one of his anonymous sock puppets
  • Investigator (unregistered) in reply to D-Coder
    D-Coder:
    foo:
    Joao Reis:
    I don't like my car wheels being so... circular, it's the devils thing that i can go so fast. I what my wheel made by me, They should be Oval!
    I originally designed my car with square wheels. Then I changed to triangular wheels. A great improvement: 25% less bumps!
    Mythbusters tried square wheels. It was bumpy at slow speeds, somewhat better as they sped up.

    You know those big steel bolts that hold the wheel onto the end of the axle? About 30 seconds into the test one of them sheared, the wheel fell off, and the ride was over.

    Our local science centre used to have a square wheeled pedal-car you could ride - it was on a special track (a series of hills) that made the ride feel smooth.

  • Sm@rtEPanz (unregistered) in reply to Someone
    Someone:
    QJo:
    "Map" is actually the term used for this pattern in mathematics, otherwise known as a "function". Plug in a value, get another one out, which is how a map works.

    "Dictionary" is cute and understandable by muggles, but has more than three times the number of letters in it.

    You could make a case that the mathematical term isn't what you should use, because math folks don't have destructive updates and don't talk about things with side effects and such. Said another way, a CS "map" supports a wider range of operations than a math "map".
    Fark the map, I gotta GPS

  • (cs)

    TRWTF is that a task processing 500,000 database records needs to be run every 30 minutes. That's just begging for trouble.

  • Jchenault (unregistered)

    There is another WTF here.

    Designing an e commerce availability system around a batch process is a really REALLY bad idea. If you don't want to disappoint your customers on popular items that are in short supply, you have to use some kind of real time renting model or your availability cache

  • Jchenault (unregistered)

    There is another WTF here.

    Designing an e commerce availability system around a batch process is a really REALLY bad idea. If you don't want to disappoint your customers on popular items that are in short supply, you have to use some kind of real time renting model or your availability cache

  • (cs)

    Greg do good!

  • (cs) in reply to brian banana
    brian banana:
    Greg do good!

    Obey!

  • (cs)

    This reminds me of the famous 'Hammer factory factory' mentioned in an article by Joel Spolsky (askismet wouldn't let me past the link, it thinks it's spam :( )

  • Rob G (unregistered) in reply to Nagesh

    "resembel"

    I see you are using the lazy man's English to post that comment!

    Captcha: appellatio

    Fellatio performed by an Apple fan boy.

  • (cs) in reply to Unisol
    Unisol:
    OK, being C# illiterate I had to look it up, so I'm leaving it here for the next guy: C# Dictionaries are called Maps by Java folks and associative arrays by the rest of the world.

    Just wait until you see what they did with LINQ. I wonder if there's a word for that... "nomenclature genocide"? "terminology destruction"?

  • (cs) in reply to Nagesh
    Nagesh:
    synp:
    Maciej:
    I'll take "The Real WTFs" for $200.

    What is C# ?

    C# is lazy man's java! If you're lazy and want to code in language that used to resembel java, then C# is for you.

    Always remember the Java programmer's mantra:

    "Work hard not smart! What they can do in 1 line we'll do in at least two!!"

  • (cs)

    Somehow, this reminds me of a loop I saw in something once. The purpose was to allow authorization to be applied to a series of 200 items (heavily paraphrased):

    for (int i = 0; i < items.length(); i++)
    {
       file.open();
       while file.next()
       {
          read_authority_structure();
          if 
          {
             item.applyauthority(...);
          }
       }
       file.close();
    }

    The file content was, of course, something like xml (though this was before xml existed). There were a dozen or so records for every item authorization; so 2400 records or so. Opened and read through for each of the 200 devices. On a slow system.

    Oddly, it performed poorly for some reason...

  • ludus (unregistered) in reply to Nagesh

    All things ideal, bump-count relates to the length of the shape-side over distance.

    If the triangle is equilateral, and if its side is longer than the side of the square (at that other car), the triangle version will produce less bumps for the same distance (and that's provided that all 4 are synchronized to the perfection and that no road conditions make them out of sync).

    If the triangle is equilateral, and if its side is shorter than the side of the square, the triangle version will produce more bumps for the same distance.

    Basically, it doesn't matter what the shape is; what matters is the length of its sides. It gets more complex with shapes that have different sides. Theoretically, even the circle produces "bumps".

    Layman analysis here; be gentle, please.

  • ludus (unregistered)

    Last comment in reply to:

    http://thedailywtf.com/Comments/From-Three-Days-to-15-Minutes.aspx#409613

  • ludus (unregistered) in reply to Nagesh
    Nagesh:
    synp:
    Maciej:
    I'll take "The Real WTFs" for $200.

    What is C# ?

    C# is lazy man's java! If you're lazy and want to code in language that used to resembel java, then C# is for you.

    No, dude = C# is for smart developers who realized that programming in JAVA is pointlessly difficult and old. The excuse of "we're covering more platforms" is bullshit. I can get the same job done in C# a lot faster than in any flavor of JAVA. There isn't a single JAVA IDE that doesnt' suck.

  • The Big Picture Thinker (unregistered) in reply to Ken
    Ken:
    Wikipedia:
    In Smalltalk, Objective-C, .NET, Python, and REALbasic they are called dictionaries; in Perl and Ruby they are called hashes; in C++, Java, Go, Clojure and Scala they are called maps; in Common Lisp and Windows PowerShell they are called hash tables; in PHP all arrays can be associative; in JavaScript all objects behave as associative arrays; in Lua they are called tables; in Visual FoxPro they are called Collections
    In C they are called crap because we're gonna roll our own purpose-specific data structure. It's the only way to guarantee memory leaks, seg faults, and great submissions for TDWTF.
    FTFY
  • The Big Picture Thinker (unregistered) in reply to ludus
    ludus:
    No, dude = C# is for smart developers who realized that programming in JAVA is pointlessly difficult and old. The excuse of "we're covering more platforms" is bullshit. I can get the same job done in C# a lot faster than in any flavor of JAVA. There isn't a single JAVA IDE that doesnt' suck.

    The Java VM has weekly exploits.

    You may think C# is quick for development? Try deploying it. You'll soon realize that every Windows user has different versions of the .NET Framework and the C++ Redistributable packages in various states of disrepair.

    My opinion is that most interpreted languages are bad, with PHP, JavaScript, and Python being the worst of the pack because of their duck-typed philosophy. .NET is OK for quick and dirty proof of concepts only, but I would never use it for a final product.

    By the way, I use all of these languages except Java.

  • (cs) in reply to The Big Picture Thinker
    The Big Picture Thinker:
    ludus:
    No, dude = C# is for smart developers who realized that programming in JAVA is pointlessly difficult and old. The excuse of "we're covering more platforms" is bullshit. I can get the same job done in C# a lot faster than in any flavor of JAVA. There isn't a single JAVA IDE that doesnt' suck.

    The Java VM has weekly exploits.

    You may think C# is quick for development? Try deploying it. You'll soon realize that every Windows user has different versions of the .NET Framework and the C++ Redistributable packages in various states of disrepair.

    My opinion is that most interpreted languages are bad, with PHP, JavaScript, and Python being the worst of the pack because of their duck-typed philosophy. .NET is OK for quick and dirty proof of concepts only, but I would never use it for a final product.

    By the way, I use all of these languages except Java.

    Sounds like you work more with desktop applications.

    With web applications, the different versions of .NET are very minor. You pretty much run 1.1, 2.0, or 4.0. You have that version of the framework installed on the web server, and all is happy.

    With Java, from what I've seen, a lot of apps are dependent on the exact version. You can run it with 6u21, but not 6u28. And don't even try running it with 7.

    And you have to hope that Java doesn't decide to update itself.

  • (cs) in reply to QJo

    In Python the type is actually called "dict" on account of "dictionary" being too long.

    Also, technically dict is a concrete implementation, with Mapping and MutableMapping as abstract types.

  • (cs) in reply to eViLegion

    I did not know this! So I do not belong to the rest of the world. And I would dare to say that a kindergarten kid does not know that either.

  • (cs) in reply to ludus
    ludus:
    Nagesh:
    synp:
    Maciej:
    I'll take "The Real WTFs" for $200.

    What is C# ?

    C# is lazy man's java! If you're lazy and want to code in language that used to resembel java, then C# is for you.

    No, dude = C# is for smart developers who realized that programming in JAVA is pointlessly difficult and old. The excuse of "we're covering more platforms" is bullshit. I can get the same job done in C# a lot faster than in any flavor of JAVA. There isn't a single JAVA IDE that doesnt' suck.

    Nice statement... let's try changing some keywords:

    "No, dude = C++ is for smart developers who realized that programming in C is pointlessly difficult and old. The excuse of "It is not object oriented" is bullshit! I can get the same job done in C++ a lot faster than in any flavor of C."

    Man, you must be new in the industry.

    And when it comes to JAVA and its IDEs: try Netbeans. But on the other hand, JAVA might be too difficult.

    Also there is a flaw in your argumentation from above. You write "The excuse of "we're covering more platforms" is bullshit." followed by " I can get the same job done in C# a lot faster than in any flavor of JAVA.". The second statement cannot be inferred from the first, which makes me think that you are not able to clearly express yourself or that you are lazy in what you write.

    This leads to one conclusion: you do not care!

    And that my friend is one of the most important things in the craftsmanship of code. Whether that be C#, LISP or Brainfuck.

    PS:

    And WTF does "No, dude = C#..." mean?

  • TimG (unregistered)

    No TRWTF is that you were using [programming language] on [some platform] instead of [other programming language] on [another platform]. Because [other programming language] is awesome and a) [protects you from making bad apps] -or- b)[is too difficult for dumb people to use, and smart people only make great apps]. Didn't see that one coming, did ya?

  • (cs)

    The number of layers per-se is not a problem. I once wrote a system for real time audio processing where the source code went through nearly 20 layers on some pretty time critical elements.

    The compiler optimized this into direct inline calls...

    Now with .NET there is not jus the language compiler, but the JIT compiler. If you disable JIT-Inlining, you will not allow it to perform this type of work. Also if the JIT for a block of code occurs while a debugger is attached (yes, even a "Release" build with optimizations turned on), the inlining will be disabled.

    Amazing how many people don't know this and then complain about performance.

    That being said the implementation shown is a REAL WTF....but much of the knee jerk rationale is not.

  • Swedish tard (unregistered) in reply to jimmy
    jimmy:
    TRWTF is that in the lately these articles end with shit like "was able to get things done 15 minutes before they went live".....

    I read this as "it was never tested".

    In fact, most places I've worked even the most planned change basically needs 3 days lead time and thousands of approvals to even make it from the last test environment into the real world.
    Anyone who thinks it's safe to deploy something you finished 15 minutes ago (even if you're the most awesome coder on the face of the planety) is stark fucking raving mad!

    Why would Iron man have crazy sex with them just because they are stupid?

  • KingBeardo (unregistered)

    Ah, abstraction layers and ludicrous over-engineering... I can kind of sympathize with the Abstractor here, but he's forgetting the golden rule that one should use the right tools for the right job; uber-abstraction was not needed here because the data that required processing was very well defined, hence the improved performance with standard dictionaries. That said, I've got to raise a couple points about the 'successful' implementation -- first, it takes 15 minutes to run. That is 900,000 milliseconds, or ~4500 human-brain refresh cycles, and a completely unacceptable delay for any kind of recurrent processing. Second, the use-case only required an update of 500,000 records in a (presumably) well-structures database... that should be easily doable in 15 seconds, not minutes, even with only a basic knowledge of the DB schema. Third, this process is supposed to run every 30 minutes, and it takes 15 minutes to complete-- that means that half the time records will be in an invalid state, on a live website. That would be a fail

  • Neil (unregistered) in reply to Investigator
    Investigator:
    D-Coder:
    foo:
    Joao Reis:
    I don't like my car wheels being so... circular, it's the devils thing that i can go so fast. I what my wheel made by me, They should be Oval!
    I originally designed my car with square wheels. Then I changed to triangular wheels. A great improvement: 25% less bumps!
    Mythbusters tried square wheels. It was bumpy at slow speeds, somewhat better as they sped up.

    You know those big steel bolts that hold the wheel onto the end of the axle? About 30 seconds into the test one of them sheared, the wheel fell off, and the ride was over.

    Our local science centre used to have a square wheeled pedal-car you could ride - it was on a special track (a series of hills) that made the ride feel smooth.
    Some sort of inverse cycloid, I assume?

  • Neil (unregistered) in reply to ludus
    ludus:
    Last comment in reply to:

    http://thedailywtf.com/Comments/From-Three-Days-to-15-Minutes.aspx#409613

    The irony is that comment 409613 shows up as a reply, but this one does not...

  • Hugh (unregistered)

    You want to try SortedList<TKey,TValue> (Array.BinaryFind based, slow to fill, incredibly fast to find) and SortedDictionary<TKey,TValue> (Red-Black Tree based, fairly quick to fill, half as fast as SortedList to find) since both are even more performant than Dictionary<TKey,TValue> - as I recently found out when narrowing down a bottleneck to a call to a 1.3m element Dictionary.

    I have to admit that in the first instance The Abstractor sounded a lot like me. I have developed most of a "Common" library for my current client - although I have been encouraging others to dip in, refactor & contribute. The "Common" library does, indeed, contain a lot of generic, business-logic-free, code. However, I'm always open to suggestions and do tend to benchmark my own code, as well as cracking open Microsoft code to see which of the Timers is better to use (it's Threading.Timer btw) or what Microsoft have done to make ConcurrentDictionary concurrent.

Leave a comment on “From Three Days to 15 Minutes”

Log In or post as a guest

Replying to comment #:

« Return to Article