#TC201 #Topic15 What is the metaobject protocol?

--Originally published at Venkon Programming

metaobject protocol (MOP) provides the vocabulary to access and manipulate the structure and behavior of objects. Typical functions of a metaobject protocol include:

  • Creating and deleting new classes
  • Creating new methods and properties
  • Changing the class structure so that classes inherit from different classes
  • Generating or modifying the code that defines the methods for the class

Source: Wikipedia.

#WSQ11 #Java #TC201 Library Assignment Programming Fun

--Originally published at Venkon Programming

The libraries of SmallTownX need a new electronic rental system, and it is up to you to build it. SmallTownX has two libraries. Each library offers many books to rent. Customers can print the list of available books, borrow, and return books.

Problem

 

We provide two classes, Book and Library, that provide the functionality for the book database. You must implement the missing methods to make these classes work. 

The first part of the problem that is the implementation of Book was easy, we only put what they asked us to put, filling the methods is easy if you already have the other WSQ, the hard part is when is the turn of the Library at first we have to make the address of the library, that's simple, then we have to make an ArrayList where all the books will be, that's the hard part, then we have to check the hours the both libraries are available, that's very simple, then borrow and return books that's the hard part but when you get it is simple.

I won't post pictures because I'm lazy but here's the code 

Book

Library

#WSQ10 #Java #TC201 – College Advice

--Originally published at Venkon Programming

I like this from Joel Sposky, "If you enjoy programming computers, count your blessings: you are in a very fortunate minority of people who can make a great living doing work they enjoy. Most people aren't so lucky. The very idea that you can "love your job" is a modern concept. Work is supposed to be something unpleasant you do to get money to do the things you actually like doing".

Advices

  • Learn how to write before graduating

This is a great advice because to express your ideas you need the abilities to transmit them, and writting and SPEAKING, he miss that, are a very usefull.

  • Learn C before graduating.

I asked many programmers what I must learn before I graduate and actually all of them answer me the same, learn C, is the base for all, so I'll take this advice. 

  • Learn microeconomics before graduating.

My dad had always said to me that the difference between a common CS engineer and me can be the way I present myself and the business stuff I know, so actually this advice is already done 

  • Don't blow off non-CS classes just because they're boring.

I'm trying myself so hard to keep at least a 3.0 in my GPA, but I have to admit that is hard but I'll do my best.

  • Take programming-intensive courses.

I already take intensive programming courses, they are awesome, but the things that I have learnt I kind of forgot them because the practice makes the master, so actually the adivce is keep programming so you can be awesome at what you do

  • Stop worrying about all the jobs going to India.

I heard about India and how cool they are at my area but the thing is that if you can develop a great idea that no one have, that's the key of success, be good at something and create awesome things that help humanity

  • No matter what you do, get a good summer internship.

I'll take this advice unless I develop an idea that changes the world

 

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

--Originally published at Venkon Programming

Method overloading in Java occurs when two or more methods in the same class have the exact same name but different parameters, is a feature that allows a class to have two or more methods having same name, if their argument lists are different.

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

Declaring a method in subclass which is already present in parent class is known as method overriding. The main advantage of method overriding is that the class can give its own specific implementation to a inherited method without even modifying the parent class. The benefit of overriding is: ability to define a behaviour that's specific to the subclass type which means a subclass can implement a parent class method based on its requirement.

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

Let's summarize the differences between overloading and overriding. 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.

Difference

Overloading

Override

 

#TC201 #Topic4 What is delegation?

--Originally published at Venkon Programming

Delegation is a technique where an object expresses certain behavior to the outside but in reality delegates responsibility for implementing that behaviour toan associated object. This sounds at first very similar to the proxy pattern, but it serves a much different purpose. Delegation is an abstraction mechanism which centralizes object behaviour.

The delegation design pattern allows an object to delegate one or more tasks to a helper object. Two classes are used to achieve this: the delegate and delegator, both which realise a common interface. A method (or methods) on the interface represent the functionality to be delegated. A call to the delagtor calls the matching function on the delegate.

#TC201 #Topic12 What is polymorphism?

--Originally published at Venkon Programming

Polymorphism in a cientific way is when we use inhertiance to create new classes, each new class inherits both the data members and the methods of the superclass. But simethimes the methods need to behave differently depending on the new class deinition. In the case where the subclasses may need to behave differently, they still contain the same method name but they have a different implementation.

Well, in few words and well explained is when a subclass inherit a method from the superclass and another subclass inherits the same method and both of them do something related to the method but not the same thing each of them override the generic method that the superclass inherits to do what they need to do.

Source: Polymorphism