Skip to main content

Posts

Showing posts from August, 2006

Closures in Java

Recently there has been much talk about whether closures should be introduced in Java. Many programmers who started with Java as their first language may not know what closures are. Martin Fowler has a very nice explanation on his bliki . Initially when Java was being designed there was some debate on whether Anonymous Inner Classes should be allowed to access non final local (method) variables. Eventually the feature did not make it in, but had it, then an anonymous inner class would have been almost a closure except that it goes against Martin Fowler's principle that languages that support closures should allow you to define them with very little syntax.

Informal web based learning

Would you like to engage in web based informal learning, rather than learning in a classroom? There are several advantages in doing so: You can learn at your time, place, and pace You can engage in more reflection, which will enable a better learning experience, more retention, and clearer perspectives Statistics show that classroom based corporate training just does not work There are several resources (free as well as paid) that will help you in your learning endevours. I will publish links to such learning resources constantly on this blog. Here's one to start with. Sang Shin facilitates free online Java courses on his Java Passion website . It's really neat. If you are curious about what informal learning is and why it is better than formal learning, you may also want to check out Jay Cross' blog , and this webpage .  Notes: This text was originally posted on my earlier blog at http://www.adaptivelearningonline.net Here are the comments from the or

Polymorphism

Polymorphism is the ability of an object to assume multiple forms. The example below assumes a class hierarchy with Appender as the superclass. For now it is sufficient to know that the Appender class has a responsibility to append a log statement to a certain destination. This class has three subclasses, ConsoleAppender, FileAppender, and DatabaseAppender, each of which implement the 'append' of the superclass to direct the log statement to the console, file, and database respectively. The audio explains polymorphism with this simple example. [Time: 3 mins 40 secs] Watch a simple animation of how Polymorphism works. Note: This post was originally posted on my blog at http://www.adaptivelearningonline.net

Inheritance

Logging frameworks like Log4J allow us to send logs to a multitude of destinations. The code responsible for logging to a destination is usually encapsulated into separate classes. Without inheritance With inheritance When to use inheritance: IS-A relationship An Employee is a Person A BumperSale is a Sale A Square is a Shape IS-LIKE-A relationship But if the relationship between them is HAS-A (eg: Car has an Engine), then we use composition instead of inheritance. Reflections: What is the relationship between the following objects? Bathroom - Bathtub Car - Engine Person - Professor Vehicle - Car Note: This post was originally posted on my blog at http://www.adaptivelearningonline.net

Encapsulation

Encapsulation and information hiding are often used interchangeably. But they are actually different. Information hiding is a design principle, whereas encapsulation is a language facility. Encapsulation is the process of bundling code and the data it acts on together in one entity. David Parnas describes information hiding as "hiding of critical design decisions", so that the client code does not have to understand the intricacies of the design, and is also oblivious to any changes in design. Encapsulation can happen without information hiding, but will not be effective. Encapsulation facilitates, but does not guarantee information hiding. Following some simple guidelines will help us create better classes Encapsulation rule 1: Place data and the operations that perform on that data in the same class Encapsulation rule 2: Use responsibility-driven design to determine the grouping of data and operations into classes Information hiding rule 1: Don't expose data ite

Abstraction

According to Wikipedia - Abstraction is the process of reducing the information content of a concept, typically in order to retain only information which is relevant for a particular purpose. For example, abstracting a premiership football to a ball retains only the information on general ball attributes and behavior. Similarly, abstracting an emotional state to happiness reduces the amount of information conveyed about the emotional state.   This photograph is attributed to gautamnguitar, and is posted on Flickr with a Creative Commons license. Note: This post was originally posted on my blog at http://www.adaptivelearningonline.net

A quick refresher of object oriented concepts

In this section we will refresh basic object oriented concepts, to ensure that everyone understands the basics before proceeding. Let us start with a brief history of object orientated programming. Object orientation is a step in the evolution of software design The purpose of object orientation is to create programs that are flexible, maintainable, and robust. Note: This post was originally posted on my blog at http://www.adaptivelearningonline.net

Designing using object oriented principles

Welcome to the course on designing using object oriented principles. Simula 67 was the first object oriented language, and as it's name suggests was created in 1967. Since then many object oriented languages have been created, all with the purpose of easing software development and making it easier to write robust, maintainable, and flexible programs. In this section we will learn the fundamental principles of programming with objects and how to apply those principles while coding in real life situations. Remember, even though object orientation gives us constructs for writing maintainable programs, if we do not use them properly, the resulting code will probably be more unmaintainable than simple structured programs. This course covers the following topics: A quick refresher of object oriented principles In this section we will once again refresh the basic concepts of abstraction, encapsulation, inheritance, and polymorphism. Translating requirments into system design In this sect

Java certification, anyone?

I dislike certifications. They usually have a nuisance value more than anything else. But I was pleasantly surprised when I chanced upon Java Black Belt, a developer community based site that offers certification. Their focus unlike most other approaches is not theoretical, but geared towards the practice of programming. The questions are created by the community following a moderation and rating process. They do not charge money for the tests, but require volunteer points. Volunteer points can be earned by helping them refine questions, proposing new questions, and even by contributing to open source projects. This goes very well with the philosophy of participation. Volunteers help develop the site, learn in the process, and also get certified. As participants pass tests, they gather knowledge points, and as they gather knowledge points and pass tests, they attain advanced belts, corresponding to their levels of mastery. If this seems interesting, and you are already getting curiou

So you want to be an expert?

Who doesn't want to be an expert? (Just in case you have stopped here and are pondering whether you want to be an expert... then you have a serious problem buddy. But nothing that the Creating Passionate Users blog cannot resolve). Well I will not rant on this topic because Kathy Sierra has said it in such a wonderful way, that I will simply point you to an image from her blog. The image says it all. Notes: This text was originally posted on my earlier blog at http://www.adaptivelearningonline.net Here are the comments from the original post ----- COMMENT: AUTHOR: Tarun Chandel URL: http://tarunchandel.blogspot.com DATE: 10/19/2006 10:15:50 AM I think there is another important aspect of learning, and that is sharing. An expert if doesn't have ability to share things with others then his/her knowledge is of little use. The ability to share is not easy and not everybody is good at it. But just like anything else in life this can be learnt and improved with time and prac