JavaScript Thingy (Client
Side Programming)
Client Side Programming (JavaScript is unavoidable)
Browser
Internet (World Wide Web)
Server
Side Programming
PHP or Similar
JavaScript is an Object Orientated Design (OOD) writing in
JavaScript is known as Object Orientated
Programming (OOP).
Javascript has a syntax very similar to the C programming
language just like PHP although C and
PHP are
not OOD programming languages! Classes contain Objects and
variables in the case of classes these
variables would be global variables available everywhere and to
everyone. You would use global variables when you want all objects in
the class to have access to it and that means anyone anywhere can
change it providing no security at all to its contents. These variables
can also be called
"constants" this is where they're read only variables and can't be
changed but still anyone anywhere can access their contents. There is
only one type of variable in JavaScript and PHP in C there are
many and this is deliberate! Objects
have three attributes: properties, methods and events. Properties are
the same as object level variables which means they are only seen to
the object and those within it outside of the object you would need
get/set methods to
change these variables global varaibles however can be
set
anywhere by anyone! Security can be added to these get/set methods
which is not possible in global variables. Methods are the same as
functions and procedures
are the same as sub routines everywhere there isn't any
difference! There are four types of classes but it's
the same for the objects inside those classes too a class can contain
many objects an object is generally inside a class! The first type of
class is
your
general purpose
type, you create as many as you want, you can delete
them if you want you can have them inherit others even
extend their functionality if you
want there are no restrictions or limitations on those classes!
Abstract Classes or Interfaces do not have instances creating
these is
not possible other classes or objects inherit these and extend their
functionality that is how they work they're often used to enforce
a type of design. If a programming language
uses Interfaces like
JavaScript Multiple Inheritance is irrelevant as
Interfaces
provide an alternative to Multiple Inheritance. C++ and PHP both use
Multiple Inheritance which you really should avoid using where
possible! Multiple Inheritance allows you to inherit more
than one object or class at
the same time without restriction or limitation. Imagine you have a
system
with
a office in London, New York and Sydney. Each of these offices have an
Accounts
object. Multiple Inheritance will allow you to inherit the Accounts
objects of
Sydney, New York and London in one object at the same time! This
may not
seem like a problem at first until you realise they all have a Scott
Middleton in their
accounts object
and they're not all the same Scott Middleton! Now you're going to
corrupt
that record when you make a change to it! You see, that change will be
made to every object that contains Scott Middleton they are
not all the
same person corrupting all of them except the one you
wanted to
change. The reason Abstract Classes (Interfaces) get around this is
that every accounts object isn't an accounts object it's an
extension
of it and yours has to be built to the same specification!
You don't access the
accounts
object because it's Abstract you access the extension of the
Abstract like
newyork.accounts,
sydney.accounts or london.accounts for example. If you
were to inherit the accounts object in your object when its
Abstract you're
just
creating
another extension of it: myobject.accounts getting around the
problem! Protected
objects are objects with only one instance permitted multiple
instances are forbidden the Document, Navigator
and Window objects/classes in the JavaScript programming language are
examples of
protected
Classes/Objects there can only be one version of it at a time!
Static/Absolute objects/classes can not be destroyed
most IDE's (Integrated
Development Environments) will create one Static/Absolute
class/object for
every new project by default and it can't be deleted without
deleting the project!
JavaScript
Window Object
Console Object
Document Object
History Object
Location Object
Navigator Object
Screen Object