• Where's the WTF? (unregistered)

    A student was given a hammer and was surprised that something was not a nail. Everyone's done at least something similar, but... where's the WTF?

  • Brian Boorman (google)

    if (name.startsWith("SECNOD"))

  • SECNOD (unregistered)

    what now?

  • TRDIH (unregistered) in reply to SECNOD

    You broke it, you fix it.

  • Gummy Gus (unregistered)

    Well, actually, your if statements are going to be FASTER than a binary search for the first decision, where you're narrowing it down to one prefix, then if there are fewer than say 5 suffixes, you're still likely to be ahead.

  • Foo AKA Fooo (unregistered)

    Is this just an unjustified rant, or are US universities really so detached from practice? At my university (in Europe), we did learn about binary search, O(log n) and stuff.

    In fact, we also learned about (the theory of :) regular expressions which are even better suited here (though probably not easily available in FORTRAN), since once compiled, they take constant time to match a string against any number of alternatives.

  • (nodebb) in reply to Where's the WTF?

    The WTF is the education system that set the student up for exactly that failure. College courses are oriented to teach students a package of knowledge that may be useful if they go into designing a project, but none of the skills or experience that help them actually build it.

    I understand that the situation is being remedied somewhat, but unless you're getting a job on HIRED or something, many employers demand a CS degree for positions that make use of nothing a CS degree teaches, so expect this WTF to keep coming up again and again.

  • Pista (unregistered) in reply to Where's the WTF?

    He wasn't a student anymore, but he was a greenhorn, so you're right: no WTF, this is the way we all learned the craft. Cute story, though.

  • my name is missing (unregistered)

    My first professional job project involved writing a programming language pretty-printer in Fortran as that was the only language available. I spent months on it and finally turned it in. Despite it working perfectly to spec (no mean feat in Fortran) no one ever used it. The early 80's were an interesting time to start.

  • I'm not a robot (unregistered)

    So what was this one-character TeX feature you implemented?

  • snoofle (unregistered) in reply to I'm not a robot

    Knuth had written something to loop over a list of control codes to submit to the hardware. The list only ever contained one code, so it looped over an array, but accessed it as a[1], which I simply had to change to a[i]. It just took me forever to figure out what he was trying to do and how. And yes, it was actually named 'a'.

  • David (unregistered)

    At least they taught some theory back then. The graduates I've interviewed over the last few years seem to have neither practical experience nor a solid understanding of theory. All they know for certain is that they deserve more money for their first job than senior engineers.

  • Waldo (unregistered) in reply to snoofle

    If you know that the variable was "a", you didn't reverse engineer anything, you looked at the actual source.

  • Old FORTRAN IV Crusty (unregistered)

    Snoofle, I am disappoint. You should have given us the FIV code. That would have gotten the full flavor of the WTF across to us.

    Yes, implementing WTF logic in ancient WTF syntax is the full experience. Thanks for shorting us.

    Also, "Theory of XXX" classes would have been fine if one of them had been "Theory of Algorithms", you'd been paying attention that semester, and you'd recognize an obvious array-sorting application when you saw it (The last is the only one a "Theory of" class wouldn't help with, so valid point is valid.)

  • TheCPUWizard (unregistered)

    Perhaps the author simple missed one of the key "theories"....

  • snoofle (unregistered) in reply to Waldo

    I beg to differ. When the source contains nothing but 1 or 2-char variable names and no comments, you are reverse engineering the INTENT.

  • (nodebb)

    Inversely, I fondly remember one instance of pure theoritical knowledge becoming useful. During a college "Theory of algorithms" course we had to write a program for solving the age-old "8 queens puzzle". Of course the obvious approach was the recursive one. Quoting Wikipedia: "Most often, it is used as an example of a problem that can be solved with a recursive algorithm, by phrasing the n queens problem inductively in terms of adding a single queen to any solution to the problem of placing n−1 queens on an n-by-n chessboard. The induction bottoms out with the solution to the 'problem' of placing 0 queens on the chessboard, which is the empty chessboard.".

    Fast-forward a few years, in the 1980s I'm the IT department in a school and on my spare time I'm writing APL-language programs for automating some of the school's hundreds of manual tasks.

    The worst manual task was fitting each student's choice of elective courses to the course schedule. This took days and results were not optimal, so a good candidate for automation. I quickly realized, looking at the schedule as a table, that once you've placed a student in a cell, the whole row and column become locked out for this student. So this was a 4-queen puzzle on a 4 x 6 chessboard, except that diagonals were allowed. I dug out my old college textbook and Pascal program and implemented it with about 6 APL LOC. This program was still in use when I left this school 15 years later.

    Note: Why APL? APL makes it ridiculously easy to work with tables, so it's a natural for a school environment where any data can be expressed as tables: lists, grade books, schedules, etc. This was pre-spreadsheet times, of course.

  • jerepp (unregistered) in reply to snoofle

    of course it was 'a' and now we come to understand why Wirth invented Pascal

  • Da expert (unregistered) in reply to snoofle

    +1. I have done that a lot.

  • Carl Witthoft (google)

    Ummm... so what college "Theory of XXX" course failed to point out that 100-level if-else -if -else code is dog poo and you should rethink the problem?

  • Alon Altman (google)

    What kind of theoretician won't recognize that each of those comparisons are O(l) where l is the length of the string? The same idea could be implemented in an efficient manner with a Trie. A tree that branches on the next character. A trie lookup is O(l) worse case -- better than both binary search and the if-else.

  • DrPepper (unregistered) in reply to snoofle

    Much of my day job is exactly that: reverse-engineer the intent of the code; so that when you make a change you first understand what the code is actually doing; and second you don't break it with your change. A good CS curriculum should include a course in "what is this code doing". I've heard this referred to as forensic coding.

  • Jan Bruun Andersen (unregistered) in reply to Carl Witthoft

    That college course also forgot to mention that programs are made of algorithms and data structures.

    The data structures in this case being the rules for determining if a string is valid. The rules that are embedded in those IF-THEN rules should be lifted out into a configuration file. The algorithm itself would be a little longer, a bit more complicated, but the resulting program would be much more flexible. No need to change code and recompile. Just update the configuration file.

  • I'm not a robot (unregistered) in reply to snoofle
    When the source contains nothing but 1 or 2-char variable names and no comments
    ... are you sure it was TeX that you were dealing with? It's kinda famous for having the complete opposite of "no comments". (Or maybe you were looking at an already-preprocessed version?)
  • Zenith (unregistered) in reply to David

    They're just ahead of the curve. Work with some visa holders that can't do basic math and see how modest your salary requirements are afterward.

  • isthisunique (unregistered)

    The funny thing is you're on to something. You can do this in O(1) with a tree where children consists of a look up table for 0..255. It's like a multi-dimensional array which can have better space complexity than a sorted array. The problem is that when not all characters are valid it wastes space. You need some extra space as well to way that the end of this sequence is valid. There are a whole bunch of things you can do and special tree structures but a sorted lookup table is far far simpler.

  • snoofle (unregistered) in reply to I'm not a robot

    You're exactly right - all we had to work with was the pre-processed code. I told the project advisor that it was BS to work with it in that form and that wer should just get the actual source. He told me that it had to be done, and that it was "good practice". Little did I know that it was good practice for code I'd inherit in the real world...

    And before anyone asks, knowing what I know now, I would have just hashed the strings and done an O(1) lookup table (I don't believe FORTRAN IV had hashmaps...;)

  • siciac (unregistered)

    College courses are oriented to teach students a package of knowledge that may be useful if they go into designing a project, but none of the skills or experience that help them actually build it.

    Theory and practice are very different in how accessible they are.

    It's hard to study a broad amount of theory by yourself because you're naturally going to skip over the parts you don't like, but that might be important. It's also good to have someone versed in the theory grade your work.

    It's pretty easy to study practical application by yourself, since people will just pay you to do it. And if you screw up, things will break.

    So there's not much reason for college to teach you all the practical stuff, because that's not where the structure of a liberal arts degree is able to add much value.

  • David (unregistered) in reply to Zenith

    That's not really a thing in my country, though from what I've heard of US engineering culture (I'm assuming that's where you're based) I can see your point.

  • Kashim (unregistered)

    As someone who just recently finished their bachelor's degree (in CS) while already working, I was appalled by the other students continuously, and then by the school as well. It wasn't until we got to the Software Engineering capstone course that anyone was even taught what source-control was, nevermind how to use it. We had a semester long group project, and all of the groups but mine just e-mailed their code files around, or copied and pasted out of google docs. We were the only one with a Git repo, and it was like pulling teeth getting the other guys to actually use it...

    University still gives you all the theory, and oh-so-little of the implementation. I honestly think that a huge culprit is how teachers no longer require that students give intelligent solutions to problems for a program to "pass". The 100 levels deep if-else would have gotten an A in most classes simply because it works, satisfies all of the inputs and outputs, and compiles. I've seen a lot of people make it through programming classes without having any idea what they were actually doing at the end. That's the real tragedy.

  • Chris (unregistered)

    When I graduated from CS, I had a firm grasp on algorithm design and data structures, but if I were to start a new project, one of the first things I would do would be to implement my own linked lists / trees / etc. I don't believe they ever told us not to go around re-inventing the wheel, and to look through the API documentation (and this was Java. The documentation is there.). They definitely didn't tell us about source control, and I don't think they got into unit testing other than to say that it is a thing.

    I think I've learned a lot more practical stuff about programming from this website than from all my years at uni. Mostly in terms of "You know you're doing something wrong when..."

  • Kathryn (unregistered)

    How funny! I also graduated from state university of New York at Albany, but in my day there was no computer science degree just a minor. All the computing was done using punch cards. So as you can imagine there wasn't much applicable when I got my first programming job. But I've managed to persevere. Thanks for bringing back some good memories

  • Olivier (unregistered) in reply to Chris

    Chris, sure, you've learned more practical stuff in the real world, but if all you had was looking at Java documentation, would you have such a easy understanding of linked lists, trees, etc.

    By writing your own libraries a couple of times, you know how things really works.

  • Jim Buck (google)

    Whoa, when did you go to SUNYA? I wonder if we knew each other. MS CompSci '95 here, though I suspect you were there before my time, but surely we had the same profs.

  • Yog-Sothoth (unregistered)

    The guy in the picture looks like Shia LaBeouf in a former life.

  • Quite (unregistered)

    A really good complete book along these lines is Jon Bently's "Programming Pearls" which I picked up by accident at a remainders store. It gives, for example, a simplet technique to sort a number of records in the form of 7-digit numbers (known to be unique -- they were telephone numbers) in O(n) which amused me greatly.

  • Ulysses (unregistered) in reply to Where's the WTF?

    T[R]WTF is the butchery of the word 'leverage' by someone I expected to be above such MBA nonsense.

  • marcodave (unregistered) in reply to DrPepper

    My university advanced programming courses (back in 2004 one in C++ the other in Java) essentially boiled down to "what is the output of this program?", rigorously in pen&paper, and filled with lots of constructors, copy constructors, assignment operator overloads, dereference operator overloads and such. Mostly irrelevant for practical usage, but I think it forged me to perfect my ability to "visually debug" the code before ever running it.

  • kg (unregistered) in reply to Foo AKA Fooo

    I'm a student at Berkeley and this seems like an unjustified rant.

    There's no way you'd get past data structures, let alone algorithms, thinking that an if tree is how you handle this kind of thing.

  • Herr Otto Flick (unregistered)

    Computer Science is a scientific discipline, it is not software engineering, so complaining that studying CS does not prepare you for working as a software engineer is like complaining that studying Biology does not make you a doctor. In fact, that's a great analogy - even if you studied medicine for five years, after graduating you are still too dangerous to treat patients.

    If you are studying Computer Science as an undergrad, the net outcome at the end of your course should be that you can study the science of computing at a higher level. Knowing good software engineering practices, source control, JFDI techniques etc. isn't remotely related to any of that.

  • GenericDeveloper (unregistered)

    Hey, cool! I'm an alumnus of SUNY Albany too. Luckily, I ignored the actual classes as much as I could and spent my time writing code for a bootleg Ultima Online server. I'm confident that I got much more practical experience from that than I would have from the classes.

  • SomeName (unregistered)

    I'm afraid so. If you go into best college / university then yes, it's all good. If you go into bad one then you find course that barely passes regulations (if at all) and in practice is even worse. My course had C, C++, Java, multiple times, but some people still managed to graduate without being able to write bubble sort.

  • Hannah Banana (unregistered)

    Theory of XXX? Sign me up!

  • (nodebb)

    I frequently struggle with organizing as well as writing articles. I constantly have to change the structure and correct mistakes as a result. more so if it's a dissertation or another form of important work. In these situations, using the website to is easier for me. This will allow me to study effectively and earn high results!

    Addendum 2022-10-25 20:13: I frequently struggle with organizing as well as writing articles. I constantly have to change the structure and correct mistakes as a result. more so if it's a dissertation or another form of important work. In these situations, using the website to https://www.bestessays.com/buy-personal-statement.php is easier for me. This will allow me to study effectively and earn high results!

  • Massagetherapist (unregistered)
    Comment held for moderation.
  • Massagetherapist (unregistered)
    Comment held for moderation.
  • Massagetherapist (unregistered)
    Comment held for moderation.
  • Massagetherapist (unregistered)
    Comment held for moderation.

Leave a comment on “Theory Versus Reality”

Log In or post as a guest

Replying to comment #489953:

« Return to Article