Topic |
Notes |
What is similar between OOP & Procedural
programming? |
Similarities of OOP & Procedural
(if they exist!)
- Class - is like a program.
- Method - is like a function.
- Primitive - is like a variable.
|
Class |
Class - is like a program.
- Hierarchy - Like having a program (super-program) in which other
programs (sub-program) can inherit all of its business rules and behavior, yet if the
super-program allows, the sub-program can change the behaviors it inherits from the
super-program without affecting the super-programs behavior. (WOW!)
- Abstract Class - Like a program you cannot run. However, it
is useful because you can force other programs to make sure they have certain behaviors.
- Final Class - Like a regular program. You just run it. However, no
one can inherit it.
|
Method |
Method - is like a function or
procedure.
- Static Method - a regular function that you can call. It exists
only once.
- Non-Static Method - a function that cannot be called unless you
make a program an object in memory. This function may exist more that once in memory.
(Scary!)
- Overloading - You can have more than one function by the same name
in a program if the parameters are different !
- Design, abstract & interfaces - In your program, you may be
forced to make a function with a certain name, parameters, and return values or your
program cannot be executed. If you want, you can make a function without any code in it
and require other programs to finish the code, without changing your program, or their
program cannot be executed.
- Overriding - If a super-program allows, a sub-program may change
the behavior of selected functions inherited from the super-program without changing the
source code in the super-program.
|
Primitive & Object References |
Primitives - is like variables.
- Primitive - basic variable types like: character, integer, double,
etc
- Object Reference - a variable (object reference) that points to a
location in memory where a program (object) resides. This program may be a String program
with many functions in it. You can create your own types of variables (objects). (Wow!)
Object - (non-static) is like a program that is in memory (a
class in memory). Once your program is in memory, you can run its functions. Your program
will make objects from other programs, so that you can run their functions.
Static - something that can be accessed without first creating an
object. These functions can be run like a normal function without making a program (class)
an object. |
Summary |
Do you find the similarity? If you don't, join the multitude that feels like they had to learn how to
crawl again!
(Tip: Java has bicycles. Don't forget how to ride them!) |