Concept Summary – Study Guide

--Originally published at chozaoop

Hey there, this post will be about reviewing the concepts which will be featuing in the second partial exam of #TC201, check it out.

Inheritance and Polymorphism were already posted here.

I’ll be taking information from various internet websites and then link the source below.


“Delegation is like inheritance done manually through object composition.”

It is a technique where an object expresses certain behavior to the outside but in reality delegates responsibility for implementing that behaviour to an associated object.

Delegation is an abstraction mechanism which centralizes object (method) behaviour.

You can use the delegation pattern when you need to reduce the coupling of methods to their class, you have components that behave identically, but realize that this situation can change in the future.

Or in general: use delegation as alternative to inheritance. Inheritance is a good strategy, when a close relationship exist in between parent and child object, however, inheritance couples objects very closely. Often, delegation is the more flexible way to express a relationship between classes.

Now check this image and this code evolution.

Concept Summary – Study Guide

Concept Summary – Study Guide

All the information, concepts, images and snips were taken from this SOURCE.



I think we should have already watch a video about CRC Cards in this course (the bald guy course). Really useful by the way, nevertheless, here’s some other stuff.


A class represents a collection of similar objects. An object is a person, place, thing, event, or concept that is relevant to the system at hand.
A responsibility is anything that a class knows or does.
You should ask yourself what a class does as well as what information you wish to maintain about it. You will often identify a responsibility for a class to fulfill a collaboration with another class.
A class often does not have sufficient information to fulfill its responsibilities. Therefore, it must collaborate (work) with other classes to get the job done. Collaboration will be in one of two forms: a request for information or a request to perform a task. To identify the collaborators of a class for each responsibility ask yourself “does the class have the ability to fulfill this responsibility?”. If not then look for a class that either has the ability to fulfill the missing functionality or the class which should fulfill it. In doing so you’ll often discover the need for new responsibilities in other classes and maybe even the need for a new class or two.

Another explanation would be:

 The front of a CRC card for a class looks like this,

     |  Class Name                     | Collaborators   |
     |  -----------------------------  |                 |
     |  Responsibilities               |                 |
     |                                 |                 |
     |                                 |                 |
     |                                 |                 |

   The "Class Name" section just contains the name of the class.

   The "Responsibilities" section describes the tasks an object of the class is 
supposed to carry out.  It should simply describes what is to be done, and it 
should avoid mentioning any of the detaile details of how the tasks are to be 
carried out.

   The "Collaborators" section should definitely contain any classes the object 
needs to carry out its tasks.  In some designs, but certainly not all, it may 
also include classes that use the object.

   The back of a CRC card for a class looks like this,

     |  Class Name                                       |
     |  -----------------------------                    |
     |  Variables                                        |
     |                                                   |
     |                                                   |
     |  Methods                                          |
     |                                                   |
     |                                                   |
     |                                                   |

    The "Variables" section lists the global variables (object state variables) 
an object of the class needs to maintain.

    The Methods section lists the methods of the class.  It should simply list 
the method signatures (method return types, names and parameter lists) and brief
descriptions of what the methods do.  It should avoid mentioning any details 
about how the methods carry out their tasks.  Typically, each method carries out
one of the tasks listed in the Responsibilities section.

All of the above was extracted from this SOURCE.

Overloading vs. Overriding

Ken explained this concept on theeeeee Tuesday class i think…

Ok so, we already saw this example from the Intel Forum Website:

Method overloading is used to increase the readability of the program.
Method overriding is used to provide the specific implementation of the method that is already provided by its super class.

Method overloading is performed within class.
Method overriding occurs in two classes that have IS-A (inheritance) relationship.

In case of method overloading, parameter must be different.
In case of method overriding, parameter must be same.

Method overloading is the example of compile time polymorphism.
Method overriding is the example of run time polymorphism.

In java, method overloading can’t be performed by changing return type of the method only. Return type can be same or different in method overloading. But you must have to change the parameter.
Return type must be same or covariant in method overriding.

Java Method Overloading example

  1. class OverloadingExample{
  2. static int add(int a,int b){return a+b;}
  3. static int add(int a,int b,int c){return a+b+c;}
  4. }

Java Method Overriding example

  1. class Animal{
  2. void eat(){System.out.println(“eating…”);}
  3. }
  4. class Dog extends Animal{
  5. void eat(){System.out.println(“eating bread…”);}
  6. }


Here’s an explanation by Hisham on Stackoverflow:

Method overloading deals with the notion of having two or more methods in the same class with the same name but different arguments.

Method overriding means having two methods with the same arguments, but different implementations. One of them would exist in the parent class, while another will be in the derived, or child class.

Yet another summary by

When overloading, one must change either the type or the number of parameters for a method that belongs to the same class. Overriding means that a method inherited from a parent class will be changed. But, when overriding a method everything remains exactly the same except the method definition – basically what the method does is changed slightly to fit in with the needs of the child class. But, the method name, the number and types of parameters, and the return type will all remain the same.


Wow, kind of a long post, didn’t research THAT much but hey, we got the concepts!

Leave a comment if you’d like to, SHARE and please don’t settle with this post if you still have doubts or any uncomformity.

Sorry if you hate the fact that this was mostly a giant copy-paste, i personally think it’s the most efficient way of gathering information.

See ya!


Concept Summary – Study Guide

College Advice by Joel Spolsky

--Originally published at chozaoop

Whoops, haven’t post in a really long time, sorry about that, kinda busy with other subjects.

However, here’s WSQ10 on Ken’s Courses

It was about reading this article by Joel Spolsky.

Wow, i just finished reading this, i agree on many of these arguments and convinced myself that it IS important to take advice from the elder, it really got me thinking. Even if this was a post from 2005, it still makes a lot of sense, many things remain the same.

Joel recommends students to learn stuff such as C, microeconomics and how to write. Let’s focus on these 3 for the moment. He mentions that the C language, even if it seems old and “a waste of time”, it isn’t, he wants us to know that even before knowing some high level language, we need to start from the basics.

Microeconomics, this convinced me personally since it is our responsibility to manage and take care of our own economy, our numbers,  it is also REALLY important to a company (either yours or a one you are working on), that their employees know this, and actually it is kind of common to see that many majors on Computer Science, Electronics or any other Ingineering takes some course on economics or enterprise management.

Onto the how to write subject, Spolsky talks about the value of knowing how to formally and correctly express ourselves and convincing others as well. A thing that i’ve been told is the importance of knowing how to write manuals and instruccions for software or electronics you might do later on your career, in order to do this you MUST know how to read and write properly.


College Advice by Joel Spolsky