My lovely semester in TC201

Here is the video I made explaining the whole learning process which I get through in this semester. It’s a long video (sorry, I was inspired). In general I think that I learned a lot, and not only in topics of Objected-Orientes programming; I also learned about the thoughts of important people of the programming community; I learned about what many philosophers and writers think about the abolish grades stuff, etc. To conclude, I feel prepared and confident to pass to the next level, that in may case is Data Estructure, which they said is OOP 2.0.

My video:

James Gosling deserves a kiss.. but not from me

java

The last WSQ of this semester! :’) And to close with a flourish, we had this interview in Triangulation episode 245 to James Gosling. He is nothing more, nothing less than the creator of JAVA. How I hate that guy! Just kidding guys. In my personal view he is the inventor of the most important, the most recognized, and the most worldwide known programming language of the world.

James Gosling said that in college he spent ‘endless’ hours in the computer center’s library, and that’s the way he learned to code. The important thing here is that he mentioned the word ‘library’. This means that he needed to read a lot of books that teach him how in hell he was going to be able to code. Ken’s way of teaching is pretty much in the same path. Ken has said to us that he could give us a bunch of coding assignments for us to spent time making them, but the real knowledge of object-oriented programming is in the books, in the blog posts of other people, in the videos of ‘coding professionals’. This is how I learned to give my codes the most objected-oriented path as possible, by reading and understanding all the complex concepts of OOP (encapsulation, inheritance, polymorphism, etc).

Finally I’ll kept with Leo’s phrase “they were going out to smoke in the back, and you were going to write code”. This is my philosophy in life: at the end, everybody will receive what they deserve. James Gosling may had been a nerd or ‘teto’, but instead of following everybody else examples, he knew what his goals were, and he chased them until he reached them. Now he is famous, and he is going to be remembered as one of the best programmers in the history; while all the other assholes bad students may not be even remembered for any good action in their lives.

The mother of all projects: Bot.e

This is my blog post of out final project, that in my opinion is the mother of all projects! Actually with it we won a government contest of ecologic apps (my mom was so proud!) As Ken and the other students can read in my blog post of useCases, Bot.e is an application that gives free stuff (food, cloth discounts, electronic things) to the good people of this world. In the future (we are working on it) there would be special trash cans were people can throw garbage, and they would display QR codes; this codes would be scanned by the person with his/her smartphone, and in the official app, Bot.e, he or she is going to accumulate points. This points will be interchangeable for discounts and coupons in the stores that are market partners with Bot.e. One person, just for throwing the garbage in the correct place, could win free wings at a restaurant, or 50% discount in cinema tickets, just to mention some examples.

For the purpose of Ken course, we modified our initial code to make it more Objected-Oriented. We coded it in Android Studio, a platform specialized in development of apps for Android phones. The code is written in Java and HTML. In the video I’m going to add to this blog post you can see how we adapted to be the more objected-oriented as possible. We created a lot of objects (although in code everything is an object, so it is redundant), we created a bunch of methods, but instead of calling them as simple functions, we called them from the objects.

Although we changed our project idea almost at the end of the semester, he had a lot of time for developing the new project; we did not  get through a ‘Hackathon week’ as Ken warned us. And for keep writing a bunch of silly stuff, I should better leave the video for everything to watch it.

Programming impulse: library assignment

I had a kind of programming impulse, and instead of only doing the library assignment, I worked out the first four programming assignments of the link that Ken sent us. This four assignments are: Gravity Calculator, Foo Corporation, Boston Marathon, and of course the Library assignment.

In the first two I had no problems doing them, and adapting them to the most possible Objected Oriented path I could. The problems started in the Marathon program, and not because it was a difficult task, but I tried really hard to make it Object-Oriented, but I think I fail in this mission. I had a really hard time trying to call a method of an array. I searched in the internet, I searched everywhere, and I couldn’t find the answer of how can I call a method out from an array list. Eclipse kept me displaying the error message that the method didn’t recognize the type array, so I did it old school by only calling out functions without calling methods out of my array list. (not so objected oriented 😦 )

Finally I get to the library assignment. This was a challenge. First I had no idea of what to do, but after a couple of hours of analyzing it (and doing other stuff) I began to more less have an idea of what was the path I needed to follow. When I was almost finished, I found out two mistakes: the title of my movie wasn’t showing correctly, and the method borrowed didn’t really work. That’s why I searched in my classmates blogs, and found Miguel’s blog of the task. In his blog I found the answer to my mistakes, and I finally finished the library assignment!

Unfortunately my Egit in Eclipse decided to sleep in the most important moment because it was not working, and I could not push my code to GitHub, but here I leave screenshots of my codes:

Gravity Calculator

GravityCalculator

FooCorporation

FooCorporation

Marathon

Marathon

Library assignment

Library

Library2

The not very zippy Ward Cunningham

Ward_Cunningham_1

Today in the morning I watched the interview to Ward Cunningham in the 239 episode of Triangulation. Ward Cunningham is kind of a hero (and for ‘kind of’ I mean the one and only hero) of the web/programming community. He is the creator of the  wikis; he was one of the main developers of the Eclipse ISE, and have always been one of the leaders of web development.

The first comment that caught my attention was in minute 3:00, when Ward said “I found at the time, that engineers were awfully conservative. They didn’t wanna use things that haven’t seen or worked before.” Ward declared that this situation lead him to asked people for new ideas; he asked engineers about things that could be improved, and all of this ideas helped him to establish most of his innovative ideas he had in his career.

Later in the video, when Leo and Ward are talking about the Wikis. Leo said something very interesting about Ward’s invention. Leo exposed that Ward’s creation was so revolutionary that  it changed something that no one else had done: erase the imaginary line between the creators of the webpages and the readers, so that everybody in this world can work as a team, that for Leo, it is the most intangible value of this life.

Finally I think that the most important think for the purpose of the class is when Leo reflect about the importance of the fact that Ward had no pressure for doing tasks, he did everything because he felt like doing it; he did it for pleasure; he did it because he like to. In this semester, Ken wanted us to experience something similar to the student life of Ward. Ken’s politic of abolishing grades helped us to establish our own priorities; we centered on things we liked; we were free to do what we thought was going to be more helpful for our knowledge, and all the other things were put apart.

Selecting new UseCases

logo

As you can see in my friend David’s blog, we had a small change in our final project (and for small I mean a whole new project). The idea of the RaspLapse was kind of obsolete. That’s why we decided to select a new project; this new project we had had developed this semester as a project for a government contest, but we chose to begin again giving it a more objected-oriented path, so that it adjust to the requests of the final project.

Due to it is well… a new project, it needs to have it respective Use Cases defined. In this blog post I’m going to expose the Use Cases of our new project called “Bot.e”:

We defined nine Use Cases in total were there are explained all the tasks that the different actors or users of the app must do in order to have a good performance of the app.

  • Use Case #1

Title: Downloading the app

Actor: User

Description: Enter to the AppStore or Google Store, search for the app “Bot.e”, and install it.

  • Use Case #2

Title: Register

Actor: User

Description: Open the app, create a new username and select a new password. Fill the information that is request in order to register as a new user.

  • Use Case #3

Title: Access the camera

Actor: App, User.

Description: The app will request the phone to access the camera. The user may click ‘accept’ button in the pop-up window to accomplish this process.

  • Use Case #4

Title: Home page

Actor: App

Description: When the user opens the app, he/she has to see the home page in his/her phone screen. The app has to show the ‘scan’ button, the ‘store’ button, the ‘my coupons’ button, and the display of points. Also it has to show the official logo of the app, and the layout with the official colors.

  • Use Case #5

Title: Scanner

Actor: User, Phone, App.

Description: When a QR code is displayed, the user has to open the app, and click the ‘scan’ button. The app has to open the phone’s camera. When the camera is open, the user has to put the phone in front of the QR code, so that the app can scan it through the camera.

  • Use Case #6

Title: Store

Actor: App, User.

Description: If the user decides to click the ‘store’ button, the app has to display the store page. In this store page, the different options of offers will be shown.

  • Use Case #7

Title: Display Points

Actor: App

Description: As it is mentioned in Use Case # 4, when the user opens the app, in the home page there must be a display showing the points that the user has accumulated. The display of points has to update immediately every time the user scan a QR code.

  • Use Case #8

Title: Alert messages

Actor: App

Description: The app must pop-up alert messages in many occasions. The app displays an alert message when the user wants to buy something in the store, but he/she does not have enough points. The app displays an alert message when the user attempt to buy an item in the store just to make sure that is the correct item de user wants, and also there is an alert message when he/she successfully buys an item in the store. The app displays an alert message when the user scans a QR code successfully. Finally, the app displays an alert message when the user tries to scan an incorrect QR code.

  • Use Case #9

Title: Buy & exchange coupons

Actor: User, App.

Description: As described in Use Case #6, the user has to enter the ‘store’ in order to buy an item. The user has to select the item he/she wants by clicking the button of the selected item. The user has to confirm that he/she wants to buy that specific item. When exchanging the bought item, the user has to enter to ‘My coupons’, select the item he/she wants to exchange, and the app would display a code bar that would be processed by the establishment’s staff where the user is trying to exchange the item.

 

 

Last argue about University

 

plan de carrera

I have read Joel Spolsky’s blog post about the advice he gives for Computer Science students in order to have more chances to succeed in their careers.  Joel writes down seven pieces of advice, almost all related to academic stuff, in which he encouraged students to not only center on programming stuff, but also on other topics that may not seem as interesting as computer science itself.

Here are the seven pieces of advice Joel talks about:

  1. Learn how to write before graduating.
  2. Learn C before graduating.
  3. Learn microeconomics before graduating.
  4. Don’t blow off non-CS classes just because they’re boring.
  5. Take programming-intensive courses.
  6. Stop worrying about all the jobs going to India.
  7. No matter what you do, get a good summer internship.

Last semester I had a course called “Introducción a la Electrónica” taught by Electronic Engineering director Eduardo Espadas. Here I was asked to elaborate an academic plan for my years at Tec de Monterrey. In this ‘plan de carrera’ I enlisted my goals for every semester I’m going to attend here at Tec. One of my ideas was that for every semester I would try something new, I would register myself in a new course that has nothing to do with electronics. Some of my plans are: take the Legal English course (I swear I had this idea long before reading Joel’s advice of learning how to write); enter to cultural courses such as guitar, cuisine, etc; learn another language (currently I’m in German courses); and many other plans for the rest of my years in University.

Clearly I agree with most of the ideas of Joel, but of course there must be at least one thing that I don’t share with him, and this thing is the importance he gives to the GPA. This disagreement has nothing to do with my grades, I have a very good GPA; the real reason is that I think that there are things way more important than the GPA. I know that the GPA is very important, and in some way it tells many things about level of responsibility and dedication of a student. The thing is that if in this time of my life I became an employer of a company, I would definitely give more importance to extra academic important achievements than to the GPA of a potential great engineer.

Of course we all have different points of view, and not always we are going to agree absolutely everything about something, but what its a fact is that if you want to be a great engineer whom the company’s fight between them for you, conforming with taking only classes of your academic area is just not enough.

Overloading vs Overriding

overloading-and-overriding

Continuing with the blog posts about the mastery topics, we get to Overloading and Overriding. These two concepts are related to the use of methods in classes, but they differ in many things.

Overloading is the action of using two methods with THE SAME NAME & AND IN THE SAME CLASS, but the ARGUMENTS & THE RETURN TYPE are different. For example we have this piece of code:

public class Overload {

public int sum(int x, int y) {
return x + y;

}

public double sum(double x, double y, double z) {
return x + y + z;

}

We have a couple of methods in the Overload class, both called ‘sum’, but the first has a return type ‘int’, and receive two variables ‘int’; while the second one has a return type ‘double’, and receives three variables ‘double’. In Overloading, Inheritance and Polymorphism are not involve.

The we have Overriding, that is some kind the opposite of Overloading. Overriding occurs when you have a SupperClass  with a method: int multiply(). Then you have a SubClass with another method called ‘multiply’. For it to be an Overriding, the method of the subclass MUST have the same ARGUMENT & same RETURN TYPE. In this case inheritance and polymorphism are clearly involved in this action.

All this info was provided by a Youtube video posted by EJ MEDIA. Here it is:

 

CRC Cards

CRC Cards… CRC Cards is a method used for modelling the app, and establish the responsibilities of every object of the app, and their main collaborators. CRC cards are made in index cards (yes, by hand) where at the very top is written the name of the class. Then there are written the responsibilities or actions that the mentioned class has to perform. A line is drawn at 2/3’s of the index card, and in the right side of that line, the main collaborators of this class are shown. The collaborators are every other object that has to interact with this class, the relationship between the class, and other classes.

CRC cards are used to distribute responsibilities between the objects of the app, and to have a first idea of the interactions that have to exist between object in order to achieve a good performance of the app.

Here I leave the structure of a CRC card:

12919532_1001139433273409_1191417874_o

Delegation: as interesting as merchants selling apparel in ‘tianguis’

Delegation

In preparation for the exam, here is my blog post about mastery topic: delegation. This term may seem as a tough to understand one, but actually is a concept that we as humans practice everyday in almost every situation we have.

I searched in a bunch of web pages trying to understand the concept of delegation; I searched in Wikipedia, in some Community web pages, and plenty of other web pages, and I finally, I got to a final definition that I like a lot: delegation is to ask someone else to help you. In this case (in an POO environment) the definition its transformed to ‘an object that when receives a request, it passes this request to a second object that is more specialized in this task’. As I said it before, humans tend to do this a lot in their daily lives. When someone receives a bunch of tasks, the first thing he/she does is ask for help; he/she delegates part of their tasks to someone else so that the amount of work can be less stressful or less complicated.

I found a number of good examples in code that explain how delegation is performed in code. Something important to mention is that when an object delegates its request to another object, the first object passes its request as well as itself as a parameter to the other object, so the later can complete the task.

The clearer example was published by Mladen Prajdic (cool name!) in a community web page called ‘Stackoverflow’. It’s important to notice the way that a delegation process is declared, and how it is transferred to the object #2 so that this obj#2 inherit the necessary methods to complete the requested task.

delegate void delMyDelegate(object o);
private void MethodToExecute1(object o)
{
    // do something with object
}
private void MethodToExecute2(object o)
{
    // do something else with object
}
private void DoSomethingToList(delMyDelegate methodToRun)
{
    foreach(object o in myList)
        methodToRun.Invoke(o);
}
public void ApplyMethodsToList()
{
    DoSomethingToList(MethodToExecute1);
    DoSomethingToList(MethodToExecute2);

Its important to see how the declaration of a delegation is made,