#WSQ03-Object Oriented Basics

--Originally published at diegotc2016

Watching this video tought me about several things first, there are 2 types of programs:

  • Static: Java, C# and C++
  • Dynamic: Javascript, Python and Ruby

I also learned what is a class in OOP, a class is a  definiton of type of data which is defined by its members:

  • Field: Data member
  • Method: Function sociated with a class

In this video I also found an alternative meaning for object/instance which is piece of data.

Principles for OOP

The person that was speaking during this video told different principles for OOP

  1. Encapsulation
  2. Inheritance
  3. Class Members
  4. Interface

Encapsulation

Encapsulation can be defined by the fields of an object and class should only be read or written by the method of that class.

The mistakes you can make avoiding this principle is to have a spaghetti code which is a code that is very difficult to read or to understand.

Types of class

  • Public: can be manipulated or visible anywhere (inside or outside the class)
  • Private: only can be manipulated by the methods of its own class

Inheritance

A type  of class may include all members from another type. For example: Lets say we have Sebastian Vollmer, Offensive Line, Patriots. Sebastian Vollmer is inherts from the offensiveline and the offensive line inherts from the Patriots its an aoutomatic inheritance.

#WSQ03-Object Oriented Basics
New England Patriots tackle Sebastian Vollmer (76) in the second half of an NFL football game against the Pittsburgh Steelers Thursday, Sept. 10, 2015, in Foxborough, Mass. (AP Photo/Winslow Townson)

For using inheritance first you have to ask…It has a relationship or it is a relationship. For example: Sebastian vollmer is a member of the offensive line of the Patriots.

It is ok to have multiple inheritance but you have to follow certain rules in order to do it, what it is not legal is to use circular inheritance

#WSQ03-Object Oriented Basics

Overriding

It means to redifine an inherted metod

Class Member

Member of a class itself not its instances, for example: class.field or class.method(args)

Constructor

A method which is run when someone instanciates a class

Interface

A set of methods which are related one another.

Abstract Class

A class which cannot be intantiated, it works as an ancestor of other classes

Prototipical Inheritance

OOP without classes: producing child instances from parent instances

Design Patterns

Common ways of organizing patterns to solve different types of problems using programming.

Here’s the video:

 

 


#WSQ03-Object Oriented Basics

#WSQ01-Get Coding

--Originally published at diegotc2016

It was easy for me to do this WSQ, here’s what I did:

I downloaded Java JDK from this webpage at oracle.com:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html?ssSourceSiteId=otnes

I  downloaded Eclipse IDE from its official webpage (eclipse.org):

http://www.eclipse.org/downloads/

#WSQ01-Get Coding

I used this tutorial from youtube to download both Java and Eclipse:


#WSQ01-Get Coding