Undefined OOP Techniques



  • @dkf As satisfying as it would be, getting charged with assault probably won't do Gąska any favors. Besides, the whole point of tenure (aside from job security) is to make it safe for professors to say and do unpopular things; the idiot professor would be able to argue that it was a matter of free speech, and probably garner sympathy for it.

    Really, the best hope is to see if he can get kicked upstairs and pray that he doesn't do more damage. Given that he's clearly already reach the Peter Limit for his career, that's highly unlikely to help.


  • Winner of the 2016 Presidential Election

    @dkf said in Undefined OOP Techniques:

    students who are bothering to pay attention

    What kind of mythical creature is that?


  • Banned

    @dkf said in Undefined OOP Techniques:

    @Gąska I like how Program B has the option to write off the end of the array (since there's no sequence point between the increment of i and the use of it as an index). That's an opportunity for chaos FUN

    Pointing this out was actually part of the "correct" answer.

    Why can't the C++ committee stop with this pretence and define an evaluation order (and let the compiler handle the non-breaking reorderings)?

    Optimization potential.

    Lots of other languages do this, and it avoids a whole bunch of stupidity and inconsistency between implementations.

    These languages also got rid of non-void increment and assignment operators.

    @gwowen said in Undefined OOP Techniques:

    @Gąska So did you
    a) point this out to the instructor, maybe by asking a socratic question about the lack of sequence points ...
    b) go and whine about it anonymously on the internet like a spineless millenial

    During test, I wasn't sure if it was actually undefined or not - checked this only after I got home.



  • @asdf Tell me about it. The strangest part about the Data Structures course? Most of the other students were thrilled that the instructor was doing most of the work for them.

    Perhaps I should clarify what I mean by 'fill in the blanks' projects. Basically, the professor writes the program, then edits out whatever parts they think the students need to learn about (or, more often, just random and self-evident lines that teach nothing of value), then passes the edited printout (it's always a print-out) to the students for them to recreate the edited parts. While this is usually just done for quizzes (semi-justifiable as a spot-check thing during introductory courses, if it isn't done in the usual slack-ass manner - but shit, I would think that by the time you're in a data structures course you would know how to write a fucking for() loop without the training wheels), I've seen it in final exams or even as homework assignments.

    And as I said, he wasn't just giving you the code, he was giving it in the form of a fucking flowchart - the boxes of the flowchart would have the code inside them, which makes zero fucking sense.

    This shithead taught all his programming courses that way (and wasn't much better in his discrete math course, either). And complained about how much better FORTRAN was, and how no one appreciates writing code out by hand anymore. Goddessfuckingdammit, that shit still pisses me off.


  • Banned

    @asdf said in Undefined OOP Techniques:

    @dkf said in Undefined OOP Techniques:

    Now, if the compiler just refused to actually compile any code that it didn't think had unambiguous behaviour, that would be OK

    That compiler exists, it's called rustc. ;)

    Actually, there's one significant UB that is very easy to trigger in Rust: calling next() on iterator that already returned None. And since next() is the only method of Iterator interface...


  • Banned

    @Adynathos said in Undefined OOP Techniques:

    @Gąska Which polish university is that?

    Every Polish university. 🚎



  • @Gąska said in Undefined OOP Techniques:

    @Adynathos said in Undefined OOP Techniques:

    @Gąska Which polish university is that?

    Every Polish university. 🚎

    Let me guess, the national university system imposes this as a requirement on the professors, and never review the requirements even when told to by their superiors? That's the same shit that leaves most of the IT students in India and Pakistan dinking around with Turbo C++ after twenty-seven fucking years despite a massive national initiative to push software engineering above all else.

    Shit, the more I hear, the more I wonder if US education isn't so bad after all. Then I remember fill-in-the-blank flowcharts and start weeping for the future of humanity.


  • Banned

    @ScholRLEA said in Undefined OOP Techniques:

    Does your University have any process for removing incompetent professors from teaching duties?

    No. But even if, it would be unfair to call him incompetent - it's more like he's just a bad coder with bad habits.

    Who here has encountered flowcharts in modern programming?

    I deal with them on daily basis in my work. Every feature is specified in terms of overly specific yet still vague flow charts. It's called UML diagram, but it's still a flow chart.

    That was the same year that, when I asked the SE professor why he was teaching Waterfall, he replied, "All software engineering is based on Waterfall, no other approach exists and Agile is just another name for the same thing." Imbecile...

    There's more truth to this sentence than you might think. Although much less than he thinks.


  • Banned

    @ScholRLEA said in Undefined OOP Techniques:

    Let me guess, the national university system imposes this as a requirement on the professors, and never review the requirements even when told to by their superiors?

    No - it's actually the entire opposite. There's no requirements at all, not even inside the universities - every lecturer can do what the fuck they want on their classes, arbitrarily define requirements for passing, and they're never, ever, ever held accountable for coming up with shitty curriculum.

    It's just that they all learned programming 10-20 years ago, and this was the time when C++ cult was still strong.



  • Well, I guess that that is still better than someone who pines for the IBM 360 every day. The fossil I was talking about basically thought that modern software was the tool of de Debbil, and especially had it in for IDEs - which makes his insistence on using Visual C++ rather condescending, as it meant he didn't want us plebes sullying a Real Programming Editor (by which he meant line editors, the praises of which he sang at every opportunity). He groused endlessly about how anyone who composed code in the editor without first drawing a flowchart - not a UML diagram, because OOP is purest evil, but an honest to Zod flowchart straight out of the UNIVAC days, plastic stencil template and all - then writing a pseudo-code representation based off of that, and then writing out the code of the whole program out on paper, was in a state of sin and terminally lazy to boot.

    0_1461599542180_flowchart-stencil.jpeg

    OK, so the main reason he was using VC++ 6.0 was actually because he really wanted to teach FORTRAN, and refused to learn C++, but was required by the administration to use C++ and so he ended up teaching C but using the school-supplied C++ compiler. Even so, the condescension was still palpable, as if he thought we would never, ever be competent to touch a computer never mind write code for one. Did I mention that he would refuse to accept programs that used anything from C++ other than new and delete?

    And, oh, yes, cellphones were an awful thing that ought to be banned forever.

    I really hope he's retired by now.



  • @Gąska said in Undefined OOP Techniques:

    No. But even if, it would be unfair to call him incompetent - it's more like he's just a bad coder with bad habits.

    If you're writing C++ in 2016 without using memory management techniques/helpers (like RAII or whatever), you're incompetent. That goes beyond "bad habits". That's well into "you're going to code a security hole that'll get your company sued for $5 million" territory.

    @Gąska said in Undefined OOP Techniques:

    No - it's actually the entire opposite. There's no requirements at all, not even inside the universities - every lecturer can do what the fuck they want on their classes, arbitrarily define requirements for passing, and they're never, ever, ever held accountable for coming up with shitty curriculum.

    Even the department Dean doesn't have the ability to kibosh a class? That's insane.

    @Gąska said in Undefined OOP Techniques:

    It's just that they all learned programming 10-20 years ago, and this was the time when C++ cult was still strong.

    10 years ago it was already obsolete. 20 years ago, everybody knew it was on the way out. (Java had come out by then.)


  • Garbage Person

    A friend and I took Disco Math from a professor who was two years from retirement. We would go to class to keep an eye on the syllabus and play cribbage.

    One day the professor wrote something on the chalkboard, mumbling, stopped, stood back, scratched his head, realized it was written in Greek, erased it, and wrote it out again in English.



  • @Gąska said in Undefined OOP Techniques:

    That was the same year that, when I asked the SE professor why he was teaching Waterfall, he replied, "All software engineering is based on Waterfall, no other approach exists and Agile is just another name for the same thing." Imbecile...

    There's more truth to this sentence than you might think. Although much less than he thinks.

    Not really. Winston Royce's original paper that the classic Waterfall diagram comes from used it to demonstrate why a linear plan is inadequate. While it does show all a broad overview of the stages of development, the whole point of the diagram was as a strawman to show that such a high-level view is inadequate, and specifically that the 'cascade' idea - that each step goes forward, never back - could never work.

    Now, it is true that BandaidAgile is not as different from the earlier approaches as it's proponents usually stated, but it is most definitely not Waterfall, because no one in history has actually used Waterfall successfully (though plenty of yahoos have said they did) - Waterfall is unworkable, hell, the whole point of the Waterfall diagram was to show why such an approach couldn't work. Agile is just a codification of the ad-hoc approaches developers were actually using when the bosses weren't looking.

    Not that Agile really works either, even when used 'correctly'. Even if they weren't 99 and 44/100ths percent pure bullshit, it's not as if most developers ever understood either of those 'methodologies' well enough to actually use them.

    As I have said several times, we are at least 150 years away from the point where the term 'software engineering' will be anything more than wishful thinking.



  • @ScholRLEA said in Undefined OOP Techniques:

    Agile is just a codification of the ad-hoc approaches developers were actually using when the bosses weren't looking

    Sometimes.

    For me, the biggest thing that differentiates waterfall from agile is what is promised to the customer. In waterfall, specific and detailed functionality is promised. Agile is based on the premise that you won't know precisely what you want until you see a version you don't want, so the deliverables are stated differently. The two only overlap when waterfall is used with weak requirements.


  • Winner of the 2016 Presidential Election

    @Gąska said in Undefined OOP Techniques:

    Actually, there's one significant UB that is very easy to trigger in Rust: calling next() on iterator that already returned None.

    That's not undefined behavior, the behavior is simply not specified. :pendant:


  • area_pol

    My experience is that there is usually a course "Introduction to Programming" or similar, which is supposed to teach programming to people who have yet not done it. This course is poorly designed (in my university, such a course used Pascal, an ugly language, dead for decades) - the problem is that instead of learning to express their ideas in code, students are forced to focus on something else - algorithms, ancient technology (Pascal, C), memory management (C++). So, they learn neither of those.
    Later, the other courses that assume you know programming, are useful and easier.

    I evaded the whole problem, because I did programming long before I started unviersity (and we did not take this course at all). That was the reason I chose CS.
    Why does someone choose CS if they did not try programming earlier?


  • Winner of the 2016 Presidential Election

    @Greybeard said in Undefined OOP Techniques:

    One day the professor wrote something on the chalkboard, mumbling, stopped, stood back, scratched his head, realized it was written in Greek, erased it, and wrote it out again in English.

    I had a maths professor who would continually try to come up with "more elegant" proofs than the ones in the textbook he based his lecture on. 50% of the time, he realized that his proof didn't prove exactly what he wanted to prove halfway through (i.e. after 30 minutes), and would tell us to forget everything he told us. He also always confused indices and would randomly write <, <=, > or >= when he really meant another comparison operator, so even his "correct" proofs were riddled with errors.

    I wouldn't call him incompetent, but he was the least organized professor I ever had. In addition to his confusing lectures, he frequently managed to forget about oral exams, which caused more than one panic attack when students thought they had come to the wrong office and failed the exam. And during our last lecture, he told us that half of the semester (the last 10 lectures or something) was not even part of the curriculum and therefore completely irrelevant for the exam, he just told us all that for fun. Which he never mentioned until one week before the exam.

    Fun times…


  • area_pol

    Programming classes in Poland suck balls. Basically, if you want to develop a hate for a particular language (also, the human race) take a class on it.

    But you will surely learn how to make merge sort.


  • Banned

    @blakeyrat said in Undefined OOP Techniques:

    If you're writing C++ in 2016 without using memory management techniques/helpers (like RAII or whatever), you're incompetent. That goes beyond "bad habits". That's well into "you're going to code a security hole that'll get your company sued for $5 million" territory.

    Still, he's done some pretty awesome stuff in machine learning territory.

    @blakeyrat said in Undefined OOP Techniques:

    Even the department Dean doesn't have the ability to kibosh a class? That's insane.

    He does have power, but doesn't use it.

    @blakeyrat said in Undefined OOP Techniques:

    10 years ago it was already obsolete. 20 years ago, everybody knew it was on the way out. (Java had come out by then.)

    The cult? No it wasn't. At least not over here. The language? Irrelevant.


  • Banned

    @ScholRLEA said in Undefined OOP Techniques:

    Not really.

    :whoosh:


  • Banned

    @asdf said in Undefined OOP Techniques:

    That's not undefined behavior, the behavior is simply not specified. :pendant:

    Ahem...

    The Iterator protocol does not define behavior after None is returned.

    http://www.collinsdictionary.com/dictionary/english/undefined

    not defined or made clear

    :pendant: 2


  • Discourse touched me in a no-no place

    @Gąska said in Undefined OOP Techniques:

    There's no requirements at all, not even inside the universities - every lecturer can do what the fuck they want on their classes, arbitrarily define requirements for passing, and they're never, ever, ever held accountable for coming up with shitty curriculum.

    That's poor. We pretend we're good at teaching, and we do quite a lot of work to try to ensure that students actually learn things and to make the courses as good as possible. Including having both internal and external reviews. Bad teachers are encouraged to focus on other parts of their job, and if they can't teach, research or administrate, they won't make it past the next tenure review.


  • Winner of the 2016 Presidential Election

    @Gąska You're still wrong. Look up UB and unspecified behavior in the context of C++.

    This is a great example for unspecified behavior, it's not UB (=nasal demon territory).


  • Banned

    @asdf we're not talking about C++ - we're talking about Rust.


  • Discourse touched me in a no-no place

    @asdf said in Undefined OOP Techniques:

    This is a great example for unspecified behavior, it's not UB (=nasal demon territory).

    The UB comes when the compiler decides that the interpretation of the code (in Program B­) is to write off the end of the array. It's not the only interpretation (due to the more obvious unspecified behaviour) but it's a possible one and is where nasal demons might be invoked.

    The nasal demons I would anticipate here are something like a stack smash (or a critical compiler diagnostic). Stack smashes are not defined at all at the C++ language level, but what happens at the machine level is defined. It's Usually Very Bad as all sorts of things can get wrecked in unexpected ways. You can't really understand systems by only understanding one level of abstraction; anyone who thinks otherwise is being a bit foolish.


  • Winner of the 2016 Presidential Election

    @Gąska said in Undefined OOP Techniques:

    we're not talking about C++ - we're talking about Rust.

    Yes, but due to the popularity of C++, "undefined behavior" is now a technical term with a specific definition: It means that your code breaks assumptions the compiler/language specification makes, see Wikipedia. Allowing different behaviors in certain edge cases in the contract of an interface/trait is something entirely different from UB.

    Edit: To clarify:

    • Unspecified behavior: Either a certain set of behaviors is allowed, or the spec does not mandate a certain behavior at all. Which means that you cannot rely on a specific effect/return value, but the basic rules of the programming language still apply. In you example, you can still rely on the fact that next() will return either None or an element.
    • Undefined behavior: You break basic assumptions made by the compiler, so literally anything can happen (due to compiler optimizations etc.) and the resulting error may be a pain in the ass to debug.

  • Winner of the 2016 Presidential Election

    @dkf said in Undefined OOP Techniques:

    You can't really understand systems by only understanding one level of abstraction; anyone who thinks otherwise is being a bit foolish.

    Very true, but I'm not sure how that relates to my statement that @Gąska's Rust example is not an example of UB.


  • Discourse touched me in a no-no place

    @asdf You're the only person insisting on bringing up Rust.


  • Winner of the 2016 Presidential Election

    @dkf said in Undefined OOP Techniques:

    You're the only person insisting on bringing up Rust.

    ???

    @Gąska brought it up*, and then we started having a conversation about his post. You replied to one of my replies which was part of that conversation. So no, I don't insist in bringing up Rust, you just missed the context of my post.

    *Well, I mentioned Rust first, but @Gąska started talking about UB in Rust's standard library.



  • @asdf said in Undefined OOP Techniques:

    I had a maths professor who would continually try to come up with "more elegant" proofs than the ones in the textbook he based his lecture on. 50% of the time, he realized that his proof didn't prove exactly what he wanted to prove halfway through (i.e. after 30 minutes)

    To be fair, it is terribly satisfying to come up with a proof that's a lot more elegant than the one presented to you. As a student I improved on the ones we were given in lectures on a couple of occasions and committed the first deadly sin to rival Lucifer.

    I did, however, make sure it was right before telling anyone. And when I say improve, I'm talking about something like a page reduced to five quite obvious lines.


  • Winner of the 2016 Presidential Election

    @CarrieVS said in Undefined OOP Techniques:

    To be fair, it is terribly satisfying to come up with a proof that's a lot more elegant than the one presented to you.

    Hell yes. In my first semester, I managed to reduce a 2-page proof (official solution to an exercise we were given) to 4 lines by writing down the hypothesis as a predicate logic formula and transforming it into something we already proved (3 or 4 easy transformations). The formula was a bit ugly, which is probably why the prof didn't even think of it, but the proof was way easier. It felt awesome when I showed it to the prof.



  • @asdf My lecturer had just told the class that the proof we were about to do would be a long one and told us to take the customary break (it was a double lecture, IIRC) before starting it. Which caught me by surprise because I'd already done it in a handful of lines: printed lecture notes were normal at my university and usually followed 'fill in the blanks' format with spaces for proofs, and I sometimes got bored and went ahead to try and work out the next proof.

    So in the break I went and showed it to the lecturer and asked if it was right, and it was simple enough that he could see then and there that it was correct. So when everyone came back he told them that someone had shown him a shorter proof and did my proof for them all instead of his. Never got to see the long one.


  • Winner of the 2016 Presidential Election

    @CarrieVS said in Undefined OOP Techniques:

    Never got to see the long one.

    That's a shame, it's always interesting to see the more complicated approach. Sometimes, it even makes some kind of sense, for example if it was first written when the course structure was different and certain theorems had not been introduced yet at that point.



  • @Gąska said in Undefined OOP Techniques:

    But even if, it would be unfair to call him incompetent - it's more like he's just a bad coder with bad habits.

    Well, there should be a way to discuss the curriculum in the academic senate (I hope you have one and it includes student representatives) and try to refine it to cover more useful topics.

    @Gąska said in Undefined OOP Techniques:

    … every lecturer can do what the fuck they want on their classes, arbitrarily define requirements for passing, and they're never, ever, ever held accountable for coming up with shitty curriculum.

    Ah, that's bad. I mean, where I studied the curriculum was always responsibility of the teacher, but the academic senate (which had professor and student representatives in it) had power over what was required to get the degree, so with enough pressure it was possible to, say, replace a course with a more useful one. We had one such course in the first year (everything was mandatory in the first year, later there were just a few required courses), the pressure to get it replaced was already under way and it took couple more years to get anywhere, but it was at least not completely hopeless.


  • Winner of the 2016 Presidential Election

    @Bulb said in Undefined OOP Techniques:

    academic senate

    Pretty sure there's something like that at Gaska's uni as well. The problem is that they're usually not easily accessible to students, it took me a long time to find out that institution existed and you could actually tell them about problems.


  • Discourse touched me in a no-no place

    @asdf said in Undefined OOP Techniques:

    The problem is that they're usually not easily accessible to students, it took me a long time to find out that institution existed and you could actually tell them about problems.

    You ought to be able to speak to your tutor as well; they'd be the academic responsible for your overall education, and usually wouldn't be the person giving a particular course. They're more often involved where someone is in danger of having a mental breakdown, or where they're thinking of changing majors, but that's definitely not the only thing they do.


  • Winner of the 2016 Presidential Election

    @dkf said in Undefined OOP Techniques:

    tutor

    I didn't have one. At my former uni, only some faculties assign tutors to each student, CS was not one of them.


  • Discourse touched me in a no-no place

    @asdf So how did they handle the problems with students having a breakdown? Or did they just assume that the problem would go away until someone climbed a clock tower with a sniper rifle?


  • Winner of the 2016 Presidential Election

    @dkf said in Undefined OOP Techniques:

    So how did they handle the problems with students having a breakdown?

    They ignored it/hoped that people would just leave or switch universities themselves. Well, there was a "psychological service", but who the fuck emails an institution with that name and makes an appointment?

    Basically, the CS department didn't give a fuck about its students since there were so many of them. It sucked.


  • Discourse touched me in a no-no place

    @asdf said in Undefined OOP Techniques:

    Basically, the CS department didn't give a fuck about its students since there were so many of them.

    Well, that's a recipe for trouble. With a large enough student body (no, no :giggity:!) every year, some students will have a mental breakdown. It's a relatively common thing in that age bracket anyway, and university is often one of the first times that some young people have been pushed to really work. It's a sad truth that sometimes that makes people go to pieces. That can come out all sorts of ways, but some of those ways can involve hurting others…

    If the academics think they have no moral responsibility in this area, they should be ashamed for they will be BAD PEOPLE WHO SHOULD FEEL BAD. GRRR! This makes my blood really boil!


  • Winner of the 2016 Presidential Election

    @dkf And every year, they would wonder why so many people dropped out before getting their Bachelor's degree and how they could increase the number of Master's students. So far, no-one seems to have realized that the lack of individual care/support is their biggest problem. Hell, I would have almost dropped out myself due to anxiety issues and my grades were always great.



  • @asdf said in Undefined OOP Techniques:

    @Bulb said in Undefined OOP Techniques:

    academic senate

    Pretty sure there's something like that at Gaska's uni as well. The problem is that they're usually not easily accessible to students, it took me a long time to find out that institution existed and you could actually tell them about problems.

    We had general election to the student chamber each year, so while the campaigns were not big, enough was going on that everybody would know it exists and who at least some of the representatives are.


  • Banned

    @asdf said in Undefined OOP Techniques:

    Yes, but due to the popularity of C++, "undefined behavior" is now a technical term with a specific definition

    It's about as true as that you can't have Continuous Integration without unit tests. It's very close to reality, but we're having a pendant-off here, so we have to admit it's actually false - just like your statement.


  • Winner of the 2016 Presidential Election

    @Gąska said in Undefined OOP Techniques:

    pendant-off

    :justtdwtfthings.gif:


  • ♿ (Parody)

    @asdf said in Undefined OOP Techniques:

    That's a shame, it's always interesting to see the more complicated approach. Sometimes, it even makes some kind of sense, for example if it was first written when the course structure was different and certain theorems had not been introduced yet at that point.

    The problem with short proofs is that you probably don't see or understand the thought process that came up with it. Longer proofs tend to spell out more of the details and are often useful when you're learning.


  • ♿ (Parody)

    @asdf said in Undefined OOP Techniques:

    At my former uni, only some faculties assign tutors to each student, CS was not one of them.

    I have never heard of this practice. I mean, there were tutors, but either you arranged it privately or there was a regular schedule when people would be there to help whoever showed up or you went into your dorm lounge and asked for help or whatever.


  • Winner of the 2016 Presidential Election

    @boomzilla said in Undefined OOP Techniques:

    The problem with short proofs is that you probably don't see or understand the thought process that came up with it.

    The same is true for most longer proofs, only very few of them don't contain non-obvious tricks at all.



  • @asdf said in Undefined OOP Techniques:

    @boomzilla said in Undefined OOP Techniques:

    The problem with short proofs is that you probably don't see or understand the thought process that came up with it.

    The same is true for most longer proofs, only very few of them don't contain non-obvious tricks at all.

    ... using a short transformation we can easily see the trivial conclusion.

    This sentence from university contains three trigger phrases / words.


  • Discourse touched me in a no-no place

    @boomzilla said in Undefined OOP Techniques:

    I have never heard of this practice. I mean, there were tutors, but either you arranged it privately or there was a regular schedule when people would be there to help whoever showed up or you went into your dorm lounge and asked for help or whatever.

    There's two types of tutors. There's the type you describe, who deal with questions relating to the content of the course (and who may be TAs), and there's the kind we're talking about who are responsible for the overall academic progress of the student (and who are definitely academic staff). The latter role can usually look after a whole lot of students without much load; we tend to have one such academic per undergraduate year (i.e., a couple of hundred students).


  • Winner of the 2016 Presidential Election

    @boomzilla said in Undefined OOP Techniques:

    I have never heard of this practice.

    It can be very helpful to have some go-to-guy for your problems/questions. At my university, getting answers to even the simplest questions involved contacting three different organizations (plus standing in line somewhere or waiting for an appointment for weeks) which gave you three different, contradictory replies and/or told you to look it up in an official document that didn't even remotely answer your specific question.

    @boomzilla said in Undefined OOP Techniques:

    dorm lounge

    In Germany, pretty much everyone lives off-campus in shared apartments.


Log in to reply