Monday, June 22, 2009

My Facebook is My Blog

It’s been a long time since I’ve been leaving facebook up until this moment. I’ve never opened my facebook page for over 10 months by now. Although facebook sent a lot of updates to my email regularly, I would just ignore them or delete the message from my email inbox. The reason that forces me to do that is…well, let’s say, caused by a complex complicated situation.

Let’s not talking about what kind of complex complicated situation I face right now, ok?…rather, in this post, I want to tell you that I want to move everything you can find in my facebook to my blog, which I opened around 2 months ago at here, blogger.com. I would centralize all my social accounts in the internet into only one place, that’s my blog. That’s said I would invite all of my friends listed in my facebook, as well as in my friendster and all potential new friends whoever you are, to visit me anytime at my blog rather than at my facebook or friendster. Note: everything I say about facebook here applies to friendster too.

So, I encourage you to post comments, public messages, testimonials and everything in my blog and if you want to send a private message, sent it directly to my email cutabang@gmail.com. You, also, will be able to find a set of pictures of mine, just like what you can do at facebook. For that purposes, I will setup everything it needs to make my blog looks like a facebook. And thanks to blogger.com, that would be an easy job since they provide many cool widgets whom I can put in every post pages.

The main reason for me to do that, i.e. moving my facebook to my blog, is that, in my opinion, blog is more valuable than facebook in general. With blog, I can post my thoughts, my knowledge, my experience, and everything in a better way than what facebook can give. Facebook isn’t intended for blogging anyway. Its main purpose is to provide facility for social networking. And that’s why it lacks of means for blogging. But, for social networking...facebook is the best.

What I really want, actually, is that I could still do social networking while I’m blogging. And at some point, blogger.com also provides tools for social networking, aside for blogging tools. Besides, my reader can do standard facebook’s job, such as leaving messages, testimonials, reviewing pictures, etc, in my blog. Now comes the important part, blogger.com has facilities beyond what I need to just post my article. It has cool gadgets with which I can provide my visitor a number of cool things. For example, I can place a google search box in my blog pages, so that the visitor doesn’t need to open another browser window and go to google.com. I can also place a polling gadget that enables me to make some surveys about particular issues from my visitors. I can also put newsreel gadget that shows visitors the most current headline news from Google News. Well…those are only three examples, blogger.com actually has many more facilities in form of gadgets I and my visitor can take benefit of. Ow, and I doubt that facebook has all three facilities I mentioned above, not to mention the other things I can get from blogger.com gadgets.

Note that I have no intention to discard my facebook account all the way. In fact, I will still keep my facebook to maintain relationship with friends. Only that I won’t update my facebook anymore as I will focus only at my blog from now on.

So now, I would say one more time that I invite all of my friends, whether or not you are listed in my facebook or my friendster, to drop by my blog anytime. I welcome every opinion, comments, review, and input from you regarding about me, my article, or everything. If you have your own blog, then we can start to interconnect our blog using blogroll tools. You can also view my recent blogroll, and if you want, you can too interconnect with them. The same thing goes for me too. Isn’t such interconnection what we call Social Networking…..?

Friday, June 5, 2009

JavaBeans Naming Standard

In addition to Java Code Conventions on naming standard, JavaBeans provide another important naming standard that should be complied as well by developers.

This article discusses only the naming aspect of JavaBeans specification. However, a brief explanation of JavaBeans is also provided below.


What is JavaBeans?

JavaBean specifications are intended for ease of sharing Java components, visual or non-visual, among developers to use with visual Integrated Development Environment (IDE) tools such as Eclipse and NetBeans. A source code that adheres to JavaBeans specifications can be recognized nicely by an IDE and then can be used and reused by any different programs that need it. In another word, JavaBeans is an aspect of object reusability that’s implemented in Java programming world.

Now, often in real programming activities using an IDE tool, you will need another java component to help the existing components achieving their task but you couldn’t find the component you want in Java API nor you have enough time to write the component’s code yourself right from the scratch. So what you would do is to find that component in other resources, probably from other components collections of yours or to call other developers or software companies down the street, and see if they have the component you want and are willing to share it or sell it to you. If you’re able to find it, then would it be great if you don’t have to modify the component again from scratch in order to integrate it in to your program, but instead you could have IDE tools recognize the component perfectly and use it directly to your program without any modification. Well, JavaBeans is here to help. You will be able to do that only if the component you find from other sources, including from your personal resources adheres to the JavaBeans specifications.

Wouldn’t that make your life easier than ever…? And all you need to do is to conform to the Java Code Conventions along with JavaBeans specifications whenever you code.


JavaBeans Specification for Naming Standard

Classes that conform to JavaBeans specifications are called Beans. They have properties, i.e. instance variables. A good programming practice is to keep every instance variables private whenever possible and provide methods to access and to modify them from the outside world. The method that can access them is called getter method and the method that can modify their value is called setter method.

Now, JavaBeans specs require the getters and setters to be named as simple as follows:

1. The getter should be named as getX() for property X. If the property is a boolean, then the getter should be named either as getX()or isX().

Example:
getDiameter() for property “diameter”
getAuthenticated() or isAuthenticated() for property “authenticated”.


2. The getter should be marked public, returns the type of the corresponding property, and takes no arguments.

So, taking the same example as previous, the getter declaration would be:
public long getDiameter() for property “diameter” which is of type long.
public bool getAuthenticated()for property “authenticated” which is of type bool.


3. The setter should be named as setX() for property X.
Example:
setDiameter() for property “diameter”.
setAuthenticated() for property “authenticated”.


4. The setter should be marked public, return a void type, and take an argument of the type of the corresponding property.

So, taking the same example as previous points, the setter declaration would be:
public void setDiameter(long newDiameter) for property “diameter” which is of type long

public void setAuthenticated(bool authenticationPolicy) for property “authenticated” which is of type bool

JavaBeans specs also cover other methods that support event-handling process, a process to respond the event generated as a result of interaction between the program GUI and users. That response is provided by a class who implements a java.awt.EventListener subinterface, e.g. ActionListener, MouseListener, and ChangeListener. For example, mouse listener will define the response of the program to a mouse-clicked event as a result of interaction between the program and the user through a mouse-click, that’s when users click a GUI component of the program.

If a java class needs to support a particular event handling, then it needs a method to register or remove an event listener to or from an object of that class. JavaBeans requires that method to be named as follows:

1. A method used to register an event listener should be named as addXxxListener() and take an argument of type XxxListener
Example:
addMouseListener(MouseListner ml) which register a mouse listener which in turn will respond to a mouse event.


2. A method used to remove an event listener should be named as removeXxxListener() and take an argument of type XxxListener

Example:
removeMouseListener(MouseListener ml) which removes a particular mouse listener.

That’s all….a brief article about JavaBeans specifications on naming conventions.

JavaBeans specifies a lot more of things. To learn more about it, one of the best places to go is Sun online tutorial about JavaBeans: http://java.sun.com/docs/books/tutorial/javabeans/index.html

Wednesday, June 3, 2009

Java Identifier….Rules and Convention

Java puts some rules and conventions for naming every element/identifier in a Java program, just like any other programming language does.

The conventions come into play when we're talking about codes readability and maintainability. Sun says that only 20% of the lifetime cost of a software goes to code creation and testing, while the other 80% goes to maintenance….it's very important for every software engineer to be aware about this fact. That said, adhering to Code Convention is as mandatory as adhering to naming rules.

Sun, as the Java creator, has made a "Java Code Convention" that every Java programmer on the planet should follow. It's a short, concise document. If you never see it, then go to http://java.sun.com/docs/codeconv/
right away, download it ASAP and read it before you make any important code….and any fatal mistakes.

This article, however, only talks about the Java Code Convention applied to naming procedure.

So, what are the naming rules and conventions that will make Sun proud of you if you could implement it successfully..? well at least the guy who is designated to maintain your code won't hate you and terrorize you after a minute of reading your code….


Naming Rules

  1. First of all, you're not allowed to use java keywords and reserved words. For the complete list of all those words, see the list in the bottom of this article
  2. The identifier can be composed of:
    1. Unicode letter character, e.g: a..z
    2. Unicode digits character, e.g: 0..9
    3. Dollar sign: $
    4. Underscore: _
      with a restriction that (read no. 3)
  3. The identifier can start with any of the item listed in no.2 except with a digit. That said, it must start either with a letter, or a $, or a _. After the first character, the identifier can be composed of any combination of them.
  4. Identifiers are case sensitive. Cow and cow are two different identifiers.
  5. The identifiers can have unlimited number of characters.

That's it! Here are examples of legal identifiers:

aName123__$$;

_$123;

$$$$$$$$;

a_very_very_long_name_here;

and examples of illegal identifiers:

1aName;

&aName;

:)smileyName;

-creativeName;


Naming Conventions

  1. In general, use a complete whole word, not a cryptic abbreviation. That would make the element we name become more intuitive and clearer.
    example: use manager instead of mngr

  2. Classes and Interfaces
    The identifier for classes/interfaces should be a Noun, start with an uppercase letter, and if there are more than a word (internal words), then the first letter of subsequent words should be capitalized too (a convention called as camelCase rules).
    example:

    class Car
    class SuperCar
    interface Resizable
    interface FlexiblyResizable

  3. Methods
    The identifier for methods should be a Verb. Start it with a lowercase letter then apply camelCase rules.
    example:
    hold()
    holdTight()
    measureLength()
    searchWords()


  4. Variables
    The variables identifier should be a Noun and, like a method, start it with a lowercase letter and apply camelCase rules.
    example:
    account;
    accountNumber;
    space;
    spaceArea;



  5. Constants.
    Constants are static final variables. Every letter of their identifier should be capitalized. Use underscore character to separate internal words
    example:
    MAX_INTEGER;
    PI;
    CLICK_COUNTS;


Again, this article is all about naming rules and conventions. To find out more about another java programming conventions, read the great "Java Code Conventions" document


Java Keywords

abstract

assert

boolean

break

byte

case

catch

char

class

continue

default

do

double

else

enum

extends

final

finally

float

for

if

implements

import

instanceof

int

interface

long

native

new

package

private

protected

public

return

short

static

strictfp

super

switch

synchronized

this

throw

throws

transient

try

void

volatile

while



Unused keywords:
const goto

Reserved words: true false null

How was Java named?

This is a no-brainer question yet an extremely important one…

Every technology in the world has its own history. Who invented it, when, where, and how it was invented. Java is no exception. And it becomes more interesting since, as far I know, the name represents either one of the following 2 things: Java as a Hindi word or Java as an island of Indonesia (although the name of this island comes from the same source as the first one). I inclined to think the latter since along with the Java project, there are also another project that, at some point, related to Java, i.e. Jakarta and Gamelan. Respectively, Jakarta is the capital of Indonesia located at Java Island and Gamelan is a traditional music from Java culture, one of the major cultures in Indonesia. So undoubtedly, the name has something to do with Java as an island of Indonesia.

So, what motivates Sun, as Java inventor, chose “Java” as the brand for the technology?

Here is an email from James Gosling, Java lead inventor, to Jonathan Schwartz, Sun CEO, as a response to the very same question as the title above:

________________________________________________________________________________

Begin forwarded message:

From: James Gosling

Date: August 24, 2007 8:16:58 PM PDT

To: Jonathan Schwartz

Subject: How was Java named?


The story goes like this:

We needed a name. We had been using "oak" (which was selected essentially randomly by me), and while the team had grown attached to it, the trademark lawyers ruled it out. We had lots of email debates about names, but nothing got resolved. We ended up in the awkward position where the #1 thing stopping us from shipping was the name.


Our marketing lead knew someone who was a "naming consultant" (I don't remember his name, but he was great). We could neither afford the price nor the time of a conventional product naming process. He agreed to do something rather odd, but effective and quick: he acted as a facilitator at a meeting where about a dozen of us locked ourselves in a room for an afternoon. He started asking us questions like "How does this thing make you feel?" (Excited!) "What else makes you feel that way?" (Java!) We ended up with a board covered with essentially random words. Then he put us through a sorting process where we ended up with a ranking of the names. We ended up with a dozen name candidates and sent them off to the lawyers: they worked down the list until they hit one that cleared their search. "Java" was the fourth name on the list. The first name on the list was "Silk", which I hated but everyone else liked. My favorite was "Lyric", the third one on the list, but it didn't pass the lawyers test. I don't remember what the other candidate names where.


So, who named Java? Marketing organized the meeting, the consultant ran it, and a whole pile of us did a lot of yelling out of random words. I'm honestly not real sure who said "Java" first, but I'm pretty sure it was Mark Opperman.


There certainly wasn't any brilliant marketing mind who went through a coherent thought process.

________________________________

As with a lot of innovation, not every decision - nor product name, blog or line of code - starts on a spreadsheet. Opportunity's often far harder to measure.

________________________________________________________________________________


So, James said that the Java team ended up with a ranking of random words and then they were sent off to the lawyers.

But still the question remains. How did the lawyers hit Java instead of the others?

That’s still unclear for me……..did they too end up with a name (that’s “Java”) chosen randomly..?

If so, then Java is very lucky to become the chosen one…….and now it’s among the most notable words in Information Technology world…