Skip to main content

Posts

Showing posts from 2005

10% time for productive fun

Someone was telling me a few days back about a certain software company that lets employees work on whatever they wish for 20% of their working week. Jim Shores has written an article on a very similar concept. In his article Jim explains the benefits of letting employees spend half a day every week researching any technology or area of their choice. Even if the research is not of immediate importance to the project they are working on, they will still benefit tremendously from the enhanced perspective. Jim mainly talks about spending the research time on technology and working up a small prototype to demonstrate a concept and to increase ones own understanding. The article is available on Jim's website Along with experimenting with code, other activities that may also yeild good results are reading articles or blogs written by senior software practioners, listening to podcasts, writing, and teaching. Many articles written by senior developers are very insightfull, because they wri

Benifits of blogging

A few days back I was discussing with a friend, how small companies can use blogging to their advantage. To survive in business each company has to maintain a certain brand image for itself. The brand image helps in attracted good customers as well as in attracting good talent to work for the company. Large organizations do the brand building in many ways, some of them being through advertisements, brochures, conferences, and their salesforce. Small companies however do not have the deep pockets that their larger counterparts enjoy, but many small companies do excellent work, and it's a pity that they are not as well known as they should be. The Internet and the concept of grassroots publishing gives smaller organizations, the tools to network and make themselves better known. Blogs and Podcasts are two of the more frequently used tools that can be used. In this weblog I talk about Blogs. I will to talk about Podcasts in another posting. Blogs as opposed to books capture small idea

Writing tip: usage of commas

An interesting writing tip from http://www.GrammerCheck.com --------------------------------------------------------------------------------------- QUESTION: "Now that spring has arrived, the flowers are in bloom, and the trees are budding." This is a sentence my English teacher gave us in class, and I told her that it was wrong and she needed to drop the second comma. She disagreed and said it was right as is. GRAMMARCHECK: Your teacher is correct. The sentence in question has one dependent clause and two independent clauses: Dependent Clause: Now that spring has arrived Independent Clause #1: The flowers are in bloom. Independent Clause #2: The trees are budding. The first comma is necessary because a comma should be placed after an introductory [dependent] clause. The comma separating the two independent clauses is optional because both clauses are short and closely related; however, it's never incorrect to place a comma between two independent clauses that are joined

Free Books

1. Would you like to listen to free audio books? Check out LIBRIVOX . It contains audio recordings of many old copyright-free books, like Sherlock Holmes, P. G. Wodehouse, etc. 2. Here is a free e-book on the Java programming language. It uses Applets to illustrate certain concepts more clearly.

Case of the stingy JVM

Did you know this ? ----------------------------------------------------------------------------------------------------------------- The Java virtual machine specification defines the range of values for each of the data types, but does not define their sizes. The number of bits used to store each data type value is a decision of the designers of individual implementations. -Bill Venners, Inside the Java Virtual Machine ------------------------------------------------------------------------------------------------------------------ When you create an int you would think that the JVM allocates 32 bits to it. But wait, it is possible that it may allocate fewer bits if the value you assign to the int does not require all the 32 bits. What will happen if you assign it a larger value? I do not know for sure, but I think it will relocate the int to some other location on the heap and give it more memory. Now is that 'stingy' or 'smart' ?

FLOSS.IN

This year Bangalore Linux is being hosted as FLOSS.IN from Nov 29th - Dec 2nd. The speakers and topics seem very interesting. I am sure the event will be a great learning/exploring oppurtunity for the participants. Check the link for more details.

The Open-Closed principle for software design

The Open-Closed principle states that the design of a software system should be open for extension, but individual classes should be closed for modification. This means that a software should be designed such that new functionality can be added by adding new classes, and by subclassing abstract classes that have already been defined. However once a class is implemented it should be closed for modifications. Such a design can be achieved by using the "Program To An Interface" concept. This concept states that the client class must reference abstract classes instead of concrete classes. This way subclasses can be added to the system as new functionality is added, without breaking client code. Care must be taken so as not to instantiate concrete classes in the client code. The creation of concrete subclasses must be handled by object factories. The dependency inversion principle ensures proper implementation of the open-close principle. To summarize: we must achieve exten

Synchronizing static methods in Java threads

While teaching Java threads, a student asked me a very interesting question: When a thread calls a synchronized method of an object, it obtains the lock of the object, however how can a thread call a synchronized method that is static? An object may not even have been created when the static method is called. To understand this better, let us look at a simple example of a class which contains two synchronized method: one static and one non-static. public class SynchedClass { public synchronized aMethod() {} public static synchronized bMethod() {} } When a thread calls SynchedClass.bMethod(), it obtains a lock on the class java.lang.Class that represents the SynchedClass. Whenever the JVM loads a class it creates an instance of java.lang.Class which represents all objects of the loaded class. An instance of the class Class is created even before any object of that class is instantiated. When a synchronized static method is invoked the invoking thread obtains a lock to the class Class. N

Java Assignment - Milestone 6

Details for Milestone 6: Create class Student which has the following characteristics: Attributes: String name; String surname; String id; List course; Methods: Create getters/setters for the above attributes (including the course attribute). public void addCourse(Course c) { //This method should add the course to the list } public void deleteCourse(Course c) { //This method should delete the specified course from the List of courses. } It is NOT necessary to write any test classes.

Java Assignment - Milestone 5

What a great way to communicate with students: Here are the details for Milestone 5: You have to create 3 classes - Schedule.java Course.java CourseListProvider.java Details for the classes are as follows. Schedule.java contains attributes already discussed. Each attribute should have a getter and setter. You do NOT need to write a test class for Schedule.java Course.java contains attributes already discussed. Each attribute should have a getter and setter. You do NOT need to write a test class for Course.java CourseListProvider.java contains the following attributes and methods. Attributes: private List courses public static final courseListDetailsFile=""; Methods: public CourseListProvider() //constructer private List buildCourseList() This method will read the contents of the courselist.txt file and build Course objects. Each Course object will be associated with a schedule object to represent the schedule.

Do Your Best

A very long time back I had read in a book: “Do your best and let god take care of the rest”. Sounds like a very simple line but if you think of it carefully it actually sums up the essence of how we must live our lives in just a few words. All of us have experienced times when we do not have any control over what happens. All we can do is try our very best and pray that events turn out in our favor. In such times it is very easy to fall prey to fatalism and think that all events in our lives are pre-destined. But in reality it is not so. Ramana Maharishi used to say that the only control we have is over our reaction to events that happen to us. It is this reaction that sows the seeds of future events. If the reaction is positive, meaningful, and benign then it will pave the way for better future events. The Bhagwad Gita preaches: “Perform your duty in the best possible way and relinquish the fruits of your actions to god”. Applying this simple principle will help us lead meaningful, c

Writing, does make you think

Yesterday I send an email to some friends about a particular Java feature. The original email read "JDK 1.5 has introduced a cool feature to allow overriden methods to have different return types". I had just read about this feature in a newsletter and decided to share it. However just before clicking on the 'Send' button, I decided to review the mail to ensure that it was correctly phrased (I always have to review my first draft... even if it's just a line :-). While reading it again, I stopped at the word 'cool', and thought to myself - Is this a cool feature, or is it just a feature. Was the use of 'cool' appropriate here? This made me think a bit more about this feature. This feature was intended to remove the hassle of downcasting an object returned from a method. But wouldn't different return types for overriden methods break the "program to an interface" concept? Now the client code has to know the exact subclass that it is ca

Triple Quotes

I am sure everyone has heard of the terms single quote, and double quote, but have you heard of triple quote? Yes such a term does exist, and it means three consecutive single or double quotes. So ‘’’ is a triple quote, and so is “””.

The Samurai Principle for Exception Handling

When a method fulfills it's responsibility, it is very clear what to return. We return the desired result object. However sometimes it is a bit unclear what to do when a method does not totally fulfill its responsibility. Do we return a null, do we return a partially populated object, or do we throw an Exception. Most of these situations can be resolved by applying the Samurai Principle - Return victorious, or not at all. If a function fulfills its responsibilities, return the appropiate result object, and if it doesn't then throw an Exception. Can this principle have any exceptions? I cannot think of any at the moment. Do let me know if you come accross any.

English Language Primer (contd.)

Continuing from yesterday... a bit about adjectives and adverbs An adjective describes a noun. It usually follows the pattern "You are very _______________". For example "You are very misogynous", "You are very courageous", etc. Adjectives usually end in -ous, -ive, -as, -ed, -ic, etc. Adverbs are generally formed by adding a -ly to an adjective. Misogynously, courageously, etc are adverbs.

An English Language Refresher

Today I have deviated a bit from the original category of my postings. From software programming languages to the english language. Very often while I find that I have forgotten the grammer priciples I learned in school. So I decided to revise them, and thought I'd share the refresher on my blog site. Here goes... A noun is usually a thing. Nouns are preceded by words such as a, the, my, such, an, some. Some nouns are however difficult to identify. Words such as egoist, asceticism, and misogynist do not come accross as nouns right away. However if we put them in the context of a sentance... "... an egoist", "such asceticism...", "the misogynist...", then the above rule clearly identifies them as nouns. The confusion with these words is that at first glance they seem to be adjectives. "He is an egoist". Egoist is a description of a person 'He'. However because egoist is preceded with a 'an', it is a noun. This law is conistent

Software Quality

Lately I have been following a lot of discussions on software code quality. There seems to be a lack of consensus on what quality means. This is not very surprising, since quality is a very subjective term, it means different things to different people. Here's what it means to me: I believe every software is created for a specific purpose. The purpose usually defines the forces that act on the software. Most common forces that usually act on any software from a bsiness perspective are: 1. Adaptability - How well will the software adapt to changes 2. Reliability - How often will the software crash 3. Timeliness - How fast can we ship the software 4. Economy - How much will the software cost 5. Performance - Does the software have quick turnaround times 6. Scalability - Will the software continue to be performant if the user base were to increase substantially 7. Usability - How intuitive is it to use the software These business factors are usually achieved by the following technical

ROI on Architecture

Bill Venners has started an interesting thread on software architecture and ROI at Artima . Here is my response to the posting: There are two forces that a software usually has to reckon with. Changes in business requirements and changes in technology. Let's say we build an ERP system. Some business rules in the accounting module might have to be modified due to changes in tax laws. Parhaps the client might want to produce more reports or change some existing ones. The client might want to change the UI. Brainstorming with domain experts and clients will most likely help us make a comprehensive (though not all-encompassing) list of requirements that can change in the next let's say three years. With some further thought we may also be able to attach a probablity of change. If we incorporate enough flexibility for high probablity changes then we will get a good return on investment on the architecture. I think this is the middle ground between an overly simplified architecture a

Open Space Technology

A few days back I was reading Bruce Eckels blog on Open Spaces. Open Spaces seems to a very broad (open) ended concept, but it can be a very interesting and powerful concept if the participants are mature enough to make proper use of it. Here is the broad outline of my understanding of Open Spaces: Open Spaces are conferences propelled by a concept or question. The driving concept could be anything from "How do we make our neighborhood cleaner" to "What is the best way to utilize web services". These are not preplanned conferences. The person or organization who wishes to explore a concept/problem will send out invitations in the community. People/companies who have similar interests will accept the invitation to attend. An invitation fee is usually charged to compensate for food, equipment, and conference room costs. The conference is a self organizing conference, which means there isn’t any pre-planned agenda. However the duration of the conference and time slot