Importing Inherited Implements

What’s the difference between Imports, Inherits and Implements?

Imports
…lets the developer USE a Namespace, using a referenced library; eg. the Math Object is under the System Namespace, so in order to use the functions that it shares, you’ll declare “Imports System.Math” somewhere in your code.You can use any library that you have referenced in your project WITHOUT using Imports keyword by typing the full class path, eg. “a = System.Math.Abs(10.2);”. By using the Imports keyword, however, you can shorten the line of code to just “a = Abs(10.2);”.

Implements
…lets the developer EXTEND a Class, using an Interface. These interfaces usually start with the capital I in front of them, and implementing one of these would force a class to use certain names and types of certain methods and properties. You have to explicitly declare these constraints, or the class will not compile. However: the Interface itself cannot contain any code, it just enforces a pattern so that other objects can call a generic interface to address multiple implementations.

Inherits
…also lets the developer EXTEND a Class, but this time using a base class. The base class are complete classes with working methods and properties. It does not enforce any constraints to the class that’s inheriting it (unlike Interfaces) so you can overload (or choose to ignore) any method you like.

~~~

An Analogy: Everyone can become Wet. Dogs are Animals. Cats are Animals. All Carnivores can eat Meat.

Now, since everyone can access the method MakeWet, then an “Imports System.Water” might have been declared, so that everyone can just call the Method “MakeWet” instead of repeatedly writing “System.Water.MakeWet”.

We can say that both Dogs and Cats implement the interface IAnimal. This way, we can give both of them the method IAnimal.Talk() and force the coder to write code inside the function. Afterwards, since all animals have the same method name ‘Talk()’, we can use them like so:
Zoo.Add(New Dog)
Zoo.Add(New Cat)
For Each Animal as IAnimal in Zoo
Animal.Talk()
End For
// Output:
// ”Woof Woof”
// ”Meow Meow”
However, all animals eat alike. Instead of copy-pasting the eat method on each animal, lets just have them inherit the Base Class clsCarnivore, which automatically gives them the method ‘EatMeat’. Of course, if an animal only eats certain kinds of meat, we can overload the method, but if not, no extra code is needed.

There, and done~! Don’t get confused.. Until next post, Sayonara~

w00+! Btw, what's the opposite of writer's block?

Ok, so I said quite a few posts back that I'm pulling back on blog posts to focus on my new job at Isuzu Automotive. However, I'm quite inspired these past few days (maybe because of the thrill of educating again), and I'm currently writing 3 blog posts for you guys ^^ Yey!

Now, I'm about finished with the first one: Inherits Implements and Imports, so that'll go up approximately tomorrow evening. One of my superiors asked me about the difference between them, and I couldn't remember off the top of my head. So I decided to do some research and write about it here.

Next is a fun post, which will also be the first post on my new (!!) blog: FinalFantasy14.Philippines. I got a Beta Key for the Square-Enix's upcoming MMORPG: Final Fantasy 14, and I'll try to document what I learn and share the experience in a filipino player's perspective.

Lastly, I'm writing something about developing Android Applications. I brought an HTC Wildfire last week, and I'm kindof intrigued with the development of Android as an operating system.

Ok, that's it! I need to go write some more~ Sayonara, for now!

Trippy Dot Net

Slide Notes Here: http://ow.ly/2qFmJ


2nd seminar in a month c-c-combo! I'm getting my old confidence back :D I'll try to schedule another one next next tuesday (which I will post here too) about Unit Testing~ But in the meantime, here's a few choice bits about my take on Exception Handling (Part 1 of my 3P.Net series):

Be wary of using Try..Catch Exception Handling! Its tempting to use the infamous "Try All, Catch Everything" mentality throughout your code, but that will cause a lot of trouble to you (and your team) in the future. How? Well, aside from a slight performance hit for every line in the try..catch (less than 1ms), by catching exceptions in the lower layers, you're depriving the upper layers from effectively resolving those errors!

An example: If the end user somehow bypasses the validation, and enter a null entry into a non-nullable field, the business logic layer would pass the wrong data to the service layer, who would then try to insert/update the data source. The data source would then issue an exception to the service layer (NullArgumentException). If you resolve the error at the service layer (Log the error then throw a message saying that there's something wrong) then the business logic layer will no longer catch the exception. However! If you let it 'bubble up' (eg. Don't try..catch it, or throw it again after catching it) to the business logic layer, you can now catch all NullArgumentExceptions, fill the null data with a default value, then resend it to the data source. The end user would'nt even know that an exception had happened.

Another thing, it's good practice to throw unresolved exceptions up towards the highest layer, which is commonly the Windows Forms layer (or ASP.Net/WPF/Silverlight layer, whichever the case). The top most layer however, should have a blanket try catch on its containers (form/page/usercontrol, whichever the case) in order to catch any stray unresolved errors that manage to bubble up to the very top. These unresolved errors, are the ones that we have to track with a Bug Tracker.

You can read more about this topics on my slides above, or you could just message me in my Google Profile, Facebook or Twitter. Until next time, sayonara~

Social Networking and Education

Slide Notes Here: http://ow.ly/2mmFT



It has been quite some time since I stood in front of a classroom filled with students. A week ago, Mam (Mich) Ramirez invited me to talk at Lyceum, and I immediately agreed- As you guys know, I like being an educator. But as I stood in front of the students, I suddenly felt fear and my heart started pounding fast.. I guess 'hindi na ko sanay' and I need to start performing talks more. I hope more opportunities like these present themselves..

Anyhow.

My talk was about how college education is not enough, how we must supplement it with knowledge available to us (free!) in the internet, and how to find these knowledge through the use of Social Networking. After that, I talked a bit about blogging (which, ironically, I'm blogging about right now) and which blogging platforms I think is the best. I'll reiterate a bit here:

1) I love Blogger. Absolutely free, No strings attached, moderately customizable and best of all: Allows Ads.
2) Wordpress: for Design Experts.  It requires a small yearly fee, but you can customize a lot of it afterwards: plugins, widgets, themes, etc. Also, a photoshop pro's dream photo blog.
3) Quick & Easy blogging at Tumblr & Posterous. These are free services, little customization (compared to Blogger and Wordpress, at least) but very clean and simple to use.
4) Make your own. You can set up a Joomla, Drupal or a Ruby on Rails web server at home or on a host, get a domain name to get a 100% fully customizable website that can breath fire (if you're a good enough programmer), but of course, you'd need to invest a lot of time, effort and cash to do so. I suggest trying out the free services first.

That's it for today~! If you guys have any questions (about the seminar, blogging or even programming) you can leave a message on my Google Profiles page, or just contact me through Facebook or Twitter. Until next time, Sayonara! *watches the latest Hitman Reborn*