Why my friend had to retake his C++ course with a different professor



  • Sometimes I spend my free time on the cplusplus.com forums helping out the beginners, and over the years I noticed the same trend - C++ is often taught poorly. Many times it appears that people are taking a "C++" class where the professor is teaching C or C with classes. My university is, unfortunately, not an exception...

    I recently found an old post I made over a year ago about my friend whose C++ professor didn't seem to have a grasp on C++, and I thought it deserved reposting here:

    [quote=LB_]My friend is at the same college as me and is taking an intro-to-CS class. I offer help to him when he needs it, and looking at these projects, I can see why.

    1: https://drive.google.com/file/d/0B6gYqBQuTG-9ZFczYUlsU0l5bjg/view?usp=sharing
    2: https://drive.google.com/file/d/0B6gYqBQuTG-9czVUbXh0aDdFV2c/view?usp=sharing
    3: https://drive.google.com/file/d/0B6gYqBQuTG-9OUFCUFRVdDdxeU0/view?usp=sharing
    4: https://drive.google.com/file/d/0B6gYqBQuTG-9c1dUZzBILTdfLUU/view?usp=sharing

    The project specifications are pretty poorly worded and vague or ambiguous at best. Even worse is what the projects are requiring the students to do.

    Project 1: Converting between arabic (decimal) numbers and roman numerals - not so bad, except that the input file is also the output file. Not only that, read the hint:

    Hint: seekg(), seekp(), tellg() and tellp() will be your friends for this project. Don’t be afraid to use them.
    Given the unknown nature to the number of lines in the file, arrays will not be useful here.
    The professor is suggesting to use binary seeking. For text files. Which will be opened in text mode. My solution to this project does not involve any of these functions and instead I use formatted input. My friend got around the we-haven't-been-taught-vectors-yet problem by writing to a temporary file and then replacing the original via C's remove() and rename().

    Project 2: Expands on Project 1 by adding an interactive console-base interface to let the user sort/search with two different algorithms each. My main issue with this assignment is that the class has still yet to teach how to actually write code, and is instead focusing on the algorithms. My friend understood the workings of the algorithms very well but struggled with writing the code needed to implement them. Additionally, the assignment asks the students to duplicate output to both the console and to a log file. It can't seem to make up its mind on what it wants and so asks for everything however unrelated.

    Project 3: Evaluate the results of (very limited) mathematical expressions. Not so bad, except for one problem: the assignment requires use of dynamic memory in the form of manually managing dynamically allocated arrays. I should point out that my friend says they were not taught how to do this until after submitting Project 2. To this day they still have not even heard mention of vectors.

    Project 4: Builds upon project 2 by adding a couple new options to the console-based interface. The main thing is adds, however, is a requirement to use signly-linked lists. And to only support binary search (which means deleting the existing linear-search code). Not to mention more ambiguity and vagueness.

    When it comes to the algorithms and data structures being taught, my friend has a pretty good idea about what's going on. Until I ask him to show me the code he would write for it. "Umm, they didn't teach us that yet." is his usual response. And I believe him. Just to make things clear, the class claims to teach C++.

    In case it isn't obvious, I am very unhappy with the way the class is being taught just by looking at the projects. Maybe my friend isn't paying good attention in class, but the project PDFs are real and unmodified.[/quote]My friend eventually failed this course and took it under a different professor the next semester. At my university we have a policy that the first time you retake a course, the grade replaces, so this worked out for my friend in the end. Thankfully my Java AP exam score gave me credit for this C++ class so I could skip ahead to the Java course instead...but that's a story for another time.

    By the way, do read the rest of the original thread if you have time and if you are not that familiar with C++. It will explain the :wtf:s more.



  • I once retook a course on Statistical Mechanics because the professor was a nutcase and unable to teach the class properly.

    For instance, he proudly proclaimed that climate change was a lie*) and that Einstein was a fraud. The dean had a restraining order against him and his own son was alienated.

    Under the next professor I aced the exam.


    *) I mean, you surely can argue about it but this guy, he presented a paper where he showed the Greenhouse effect to be non-existant.


  • Winner of the 2016 Presidential Election

    @Rhywden said:

    Under the next professor I aced the exam

    It's amazing how much the lecturer can affect these things. I had one module at University where the lecturer was obviously a very competent mathematician but he couldn't teach to save his life. You'd go into a lecture thinking you're fairly solid on the topic and come out with no idea at all. I think if he'd taught basic arithmetic I wouldn't be able to add 2+2 any more



  • I challenge anyone to show me a good C++ teacher in Poland. By good I mean one who:

    1. Knows C++ differs from C not only by file extension.
    2. Knows C++ programing is more about language and design, rather than algorithms. FFS, who in 2015/2016 needs to know how to make a hash map or a R-B tree? Just use the one you have already in the standard library, dammit!
    3. Knows that metaprogramming or threads are not satanic.


  • @NeighborhoodButcher said:

    Knows that metaprogramming or threads are not satanic.

    In Go, we use reflection for metaprogramming, but threads are abstracted away as goroutines. To turn a function call into a new thread*, you just add "go" before it.

    *It's not actually a new thread, since goroutines share threads that aren't being used for blocking OS calls.



  • @LB_ said:

    signly-linked lists

    Is that when every element of the list has a sign pointing in the direction of the next element?



  • Sounds like you have a std::async built into the language - that's good. I don't believe any teacher here would dare to teach such things. Everything seems to be focused more on data structures and algorithms, instead of things that actually are meaningful in real world*. I conduct C++/design trainings in my company and it pains me to see when our universities spew out. We get people who ejaculate when they can reinvent the same algorithm for a 100th time, while they don't know what a template is. And using the standard library? Why when you can reinvent everything yourself (and fail doing it). NIH is strong here.

    [*] of course I don't claim this knowledge is totally pointless



  • @Zecc said:

    @LB_ said:
    signly-linked lists

    Is that when every element of the list has a sign pointing in the direction of the next element?

    Yes. The sign denotes the direction of the flow which means you can easily implement a flip-flop-circuit-like data structure. It's a ring buffer without the ring!



  • @NeighborhoodButcher said:

    Sounds like you have a std::async built into the language

    It's not quite like that because goroutines don't return values. However, we do also have channels, which can be used to transfer values and synchronize and all that fun stuff.

    ch := make(chan string)
    go func() {
        ch <- "foo"
    }()
    fmt.Println(<-ch)
    


  • @ben_lubar said:

    It's not quite like that because goroutines don't return values.

    That's too bad - having a future which can give you the value computed asynchronously at some point in time is very handy. C++ will also have resumable functions built in, which give async operations a nice boost - you can basically defer execution at any point in a function in time.



  • @Jaloopa said:

    I had one module at University where the lecturer was obviously a very competent mathematician but he couldn't teach to save his life.

    I had that too. Linear Algebra. He wrote the book we used. (Run!) I struggled through. A friend who was on the verge of failing dropped the class and took it the next semester with a different teacher - and got an A.



  • @NeighborhoodButcher said:

    Knows that metaprogramming or threads are not satanic.

    Like fuck they ain't. I mean, threads, fine - though C++ is not a terribly great language for safe threading. But metaprogramming? That's just motherfucking, blood drinking, Satan praising, backwards chanting, demon hailing insanity.



  • @Maciejasjmj said:

    I mean, threads, fine - though C++ is not a terribly great language for safe threading.

    Since '11 it's actually one of the bast languages for threading. You have the whole memory model written with threading as a priority.



  • Well, it wasn't when I had anything in common with it. Then again, my C++ book advocated using unions for type punning (and touted it as one of the best uses for them), so maybe I was just taught bad things.

    But I rest my case as far as TMP is concerned - that's not just language abuse, that's language torture. And that comes from a person who uses ExpressionVisitors in C# without thinking twice.



  • @Zecc said:

    @LB_ said:
    signly-linked lists

    Is that when every element of the list has a sign pointing in the direction of the next element?

    Sign Heil!


    Filed Under: Enjoy your badge



  • @Maciejasjmj said:

    my C++ book advocated using unions for type punning

    Spal ją.



  • @Maciejasjmj said:

    That's just motherfucking, blood drinking, Satan praising, backwards chanting, demon hailing insanity.

    Or, as we call it, "programming".



  • @NeighborhoodButcher said:

    Spal ją.

    Not burning it before I get the time to read it again and list the WTFs. As far as I remember, there were quite a bit.

    And funny thing is, it's one of the most popular and famous C++ books in Poland. You might be familiar with it, too.



  • @NeighborhoodButcher said:

    Knows that metaprogramming or threads are not satanic.
    Threads aren't satanic but aren't taught well enough in colleges from what I've seen and experienced. I think it may be a problem of thinking about multiple things at once. Few people can do it and they do it badly.

    Metaprogramming(I'm thinking reflection in java) usually leads to all kinds of skullfuckery in my experience but I wouldn't discount it as a tool. Maybe weekend satanic.



  • Template metaprogramming was an accidental functional language within template syntax. Now, however, it's a core part of C++. The syntax is still terrible and the error messages are still terrible, but it's much easier to use now that it has standard library support. It's still controversial, but I personally see it as very useful.

    C++ doesn't have reflection yet.



  • @DogsB said:

    Metaprogramming (I'm thinking reflection in Java)

    Then boy are you thinking wrong. For one, reflection is actually something that was consciously designed. TMP is kinda like using that bug in Discourse to have it serve as an MD5 calculator.



  • @Rhywden said:

    he presented a paper where he showed the Greenhouse effect to be non-existant.

    I'm going to present a paper to you where I show the word "existant" to be non-exist­e­nt.



  • @rc4 said:

    @Rhywden said:
    he presented a paper where he showed the Greenhouse effect to be non-existant.

    I'm going to present a paper to you where I show the word "existant" to be non-exist­e­nt.

    Well, I just wrote it so it clearly exists right here!

    Unless you subscribe to the lonely world of solipsism, of course.



  • @NeighborhoodButcher said:

    We get people who ejaculate when they can reinvent the same algorithm for a 100th time

    Perhaps you should stop lacing the lunch punch with viagra. Just a hunch.



  • @Rhywden said:

    Unless you subscribe to the lonely world of solipsism

    I do.



  • @DogsB said:

    weekend satanic.

    LOL

    At my uni, the first semester is "Introduction to Programming" which consists of a half semester overview of basic concepts like types, loops, if statements, I/O etc. within an educational purpose language that cannot do shit other than that, and a half semester C++ that reaches functions and structs as well as std::vectors by the end.
    The second semester introduces pointers, OOP, basic templates, overview of STL containers and algorithms, as well as 2D graphics via a simplified wrapper around SDL.
    In the third semester we have Data Structures and Algorithms, where we implement buggy trees and sorts.
    In the fourth semester we have Introduction to Java which is also the first time we meet GUI and multithreaded programming.
    Dynamic languages are only taught in optional courses.



  • @LB_ said:

    Sometimes I spend my free time on the cplusplus.com forums helping out the beginners, and over the years I noticed the same trend - C++ is often taught poorly.

    Also cplusplus.com is a website that teaches C++ poorly. People I know recommend cppreference.com over that.



  • @NeighborhoodButcher said:

    Since '11 it's actually one of the bast languages for threading. You have the whole memory model written with threading as a priority.

    Or you could use C# which had all that shit settled back in 2003.



  • @LB_ said:

    Builds upon project 2 by adding a couple new options to the console-based interface. The main thing is adds, however, is a requirement to use singly-linked lists. And to only support binary search

    ... binary search a linked list?
    What kind of retarded monkey wrote that assignment?


  • Winner of the 2016 Presidential Election

    @NeighborhoodButcher said:

    Knows C++ differs from C not only by file extension.

    I once spent 20 minutes explaining the barest basics of std::vector to an assistant because I implemented a stack (yes, I know, stupid assignment) by just wrapping std::vector in a class and providing only push and pop methods. He refused to believe you can make a simple stack implementation in C++ in less than 150 lines of code.

    That was for a lab where we were told we can use "any language we want, as long as it can run on lab computers, but C/C++ is preferred". Yeah, I believe they were competent enough to properly grade that...


  • Impossible Mission Players - A

    @Onyx said:

    you can make a simple stack implementation in C++ in less than 150 lines of code.

    Well I'm sure you could compact those 150 lines into one or so by deleting the carriage returns, but I'm sure he wouldn't have appreciated the pedantry.



  • @NeighborhoodButcher said:

    which give async operations a nice boost

    ISWYDT.

    Although. with all these new threading features being integrated into the standard library, I'm beginning to think boost won't have much of a future*.

    *Oh wait, it does!



  • @marczellm said:

    Also cplusplus.com is a website that teaches C++ poorly. People I know recommend cppreference.com over that.

    Yeah, I use both sites. Ironically, the cplusplus.com tutorial is where I originally learned C++ X)



  • Sounds like the professor designed the course in the pre-ISO days of C++ when the STL didn't exist (or was not yet a standard.) That kind of instruction might have been OK then, but it's certainly unacceptable today.

    @NeighborhoodButcher said:

    FFS, who in 2015/2016 needs to know how to make a hash map or a R-B tree? Just use the one you have already in the standard library, dammit!

    Learning how to implement these is a useful skill, but it belongs in a data structures and algorithms class, not one teaching a language.

    @Onyx said:

    ... I implemented a stack (yes, I know, stupid assignment) by just wrapping std::vector in a class and providing only push and pop methods.

    Of course, there's the std::stack template which does that for you as well....



  • @Rhywden said:

    Yes. The sign denotes the direction of the flow which means you can easily implement a flip-flop-circuit-like data structure. It's a ring buffer without the ring!

    When you have to build part of your algorithm into the data structure, you are :doing_it_wrong:



  • @David_C said:

    but it's certainly unacceptable today.

    He's probably old as dirt, and the fact that somehow, once you become a professor, you get frozen in time like some kind of ice-age caveman...

    Yet, professors are supposed to be researchers somehow doesn't translate into modern curriculum in programming degrees.

    >_<



  • Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious.
    — Pp. 102–3.


    the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.
    — William Gates, inventor of pancake sort


    Even though the processing power expressed by DNA flips is low, the high number of bacteria in a culture provides a large parallel computing platform. The bacteria report when they have solved the problem by becoming antibiotic resistant.[6]
    — the wiki article on pancake sort



  • @Buddy said:

    Bad programmers worry about the code. Good programmers worry about data structures and their relationships.
    A surprisingly astute observation. If only it wasn't so difficult.

    @xaade said:

    professors are supposed to be researchers
    I'm not sure what the model is elsewhere but in Ireland it went

    undergrad -> postgrad -> part time professor / researcher.

    This appears to be the UK model too.

    I've always felt this was a bit retarded because the research is usually in the vein of "I find this interesting and I'm going to spend the rest of my life in bubble and try to fix what is probably an imaginary problem" I think an extra step is needed between undergrad and post grad. At least 10 years in the industry to develop a pet peeve so :

    undergrad -> 10 years in the industry to develop a pet peeve -> postgrad -> part time professor / researcher.

    I feel we would probably get more interesting and relevant research this way.



  • @blakeyrat said:

    Or you could use C# which had all that shit settled back in 2003.

    No, if you want your program to actually be efficient and portable. C# has it's usages, just not in my field.

    @David_C said:

    Learning how to implement these is a useful skill, but it belongs in a data structures and algorithms class, not one teaching a language.

    No, it's not useful to majority of real-world applications. You should know the characteristics of those: what they represent/do and what they are used for. But how to implement those? Why? To make another version along with a 1000 that's already there? That's pointless - that's NIH at it's finest. If you ever need to dig into the specifics, Google it, but don't waste years teaching it. Just know when to use what and what will be the effect.



  • @Rhywden said:

    flip-flop-circuit-like data structure

    Here you can buy a pair of jk circuit flip flops even with truth table!

    @Rhywden said:

    ring buffer without the ring!

    Ohh noeeEESSSSS! Our preccccciousssss with out our preccccciousssss!! Nassssty Rhywden! Nasssty Rhywden! We hatesss it! WE HATESSSSS ITTT!!!



  • @Buddy said:

    Bad programmers worry about the code. Good programmers worry about data structures and their relationships.

    I couldn't disagree more, and it seems others couldn't either. What's the deal with this quote, is it just extremely dated?


  • Winner of the 2016 Presidential Election

    @PWolff said:

    even with truth table!

    The kind you can flip if flip-flop performance isn't satisfying?



  • Well, that quote has merit in it. With badly designed model/data structures for your application, you're going to spend a lot of time working around deficiencies in the design, which usually leads to a disaster. But, taken literally, the quote is a bit odd - no data structure will save you from bad code; you have to worry about both. I would say it could be summarized as - get your foundations right, everything else will come smoother.





  • Thanks, that makes a lot more sense actually.



  • @NeighborhoodButcher said:

    Well, that quote has merit in it. With badly designed model/data structures for your application, you're going to spend a lot of time working around deficiencies in the design, which usually leads to a disaster.

    In my experience, replacing bad code that works with decently designed data structures is far easier than replacing a bad data structure. Partly because of what you said (the code will try to work around the deficiencies of the data structure, meaning it needs to be changed too), and partly because IME a lot of code touches (the central) data structures, making it difficult to change them, whereas code is often more isolated.

    But YMMV.

    @NeighborhoodButcher said:

    I would say it could be summarized as - get your foundations right, everything else will come smoother.

    Also, QFT.



  • @NeighborhoodButcher said:

    No, if you want your program to actually be efficient and portable.

    C# is far more efficient since there's so much bullshit you simply do not have to worry about while writing the code. And other than embedded, it's equally portable.


  • Discourse touched me in a no-no place

    @NeighborhoodButcher said:

    FFS, who in 2015/2016 needs to know how to make a hash map or a R-B tree?

    Understanding how they function under the hood helps. Making your own helps in the understanding.



  • @blakeyrat said:

    C# is far more efficient since there's so much bullshit you simply do not have to worry about while writing the code. And other than embedded, it's equally portable.

    No and no. In terms of runtime - it's not. You mean efficient in terms of productivity; not the same thing. In the end it's a trade-off - write faster or have faster code.

    In terms of portability - if you don't use any platform specific features, your C++ code will run on anything with a working C++ compiler. C# - nope.

    @PJH said:

    Understanding how they function under the hood helps. Making your own helps in the understanding.

    Understanding how they work helps indeed. But you don't need to have such deep level of knowledge to use them efficiently.

    For example, if I need a fast unordered lookup data structure, in most cases I'll use a hash map. Does knowing how to make one help me? Nope. I only should know how it works, more or less, what its characteristics are, and what are the possible caveats. In this particular case I can summarize it like this: if you need unordered fast associative container - use hash map, but be aware that sometimes it might be slower than tree-based map if your keys are complex and need a lot of time to calculate the hash, or if there are many hash collisions. One sentence which pretty much says it all - no inside knowledge required. Does this require any knowledge about buckets, hash algorithms, grow strategies etc.? Not at all. Would that knowledge help in better understanding it? Probably, but what's the point if you already know how and when to use it.

    It's better to teach people what tools are available and when/how to apply them, instead how to reinvent the wheel over and over.



  • @NeighborhoodButcher said:

    your C++ code will run on anything with a working C++ compiler. C# - nope.

    I'm pretty sure C# will run on anything with a working C# compiler.

     
    Captain Obvious awaaaaaayyyyy....


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.