JAVA kicking and screaming


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: JAVA kicking and screaming

  1. #1
    Join Date
    Jun 2003
    Posts
    3

    Angry JAVA kicking and screaming

    I have acquired a little knowledge of Pascal and C and C++.... enough to do simple programs with simple functions..... like showing the times tables-- showing a a menu and acting on input........ adding/totaling etc...... nothing really heavy or advanced ( heck, not ever intermediate!) --- now I have a chance to teach a course on Intro to Programming but they want it using JAVA!
    OH NO- I don't have an idea what a class or an object is. I've programmed for a years in those other languages and never needed an object or created a class.... so what am I to do.
    Each and every textbook I peruse seems to subscribe to the same geek code of explanations--- "the languguage is ideally suited for designing and manipulating objects. and you define clases that describe the nature of these objects." I mught be super dense -- and can't think in the abstract- I can't get a handle on what an object is and what I need classes of them!

    H E L P put this in a language a middle school student can understand ( and not one who just happens to be the son of a programmer) !
    How 's that for your challenge of the day ( and you thought teaching was soooo easy! )

    Best regards - thanks ahead of time ... please post here and copy to quickclick@optonline.net
    Try to avoid becoming roadkill on the information superhighway!

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    You've programmed in C++ and never created a class? ok....

    I'm not sure what you mean by 'Middle School', but I would suggest that it would be pretty difficult to teach Java to anyone much younger than 16. In our computing class we were taught Pascal and still a good proportion of the class could barely get it.

    I'm not quite sure how much you understand, but here's my Java 101 explanation of classes and objects:

    Classes are like blueprints. Like blueprints, they describe how to build something. An example of a class is:
    Code:
    class Building {
    
      String name;
    
      public Building(String buildingName) {
        name = buildingName;
      }
    Objects are the the results of what you get from building using the blueprints. The following code creates a new building with the name "London Tower":
    Code:
      Building b = new Buliding("London Tower");
    Hope this helps,

    ArchAngel.
    ArchAngel.
    O:-)

  3. #3
    Join Date
    Jun 2003
    Posts
    3
    Many thanks for your kind reply -- the example was well thought out and indeed helped explain how to create a building class --- and why it's public. C++ Just lets me create a string variable called name and I use a getline to help fill it from a keyboard prompt+input. Nice , straightforward - but perhaps not as versitle? I just don't understand WHY were making this class-- is it to make new buildings all with the same dimensions or characteristics... is that the blueprint ? The class seems to be the general characteristics while the object seems to be an example of a particular class thing... or am I still way off?
    Those who think teaching is easy -- probably never had a student like me! I glanced at several INTRO books and they are all written by the same clique of egghead programmers -- who speak a language unto themselves. Thanks for trying to conceptualize the conept for me. I'm still searching for that elusive bright light!
    Try to avoid becoming roadkill on the information superhighway!

  4. #4
    Join Date
    Mar 2003
    Posts
    834
    I'm glad the example helped.

    Why create classes? Using the metaphor, you're pretty much right - it's for creating more buildings. In Java-speak, we call objects "instances". They are "instances" of a class. The slight difference is that each instance can differ in the data which it holds:
    Code:
      Building b1 = new Building("London Tower");
      Building b2 = new Building("Millenium Dome");
      Building b3 = new Building("Winsor Castle");
    Here you can see that the object's 'name' variable will end up holding "London Tower" in the first instance, "Millenium Dome" in the second and "Winsor Castle" in the third.

    With regard to calling the method 'public', I didn't have to. 'public' is what is known as a "visibility modifier". Don't worry about it for the moment, the class could have simply been defined:
    Code:
    class Building {
    
      String name;
    
      Building(String buildingName) {
        name = buildingName;
      }
    ArchAngel.
    O:-)

  5. #5
    Join Date
    Mar 2003
    Posts
    84
    I don't believe this guy's story.
    I'm surprised more of you people don't get hit by cars.

  6. #6
    Join Date
    Mar 2003
    Posts
    834

    Question

    Fantik, you're such a trusting soul! Why?
    ArchAngel.
    O:-)

  7. #7
    Join Date
    Nov 2002
    Posts
    138
    ya, everything is under one base class. so if you have made something from C++ w/c is OOP, then you've already made a class w/out knowing.

  8. #8
    Join Date
    Mar 2003
    Posts
    834
    Huh? What are you talking about?
    ArchAngel.
    O:-)

  9. #9
    Join Date
    Nov 2002
    Posts
    138
    well he says he hasn' t made a class yet, ever. C++ is a "class" oriented lang. so if he's programmed something using it, then he's made a class. right?

  10. #10
    Join Date
    Mar 2003
    Posts
    834
    No. An object-oriented language (I won't bother with the arguments about C++ being a complete Object-oriented hack), does not automatically result in object-oriented programming. For example (my C++ is a little rusty, so excuse small mistakes), the following is a valid C++ program:
    Code:
    #INCLUDE <io.h>
    
    main() {
      cout << "My first C++ program" << endl;
    }
    Not very OO is it?
    ArchAngel.
    O:-)

  11. #11
    Join Date
    Nov 2002
    Posts
    138
    ok, whatever....i still don't believe it. hehehe...that makes 2 (fantik) of us, huh?

  12. #12
    Join Date
    Mar 2003
    Posts
    834

    Wink

    sigh...
    ArchAngel.
    O:-)

  13. #13
    Join Date
    Nov 2002
    Posts
    138
    oh, i seem to have forgotten that C++ is OO and still support traditional programming, like C. my mistake. hehehe....

  14. #14
    Join Date
    Mar 2003
    Posts
    834
    I said I wouldn't do the rant "C++ is not a proper OO language"...so tempted....
    ArchAngel.
    O:-)

  15. #15
    Join Date
    Mar 2003
    Posts
    84
    C++ is not an OOPL.

    I'm backing Arch here..


    I wasn't sayghing anything about C++ before when I said I didn't believe him...

    I was saying I think this guy is lying about teaching middle school kids java and how he doesn't understand a class but he's programmed in C++ before..

    I just think he's lying about this whole thing.
    I'm surprised more of you people don't get hit by cars.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center