Preparing for partial 2 “exam”

Well, here I am… doing stuff, I want to sleep, but whatever, who needs that?

I do… I really should…

Here we go:

What are inheritance and polymorphism? (Specification and implementation)

  • Inheritance: When I think of inheritance, I think of the keyword “extends”, you know, that thing you put at the new class, when you want it to have all of the superior classes methods and attributes. That is inheritance.
  • Polymorphism: Now, this gets more complicated. It is to inherit a method from a superclass, but only to mostly have it modified in the subclass or in the same class (Overloading and overwriting).

What are overloading and overwriting? How do we implement those in Java?

  • Overriding: It is dynamic because its made between a hierarchy of classes. It implies that the method in the current class is the one being initialized (even if super classes have the same named method). The only way to get the supermethod also initialized is to write super.methodname().
    class Car { makeNoise(System.out.println(“Bruum”))}
    subclass Ferrari { makeNoise(System.out.println(“Big lousy bruum”))}
    Final output: Big lousy broom
  • Overloading: It is static because it can be done in the same class. It ocurrs when two or more methods have the same name, but different arguments (Type or quantity).

What is delegation?

  • To call another method, or even another class to do your chores (Instead of doing it by itself).

What are CRC cards and how do we use them?

  • Stands form Class Responsibility Colaboration. Used to stated how classes work. Its a design that answer to what and with whom the job will get done.

What do you feel are the benefits to object-oriented programming?

  • It provides the tools to create everything! Seriously. As always, if you consider that everything is an object, that means that, to some extent, you can create anything as long as it has characteristics and functions. If it isn’t sufficient to you, because you want still something more specific, you can overwrite and overload until you get exactly what you want.

Why do you think your change to object-oriented programming is difficult or what makes it difficult for the standard student?

  • I really like the way my dear friend Arturo explained it. I guess I would explaine it as he has done it (The analogy with math dimensions -Luzma’s 4th dimension is really hard- its nice. And also, today I saw Interstellar, so he should add the 5th dimension to his explanation).
    The most difficult for anyone I guess it is the change from simple straight code to a more complex context. In OOP there is no room for code without order. You have a class, with a constructor, several methods, and a main method if needed. Then you have the arena (As defined here) were the objects are created with the required characteristics and do the required stuff. And then you have other classes that contain other objects and you need to find a way to get everything connected without making Java explode, or yourself.

Like a dear YouTuber would say (Jake Roper Vsauce3’s host). I guess I’ll stick to this until I have a proper way to end my posts:

“But remember my dear friend: Its not good-bye, oh no, its never good-bye, its… see you later (you’re pretty darn awesome)

-Miguel

 

 

Anuncios