Wednesday, February 15, 2006

Javascript program structure

Javascript programs can be structure in various different ways because it is one of the few languages that is both structured and object oriented. Some differences between structured and object oriented are the use of different terminology to describe the parts of our code. For example, in structured we have variables and in object oriented we have objects. In structured there are functions and in object oriented there are methods. However, in object oriented programming there are classes that contain the definitions for properties that objects belonging to this class will have and they are declared private. This means that the only way to change the value of these properties is through the public member functions declared in the class definition. By protecting the private variables, a programmer can avoid complications that arise in long programs like accidentally modifying the value of a variable. Object oriented programming still uses if statements and loops like structured programming but it contains them in methods belonging to one of the objects. This style of programming is much easier, clearer, and more powerful when dealing with a lot of code.

0 Comments:

Post a Comment

<< Home