Be objective…(badum-ptss)

--Originally published at Juan Salvador Fernández Contreras

So far POO has been pure rage for me, since I didn’t really get how to actualy write code and organize my ideas correctly for the object oriented style, at least until last week.

You see, this semester i’m taking Digital Systems, and last class we were introduced to some magical stuff, not weed… VERILOG!

My mind was blow away, since I was able to instantly relate the concepts needed for coding actual electronic modules (ADDER, OR, AND, XOR, etc…) with the ones needed for the object oriented way of thinking.

I  still need to meke the “196”and the “Movies” WSQ’s, and I will try my best to do them on my own, since the three previous ones where a colabolarive efford of my friend Gerardo Cruz and mine.

So yeah, things are looking “not as dark as they where”.


Be objective…(badum-ptss)

Everything in Java is an object #WSQ03

--Originally published at My Programming Course

In this WSQ I had to watch a video in where it explains how an object oriented lenguage works.

https://www.youtube.com/watch?v=lbXsrHGhBAU

In my opinion or my thoughts, seen everything as an objects will help you saving code, you can save every object in an array and everything will be organized. This programming method opens so many doors and there are many ways you can use it.

The video shows a lot of concepts, I think that the one you have to put a bit of effort to get it is the Ancestors and socesors one, when a code can Inheritate information from another one.

You can learn a lot of things from the video like setting up a constructor and lots of helpful information that we are gonna need in the future as the course goes on.

Everything is an Object!

Everything is an object!

#WSQ03

--Originally published at Jsph's Blog

I already watched this video…

and I can say this

“Object-oriented programming (OOP) is a programming language model organized around objects rather than “actions” and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data” (Rouse, M. 2008).

Using oriented programming is very useful if we want to create specific or complex programs because in Java we can create objects that the programmer can manipulate and how they relate to each other.

I think the most important is identify the main characteristics of object oriented programming:

Class definitions – Basic building blocks OOP and a single entity which has data and operations on data together

Objects – The instances of a class which are used in real functionality – its variables and operations

Abstraction – Specifying what to do but not how to do ; a flexible feature for having a overall view of an object’s functionality.

Encapsulation – Binding data and operations of data together in a single unit – A class adhere this feature

Inheritance and class hierarchy – Reusability and extension of existing classes

Polymorphism – Multiple definitions for a single name – functions with same name with different functionality; saves time in investing many function names Operator and Function overloading

Here’s the source: http://www.careerride.com/oops-characteristics.aspx

First of all we need to understand this concepts perfectly to be able to program with objects.


#WSQ03

#WSQ03 Object-Oriented Basics

--Originally published at Fernando Partida's Blog

Oh My God! She’s so basic…

Excuse my attempt of using popular american slang…

So I watched the video about the basics of OOP (Object Oriented Programming), and did my best to understand the whole contents of the video. One thing i did like a lot was the inheritance section. I do think using inheritance could probable save up a lot of time when programming and it could also lead to having a code with less errors within it.

The is-a and has-a relations were really simple. As one can determine that a SNES has game cartridges meaning that games are not inherited from the SNES, whilst the SNES is a Nintendo console then it can be said that the SNES does inherit from Nintendo.

#WSQ03 Object-Oriented Basics

 


#WSQ03 Object-Oriented Basics

#WSQ03 -Object-Oriented Basics

--Originally published at JAVALIO

Object-Oriented Programming is a new thing for me, I was expecting to get the concepts in the first round, however I haven’t learned enough about objects, classes, methods, abstraction, etc. but I think it is just a matter of time, if I keep learning, someday I will master OOP.

Even thought I learned something watching this video:

For example:

There exists static and dynamic languages and differ in when do the language check the type data.

Classes are basically like a data definition.

Objects are instances of the classes

Methods are like the functions of the classes

And polymorphism that is how Java knows what method invokes depending on the object.

 

I recommend you to watch this video, in order to understand a little bit more about Java stuff


#WSQ03 -Object-Oriented Basics

WSQ03 – Object-Oriented Basics

--Originally published at finntc2016

After watching this video I know a lot more about the concept of object-oriented programming (OOP).

Working with objects is quite different from procedural programming. In many cases it’s more useful for developers since it’s closer to real life problems.

Furthermore I learned about some terms and concepts such as:

  • Static / dynamic typed languages:
    • static: Do type checking at compile-time (e.g. Java, C#, C++).
    • dynamic: Do type checking at run-time (e.g. Python, Javascript).
  • Classes: Basically a data type definition, made of its members, the fields and the methods
  • Objects: Instances of classes
  • Encapsulation: The fields of an object should only be read and written by invoking the methos of this class. If you follow this principle, the code gets easily modifiable. If not, you soon get “spaghetti code”.
  • Public / private members of a class:
    • Public members can be accessed by methods from other classes.
    • Private members can only be accessed by methods of the same class. If you want to follow the concept of encapsulation strictly, all fields of a class should be private.
  • Inheritance:
    • If the class a  inherits from class b, and b inherits from the class c, then b contains all members of c and a all the members from b (and therefore also the members of c).
    • a and b are subtypes (or descendants) of c. b and c are supertypes (or ancestors) of a.
    • Direct subtypes are called childs. Direct supertypes are called parents.
    • Inheritance is used between classes that have a is-a relationship. Not a has-a relationship. (E.g. a cat is a kind of a mammal.)
    • Some programming languages allow multiple inheritance.
    • If an ancestor has the same method than one of his ancestors, it get overwritten, so that the methods  can be made more specific for the subclasses.
  • Polymorphism: The choice of the method being invoked depends on the object which is chosen as an argument.
  • Class members: Members of the class itself and not of its instances. In Java they’re called static members. There are reasons for them to exist, but using a lot of those members is not object-oriented.
  • Constructor: Method which is run in order to set up an instance of a classes. How he looks like is context dependent.
  • Interface: If there are different classes which are not related but share the same set of methods in common, an interface can be created to form a bundle of methods which can be used by those classes.
  • Abstract class: A class that just serves as ancestor for other classes and which is not meant to be instanciated itself. (E.g. it doesn’t make sense to instanciate the class “mammal” because there is no “the mammal”.)

WSQ03 – Object-Oriented Basics

WSQ03 – Object-Oriented Basics

--Originally published at finntc2016

After watching this video I know a lot more about the concept of object-oriented programming (OOP).

Working with objects is quite different from procedural programming. In many cases it’s more useful for developers since it’s closer to real life problems.

Furthermore I learned about some terms and concepts such as:

  • Static / dynamic typed languages:
    • static: Do type checking at compile-time (e.g. Java, C#, C++).
    • dynamic: Do type checking at run-time (e.g. Python, Javascript).
  • Classes: Basically a data type definition, made of its members, the fields and the methods
  • Objects: Instances of classes
  • Encapsulation: The fields of an object should only be read and written by invoking the methos of this class. If you follow this principle, the code gets easily modifiable. If not, you soon get “spaghetti code”.
  • Public / private members of a class:
    • Public members can be accessed by methods from other classes.
    • Private members can only be accessed by methods of the same class. If you want to follow the concept of encapsulation strictly, all fields of a class should be private.
  • Inheritance:
    • If the class a  inherits from class b, and b inherits from the class c, then b contains all members of c and a all the members from b (and therefore also the members of c).
    • a and b are subtypes (or descendants) of c. b and c are supertypes (or ancestors) of a.
    • Direct subtypes are called childs. Direct supertypes are called parents.
    • Inheritance is used between classes that have a is-a relationship. Not a has-a relationship. (E.g. a cat is a kind of a mammal.)
    • Some programming languages allow multiple inheritance.
    • If an ancestor has the same method than one of his ancestors, it get overwritten, so that the methods  can be made more specific for the subclasses.
  • Polymorphism: The choice of the method being invoked depends on the object which is chosen as an argument.
  • Class members: Members of the class itself and not of its instances. In Java they’re called static members. There are reasons for them to exist, but using a lot of those members is not object-oriented.
  • Constructor: Method which is run in order to set up an instance of a classes. How he looks like is context dependent.
  • Interface: If there are different classes which are not related but share the same set of methods in common, an interface can be created to form a bundle of methods which can be used by those classes.
  • Abstract class: A class that just serves as ancestor for other classes and which is not meant to be instanciated itself. (E.g. it doesn’t make sense to instanciate the class “mammal” because there is no “the mammal”.)

 


WSQ03 – Object-Oriented Basics

OO Basics

--Originally published at richardctc201

Today we finally finished seeing the video of Object Oriented Basics. Due to the amount of work I had to do, and the fact that my attention wasn’t the best in class, I had to take a second look to my video at my house.

I think that there were two crucial things that the video pointed out: static/dynamic objects or programming and the terms that I had already discuss in past posts such as inheritance and encapsulation.

Beginning with static and dynamic programming, the video said that there are static programming languages such as java, c++ and c#; in the other hand there are dynamic languages like javascript, python, and ruby. The difference between this two terms resides in whether the code need to be compiled before running. If the platform has a compiler then we’re talking about a static programming type because the program needs to be checked for correctness. In languages like Python, there is no compiler because it is a interpreted language, or in our terms, a dynamic language type because the code is not checked before running and if there’s a mistake the output would show it.

The other important stuff is the inheritance between classes, and I specially liked this video because it uses excellent examples that clearly shows how objects relate and can inherit methods and fields.

With this video, the topic of Object Oriented Programming seems to be clearer, so I think it’s a good moment to go and have some fun giving a try to the wsq’s that involves coding!

OO Basics
Google Image photo by Brian Will https://i.ytimg.com/vi/ibXsrHGhBAU/maxresdefault.jpg shared under reutilization license.

 

OO Basics

 

 


OO Basics

WSQ03 – Object-Oriented Basics

--Originally published at Alan TC201

First info taken from my previous Blog post. http://wp.me/p77XRU-u

WSQ03 – Object-Oriented Basics

Objects: Objects have states and behaviors, for example a car has stats like color, form, name and behaviors would be how fast it goes or how many gasoline it use.

Software objects also have a state and behavior. A software object’s state is stored in fields and behavior is shown via methods.

In software development, methods operate on the internal state of any object and the objects communicate by methods.

So in resume a method has a bunch of statements inside, and methods are what gives objects its particularities.

Class: A class is like a box that has inside has methods and those methods are affecting the objects inside the class

WSQ03 – Object-Oriented BasicsWSQ03 – Object-Oriented Basics


 

“Encapsulation”
Now after all this information we can dig more in terms of Java programing, first of all, the term “encapsulation”.
This means that, to have a better program, that is easy to read, to understand and fix the classes need to be private, so that the methods of a class only affect the data or the objects inside that class.

WSQ03 – Object-Oriented Basics

Inheritance”
Other term that plays in Object-Oriented programming is inheritance”, this term tell us that we can “link” or transfer different methods between different classes that have similarities in them and use the same methods besides they use particularly methods. This helps to not duplicated methonds in diferent clases that have methods in commun.

If we couldn’t use Inheritance we will have to specify each method in each class we will have to explicit define each method in each class individually.
Multiple Inheritance means that a class have common things between two classes but those two classes don’t have Inheritance between them.

BUT BE CAREFUL, YOU DON’T CIRCULATE AN INHERITANCE, this means that a class cannot inheritance from itself, like a circle.

Overriding means that you could have different classes chain together and inheritance from the top one. For example, we have class, and we have a method call MON in the class V, normally all the classes below but if we have a method also call MON in the X class the the classes below X will inheritance the MON from the x class.

V – MON
W – MON FROM CLASS V
X – MON
Y – MON FORM CLASS X
Z – MON FROM CLASS X

Intarface is a set of methods that can have commun things inside different classes.

WSQ03 – Object-Oriented Basics

Here’s a video that explains everything with better examples.


WSQ03 – Object-Oriented Basics

#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