Biased professors teaching antiquated crap

This is a discussion on Biased professors teaching antiquated crap within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Is this a recurring theme in college? In my data structures class (in Java, which is fine by me, memory ...

  1. #1
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141

    Biased professors teaching antiquated crap

    Is this a recurring theme in college?

    In my data structures class (in Java, which is fine by me, memory management is a hell of a lot easier when you don't have to free memory), the teacher said a few things that I thought were off.

    First, he talked about using vectors in java, despite how they are now deprecated in the API (ArrayLists are now preferred). Second, he described bools in C++ as "just an enumeration." (although they may have been implemented that way years ago in bool.h, that is before my time) I believe they are as much a part of standard C++ as booleans are of Java. Finally, he said a code fragment like this would cause a runtime error (this is java), like a hanging reference in C/C++ (returning a pointer to a variable on the stack in a local function).

    Code:
    static int func() {
    		for (int i = 0; i < 10; i++);
    		return i;
    }
    I instead thought it would be a compile time error, as i is simply out of scope, to which he responded "That would be nice, but I don't think it happens that way." On my compiler, indeed, it causes a compile time error.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  2. #2
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I don't see anything wrong with this in terms of C/C++

    Code:
    int func() {
    		for (int i = 0; i < 10; i++);
    		return i;
    }
    
    int main()
    {
    	int i = func();
    	printf("%d",i);
    	return 0;
    }
    Must be different in JAVA?
    I compile code with:
    Visual Studio.NET beta2

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I have a book that a professor at Rutgers written

    It has a typo on the third word, it's still great book though!
    Very well written, at least the first two chapters, unlike some text books.

    Professors at all schools have varying knowledge. Teaching java might be new to your school or the instructor is new to java.
    I would hate writting that long ArrayList too! I wouldn't worry
    about minor details but if the proffessor really can't teach...

    I think pretty much bools behave as

    Code:
    enum bool {
          true = 1,
          false = 0
    };
    I think bools have been standard types since the 1997 c++ standard.

  4. #4
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    He's probably using a older version of java, hence the
    deprecated warnings.

  5. #5
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    int func() {
    for (int i = 0; i < 10; i++);
    return i;
    }

    It's a scope error in ANSI C++. You don't realize it, because you use the wonderful Microsoft compilers, which the nonstandard for scope.

    int func() {

    for (int i = 0; i < 10; i++) {
    // By the standard, i is limited to this scope
    }
    // Using MSVC, i is in this scope
    return i; // legal in MSVC, illegal for standard compiler
    }

    I was trying to refer this (least legal to compile) C/C++ runtime error which the professor was trying to explain that simply does not exist in java.

    int* func() {
    int i = 10;
    return &i;
    }

    About the deprecated thing.... It's pretty saddening. The guy gets paid to lecture about data structures and is using deprecated data structures himself.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  6. #6
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I'm glad I have a good compiler. I don't have to put up with nonesense. I still don't think it's scope is the loop though because it is only defined once.

    MSVC? Whats that?
    Last edited by Witch_King; 09-08-2001 at 12:31 AM.
    I compile code with:
    Visual Studio.NET beta2

  7. #7
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Admittedly, MSVC is the friendliest IDE I've used. Still, it's standard support is crap.

    http://www.flipcode.com/cgi-bin/msg....rum=totd&id=-1
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  8. #8
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I don't use MSVC because your right, it's standard support isn't good enough, that's why I use VS.NET. Much better IDE than MSVC and full standard support.
    I compile code with:
    Visual Studio.NET beta2

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    It depends on how old your C++ compiler is, and whether it is designed to implement the old or new C++ standard.

    Code:
    int func() {
       // code
       for (int i = 0; i < 10; i++);
       return i;
    }
    In the old C++ standard, the scope of 'i' was the rest of the function, as if you had done...
    Code:
    int func() {
       // code
       int i;
       for (i = 0; i < 10; i++);
       return i;
    }
    The new C++ standard tightened up the rules a bit, and specified that the scope of 'i' is just the for loop.
    Code:
    int func() {
       // code
       {
          int i;
          for (i = 0; i < 10; i++);
       }
       return i;
    }
    For instance, I get a warning when I compile this function, but it otherwise compiles fine. You should at least get a warning from the compiler if it's supposed to meet the latest C++ standard.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I could run the code as managed code using the CLR or else as unmanaged code. Unfortunately I have not had time to figure out which menu choice I need to select to turn on the controls for managed code, infact I have not needed to use that yet because I'm just studying the language, but in the future I'm likely to write all my code that way.

    You know full well that you can set the warning level. God damn, where is that button? Aww, I'm going to sleep. I'll look into it when I get up.
    I compile code with:
    Visual Studio.NET beta2

  11. #11
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    I don't use MSVC because your right, it's standard support isn't good enough, that's why I use VS.NET.
    VC++.NET still allows the non-standard use of variables outside the for loop (at least the beta does).

    The way they've implemented it differently than VC6.0 though and now anything goes, you can redeclare variables outside the for loop even though they are still considered to be in scope after the loop has completed, so code like this compiles on the highest warning level without a murmur from the compiler -

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main() 
    { 
    	for (int i=0;i<10;i++)
    	;
    
    	for (int i=0;i<20;i++)
    	;
    
    	cout << i;
    
    return 0;
    }
    I think Microsoft probably allow this kind of thing so that code written to the standard will compile and old code will not break, but I think it should generate a warning at least.

    Even though support for the newer standard seems to be there, it still doesn't work as in this example -

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main() 
    { 
    	int i =100;
    
    	for (int i=0;i<10;i++)
    	;
    
    	for (int i=0;i<20;i++)
    	;
    
    	cout << i;
    
    return 0;
    }
    'i' is overwritten by the 'i' in the loop. This does generate a warning message though but I don't no any other compiler (inc VC6.0) that would let this go. VS.NET is still in beta though, so I suppose this may change.

  12. #12
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    I have not been hindered yet by VS.NET at least not when solving bigger issues. I do have enough patience to understand my compiler. I don't intend on using any other compiler.

    It sounds like that teacher isn't too terrible. If you think that's bad than you are in for a shock. Take a subject like physics for example. Wait till you get a physics teacher that doesn't know what he/she is doing! If you know more than them than don't worry about it. Do not try to correct them but instead keep it to yourself and study the book. Those teachers are not there to teach the newest and the best techniques. They are hired by the government to make sure that students meet a certain level of standard, not the highest level. If you try to correct them too much than you will not enjoy the class. Take it as a chance to continue to study on your own because shortly after you are done you will have to work and there won't be any time like there is now to study independantly.
    Last edited by Witch_King; 09-08-2001 at 11:17 AM.
    I compile code with:
    Visual Studio.NET beta2

  13. #13
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    I am taking physics as well, but I had already taken AP Physics (looking at the syllabus, I know probably 80-85% of matieral already, but I am weak with waves, and taking the next class without a completely solid base is probably not a good idea). The physics teacher is good though. He said nothing during the first lecture that had a hint of being wrong, and knew a LOT of stuff I didn't.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  14. #14
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    The worst case is when you have a teacher that doesn't speak english. I mean that. Somehow they get the job. I once had a physics teacher that didn't know what he was doing. The lectures were junk but he than made the midterm and final really easy to make up for the fact that nobody understood what was going on. Only in a big school.
    I compile code with:
    Visual Studio.NET beta2

  15. #15
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Yeah, that could definitely be a problem. Fortunetely, all my professors thus far speak English well.

    We have recitations (smaller classes with a TA) once a week which are supposed to help offset having professors like that. But yup, I hope I don't get any professor's who can't really speak English.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21