Classes and objects - please explain

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Stuckle

    #16
    Re: Classes and objects - please explain

    whiskey wrote:
    Technically speaking, in JavaScript you don't have classes, but only
    objects. Remember that it is a prototype based language.
    Anyway, JavaScript won't help you much with understanding classes and
    objects. Read some OOP books. But before you do, teach yourself some
    procedural programming. Because *some* ain't enough. And, in the end,
    most of the time you don't actually need OOP to go from A to B.
    >
    No, you don't *need* OOP. But you don't generally *need* structured
    programming, either. You can do quite well with spaghetti code.

    However - OOP is a means to build code that, if properly designed, is
    more reusable and more maintainable.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Jerry Stuckle

      #17
      Re: Classes and objects - please explain

      whiskey wrote:
      All this explanations, OOP at a glance, seem futile to me. OOP ain't
      that simple. So a book is recommended. Not only about classes and
      objects, but about interfaces, inheritance, polymorphism, and so on and
      so forth. I'm working with classes and objects for 3 years now and I
      still have problems with object oriented thinking.
      >
      And books, well... I can't think of a suggestion. My first language was
      C++, and my first OOP steps were from "Jamsa's C/C++ Programmer's
      Bible". The rest is history :-D
      >
      And, btw, cyk...@hotmail. com, learn a true programming language (not
      JavaScript), such as C or C++, start with the beginning (procedural
      programming) and then think of OOP. It's not something you learn in 24
      hours.
      >
      OOP is quite easy - but it's a different way of thinking. And the longer
      you've been doing procedural programming, the harder time you'll
      probably have getting a handle on it.

      Simply put, variables have states (values). Functions have behavior
      (they do things). Objects have both states and behavior. You can save
      one or more values in it (depending on how it's designed) and it has
      behavior as defined by its public function.

      Really, even an integer can be considered a class. You can instantiate
      it to get a variable (object). It has state (it's value) and behavior
      (add, subtract, etc.). Classes are just a way of extending what the
      language predefines into something the programmer can define.

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Jerry Stuckle

        #18
        Re: Classes and objects - please explain

        whiskey wrote:
        Pedro Graca wrote:
        >
        >>JavaScript /is/ a true programming language
        >
        Sure it is true, rather a true *scripting* language.
        One friend o'mine once said: "Life's hard without pointers..." :-)
        >
        Rafe Culpin wrote:
        >
        >>But it assumes existing knowledge of PHP and of procedural programming.
        >
        Of course, that's what I'm trying to say. Learn to do it in a
        procedural way, and then start to better organise your application as
        whole by using an OO aproach.
        >
        Don't let the "script" in Javascript fool you. Javascript is as much a
        scripting language as PHP. Both are interpreted - one by the browser,
        one by the server.

        And yes, Javascript is a true programming language. OTOH, HTML is a
        true scripting language.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        Working...