Posted by: Ibrahim Faisal | August 23, 2008

Bolt, Lightning Bolt !

Usain Bolt of Jamaica wins gold medals in the 100 meter and 200 meter sprints at the 2008 Summer Olympics, setting new world records of 9.69 and 19.30 seconds, respectively.

100 Meter

200 Meter

Posted by: Ibrahim Faisal | August 3, 2008

Download MP3 from e-snips

I got a nice way to download mp3 from e-ships where download option is not available.

Its nothing but a addons of mozilla called greasemonkey.

“Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to most HTML-based web pages. As Greasemonkey scripts are persistent, the changes made to the web pages are executed every time the page is opened, making them effectively permanent for the user running the script.” (wikipedia)

https://addons.mozilla.org/en-US/firefox/addon/748

Allows you to customize the way a web page displays using small bits of JavaScript.
Hundreds of scripts, for a wide variety of popular sites, are already available at http://userscripts.org.
You can write your own scripts, too. Check out http://wiki.greasespot.net/ to get started.

Once Greasemonkey is installed (you will see a little monkey at the bottom right corner),

one such script that adds a little Download link to e-snips is at
http://userscripts.org/scripts/show/16714

Posted by: Ibrahim Faisal | July 31, 2008

Blowing in the wind…

Anjan Dutt, Sumon Chatterjee is hugely inspired by Bob Dylan.
Many of their songs are adopted directly from him.
But what about Bob Dylan ? Who inspired him ?

The answer is my friend, blowing in the wind ;-)

Songs That Inspired Bob Dylan Parts 1 & 2

It’s really a refreshing program to hear. Enjoy !

Posted by: Ibrahim Faisal | July 29, 2008

An interesting story

A giant ship engine failed. The ship’s owners tried one expert after another, but none of them could figure but how to fix the engine.
Then they brought in an old man who had been fixing ships since he was a young. He carried a large bag of tools with him, and when he arrived, he immediately went to work. He inspected the engine very carefully, top to bottom.

Two of the ship’s owners were there, watching this man, hoping he would know what to do. After looking things over, the old man reached into his bag and pulled out a small hammer. He gently tapped something. Instantly, the engine lurched into life. He carefully put his hammer away. The engine was fixed!

A week later, the owners received a bill from the old man for ten thousand dollars.

“What?!” the owners exclaimed. “He hardly did anything!”

So they wrote the old man a note saying, “Please send us an itemized bill.”

The man sent a bill that read:

Tapping with a hammer…… ……… …….. $       2.00
Knowing where to tap ………. ……… …… $ 9,998.00

Effort is important, but knowing where to make an effort makes all the difference

Posted by: Ibrahim Faisal | July 24, 2008

Important links

Posted by: Ibrahim Faisal | May 4, 2008

Some questions on OO

What is Object Oriented Programming (OOP)?

Traditional programming languages (C, COBOL, FORTRAN…) follow a
structured programming model. In this model, data is separately stored
and procedural code processes data.

For example, in C, data is stored in structures and processing is done
by functions.

When used on large projects, this type of programming revealed several
weaknesses:
1. Not modular: Any of the data is accessible from any piece of code.
This made it difficult to demarcate the areas for different teams
working on a large project.
2. Not easy to fix: When we go back and make a change in one part of the
program, it is difficult to foresee and contain its impact from other
parts of the program.
3. Not enough code reuse: Even though function and subroutine libraries
were built to promote reuse of code, it was obvious that a way was
needed to reuse larger chunks of code.

OOP came in to solve some of the above problems. OOP bundles data and
the processes which act on that data into a single unit called an
object. Objects have properties to store data and methods to process
that data, all bundled into a single unit.

Think of structured programming as a centralized library where any
employee can get and replace books in any section. OO is like a
decentralized library where one employee is in charge of ‘fiction’,
another is in charge of ‘arts’ and so on. If employees in charge of one
section want a book from another, they can’t just go and grab it, they
have to ask.

What are the benefits of OOP?

Encapsulation: Objects hold together well demarcated units of
functionality. They hold all data and processing pertaining to that
functionality together. Objects are accessed through their public
interfaces by sending messages. No need to read all the implementation
code to check usability.

Code reuse: In structured programming only processing can be reused. In
OOP, inheritance allows us to reuse processing and data structures
bundled together.

Quality: Whenever we reuse code, quality improves. This is because
writing new code has potential for additional bugs. Reusing existing,
tested code minimizes the chances of additional bugs.

Maintainability: Implementation details are isolated from the interface.
Implementation code can be changed without any fear of breaking other
objects that access it. Because of inheritance, changes made to an
ancestor spread to all its descendants automatically. Because related
code and data is held together, it is easier for the maintenance people
to find what they are looking for in one place.

What are the origins of OOP?

The SIMULA programming language was the first OO language. It had all
the key ingredients of OOP, such as, objects, classes, inheritance, and
dynamic binding. It was created primarily to model or simulate real
world objects. It was designed and built by Ole-Johan Dahl and Kristen
Nygaard at the Norwegian Computing Centre in Oslo between 1962 and 1967 .

What are popular OO Languages and how did they originate?

At present, SmallTalk, C++ and Java are the OO languages in use by large
number of programmers.

Smalltalk: It originated in the 1970’s at the Xerox Research Center in
Palo Alto, California, USA. Alan Kay was the primary visionary who
borrowed ideas from Simula and LOGO as the basis of what was to be the
programming language of a portable, computerized notebook called the
Dynabook (at a time when computers were the size of a room!). After
several iterations, Smalltalk-80 was eventually created, in the early
1980’s.

C++: AT&T Bell Labs, New Jersey, USA is where C had been developed in
the 1970’s. C is flexible yet powerful, and it had been used to create
some of the most important software products of that decade. However, in
order to overcome some limitations of C while writing very large
programs, Bjarne Stroustrup, a computer scientist there, developed “C
with Classes” in 1980. According to him, his objective was to combine
C’s strengths as a systems programming language with Simula’s facilities
for program organizations. It was later renamed “C++” in 1983.

Java: In 1990, Sun Microsystems began a project to develop software for
use in consumer electronic devices such as, Personal Digital
Assistants(PDAs), VCRs and toasters. James Gosling began writing
software using C++ , but he soon realized that he needed a language that
is hardware independent (allowing the manufacturer to change chips) and
less susceptible to crashes. Gosling came up with a new language called
Oak. Oak retained the familiar syntax of C++, but dropped some of the
error-prone features of C++ such as pointers. Removal of unused objects
from memory (garbage collection) was added directly into the language.
In 1995 Oak was renamed Java, for marketing purposes.

Other OO languages are: Eiffel, Objective C, Ada 95,…etc.

Delphi (from Inprise) is a 4-GL tool which is based on Object Pascal,
which is a OO language. PowerBuilder (from Sybase) is a 4-GL tool which
has a lot of OO functionality.

What is an object?

An object is a piece of code which combines in a single unit both data
and the processes that operate on that data. Such a unit is called an
object. Other objects interact with it by sending messages to it and,
possibly, getting back results. Property or attribute is the term used
to refer to data stored in an object. Method or member function is the
term used to refer to the processing code.

What is a class?

A class is also a piece of code which is like a recipe. Just as you can
bake several cakes from the same recipe, you can create several
instances of an object from its class.

For example, you may create an object called cake from ‘my favorite cake
recipe’. The ‘my favorite cake recipe’ class would have data about
ingredients, gadgets… and so on. It will also have methods for mixing,
baking…etc.

What is an instance?

The terms instance and object mean the same thing.

What is inheritance?

Inheritance allows you take advantage of the commonality of objects in
modeling and constructing large software programs. Inheritance also
makes possible code and structural reuse.

Let us say your analysis of a software project shows that you will need
three similar objects. In OOP, you will create an ancestor with what is
common among those three objects. You will then inherit from this and
make some small changes to create the three descendants.

Supposing you already had a ‘my favorite cake recipe’ class, which you
know gives good results. If you wanted a different topping, will you
start from scratch? No, you will bake the cake following your tested ‘my
favorite cake recipe’ and as a last step finish it with the needed
topping. Thus using a known class to create variations is called
inheritance.

What is encapsulation?

When you write the code for an object, you want to make sure that other
objects can call and send messages to it. So, you will want to make sure
its interface is accessible to other objects. However you will also want
to make sure that its implementation details are not accessible to other
objects. This gives you a free hand to make changes to the
implementation details later without worrying about breaking the code in
other objects that call it. This process is known as encapsulation. OO
languages help you do this by letting you declare properties and methods
as private, protected or public.

For example, when you go to the supermarket to buy a replacement
electrical plug for a home appliance, for a given rating your main
concern is that it should fit the wall socket. With the same size, shape
and spacing of the plugs, the manufacturer is free to make changes or
improvements inside. You need not know nor care what those details are.

What is polymorphism?

Polymorphism (“poly” means “many” and “morph” means “form”) is the
ability of an object to to take different forms. To be more precise, it
is the ability of a reference to an object to refer to different objects
at runtime. Without this feature programs will have large switch (or
case) statements to handle variety of objects. Also, when more such
objects are added, this switch statement has to be extended to
accommodate them. Thus polymorphism lets you write generic code that
will work not only for a range of existing objects, but also for objects
to be added later.

This is typically accomplished through inheritance of classes. (Java
makes use of inheritance of interfaces to provide polymorphism.) A name
may denote objects of many different classes that are related by some
common ancestor. Thus any object denoted by this name is able to respond
to some common set of operations in different ways. Polymorphism is
often considered the most powerful feature of an OOP language.

To take a general example, let us say that a bank sends a letter
offering loans at low interest rates with the address “The current
resident” at a given address. Whoever is occupying that address at the
moment could receive that letter and respond to it. One resident may
apply for a car loan, while another may need a business loan… and so on.

To take a programming example, let us say that you are writing a program
that deals with polygons. Your triange class can have its own
triangleArea method, your rectangle class can have its own rectangleArea
method and your pentagon class can have its own pentagonArea method. If
you want to let the user pick a shape and get the area, you need to have
a switch (or case) statement. This is the non-polymorphic way. With
polymorphism, you will have a single method ‘area’ in each of these
classes, however, with their own implementation code. The object will be
switched at runtime, depending on user selection, so that the
appropriate method is called.

What are properties or attributes?

Data stored by each object is known as its property or attribute.

In ‘my favorite cake recipe’ class, the quantity of baking soda, for
example, is an attribute or property.

What are methods or member functions?

Processing code in an object is known as its method or member function.
Some people also call this behaviour.

In ‘my favorite cake recipe’ class, the mixing procedure is a method or
member function.

What is multiple inheritance?

Multiple inheritance occurs when a class inherits from more than one parent.

For example, if you need a watch-cum-calculator, you can inherit from a
watch and a calculator so that you get both functionalities.

If inheritance is good, multiple inheritance should be great, right?

Not necessarily. With single inheritance, whenever you refer to any
attribute or method name in a descendant, it can be simply looked-up
from the lowest ancestor. In a multiple inheritance hierarchy, since
several distinct parents can declare an attribute or method of the same
name, which to choose becomes a problem. This is known as name collision.

C++ declares an error if a conflict arises, but a class qualifier can be
used to explicitly clarify. Smalltalk does not support multiple
inheritance. Java does not permit multiple inheritance of classes, but
provides multiple inheritance of interfaces.

What is typing?

Each programming language provides some primitive types such as integer
and boolean. Once you define a class, it is treated as a user-defined
type by OO programming languages. You can then use it just like a
primitive type to declare a variable, store it in an array, pass to a
method… and so on. This is what is referred to as typing.

I read that Java is a strongly typed language. What does this mean?

In a strongly typed language, type checking is done at compile time.
This is very good for stability (there are less chances of errors at
runtime) and improves reliability. This is also known as static typing.
C++ and Java are examples of languages with static typing.

What is dynamic typing?

Dynamic typing allows for type checking of objects at run-time. This
makes the language more powerful by allowing better flexibility.
Smalltalk supports dynamic typing.

What is dynamic binding?

In C++, a class can have a virtual function and its descendants can
override that function by their own individual implementation code.
Wherever the ancestor object is used, you are allowed to substitute it
with its descendant object at runtime. This is known as dynamic binding,
late binding or loose coupling. This is how C++ provides polymorphism,
even though it has static typing.

What is abstraction?

Abstraction is most often used as a complexity mastering technique. When
you are doing OOA, you need to do some abstraction in order to find a
pattern of common base objects. In other words, you need to look at the
highlights without getting bogged down with the details.

*What is specialization?*

To create a subclass from a parent class is specialization.

If you have a base class ‘polygon’ and if you inherit from it to create
a descendant called ‘triangle’, that is specialization.

What is generalization?

To pull together common parts of derived classes into a common base (or
parent) is generalization.

If you find that you need three classes ‘car’, ‘truck’ and ‘bus’ and
decide that it will be better to have a common base class called
‘automobile’, then that is generalization.

What is overriding?

Overriding is the term used in C++, for example, for redefining a method
in a derived class, thus providing specialized behavior. Whenever a
method is invoked on an object of the base class, the derived class
method is executed overriding the base class method, if any.

The difference between overloaded functions and polymorphic (overridden)
functions is that with overloaded functions, the correct function to
call is determined at compile-time; with polymorphic functions the
correct function to call is determined at run-time.

What is an interface?

An object may have many attributes and methods. However most of these,
namely the implementation code, should not be accessible to other
objects. Only a few methods should be accessible to other objects, so
that they can send a message and, possibly, get a return value. These
methods are known as the interface.

What is garbage collection?

In structured programming, you had data and your functions processed
them. But in OOP, you have to create objects when needed and you have to
destroy them when done. If not done properly, this could lead to
dangling pointers, orphaned objects and memory leaks. Such problems are
hardest to debug.

Some of the OO languages, such as Java, have a built-in mechanism in the
run-time system to automatically destroy objects which are no longer
used and reclaim memory. This is known as garbage collection.

What is Object Oriented Analysis (OOA)?

In order to make the best use of an OOP’s features , you must start
early. At the time of analysis itself you must start looking for
potential objects with well-defined outlines. You must also look for
patterns to identify sets of objects with similar attributes and
methods. This is known as OOA.

What is Object Oriented Design (OOD)?

Here you will identify ways to organize your program into base classes,
inheritance structure, clearly defined interfaces… and so on. This is
known as OOD.

What are Use Cases?

Use Cases are a technique for formalizing the capture of what the
requirements of a system are and how it works. The reason for formally
capturing the scenarios is to make them available for review by both the
users and the developers. What Use Cases do is capture in an
implementation-independent manner what the needs and expectations of the
users are.

Even though it is not exclusive to OO, it is a popular technique for
documenting the user requirements before starting on the design of a system.

What is UML?

The Unified Modeling Language (UML) is emerging as the
industry-standard language for specifying, visualizing, constructing,
and documenting pieces of software systems. It simplifies the complex
process of software design, making a “blueprint” for construction. The
UML definition was led by Rational Software’s industry-leading
methodologists: Grady Booch, Ivar Jacobson, and Jim Rumbaugh.

Again, UML is not exclusive to OO, but combines several popular
modelling techniques, including Use Cases.

I am moving from C to C++. What should I do to get the benefits of OO?

OOP is more than learning a new language; it requires a new way of
thinking. When we move to OO, we must no longer think in terms of data
structures and function/subroutine libraries – we must think in terms of
objects. This is the hardest part.

Try to start early, at the time of the analysis/design itself. This will
give you an opportunity to visualize similar objects, base classes and
so on. However, if you are already into programming, look for
opportunities to specialize and generalize. If you are creating a new
class, see if you can inherit from an existing class and modify slightly
to get what you want. If you find yourself writing similar code over
again, see if you can combine them into a common base class.

What are Object Oriented Database Management Systems (OODBMS)?

OODBMS are databases that support objects and classes. They are
different from relational databases because they allow entire objects to
be stored and also support methods and inheritance. OODBMSs claim to
provide synergy when used with object-oriented programs.

Posted by: Ibrahim Faisal | March 5, 2008

Mohammed Rafique Done It All

Md. Rafique DepartsMohammad Rafique has been there and done it all, having played for Bangladesh since 1995, and then for most of their Test history. He now leaves the international scene as the team’s leading wicket-taker – his 100th Test wicket came in what will in all likelihood be his last Test, against South Africa at Chittagong.

http://content-ind.cricinfo.com/ci/content/player/55973.html

Posted by: Ibrahim Faisal | January 28, 2008

Adam Gilchrist: An opponent you love to love

331324.jpg
Adam Gilchrist, who revolutionized the role of the wicketkeeper-batsman, has retired from Tests. He (Adam Gilchrist) has decided to end his test career.
Great loss. Gilchrist was certainly the greatest wicketkeeper batsman ever to have played the game.
I am really going to miss him.
Posted by: Ibrahim Faisal | January 23, 2008

Some necessary tips

Here describes some practical tips for successfully leading a team of software developers. It defines what success means and then describes some very common sense tips for achieving that success.

What deems a project to be successful?

The primary goal of any software project is to meet the user requirements and make sure the users are delighted. If something has been built that nobody wants, it makes no difference what happens to staff turnovers, budgets or training. If requirements are not met, the project is a failure. The next goal after requirements is probably to complete the project within the required budget. After that, there might be others requiring staff to be trained, and so on.

Here are a number of tips for team leaders to help them achieve success in their own projects.

Meet the correct requirements.

Getting the right requirements from the client warrants an entire article itself and is out of the scope of this article. The key once you have a set of requirements is to make sure that you only build those, nothing more and nothing less. Very often you find developers who like to ‘guess what the users want’ and ‘build things that are ‘very cool’. I’m sure you know the type. You need to build a culture where creativity and suggestions are actively encouraged, but ensure that those suggestions are relayed to the requirements manager, and not immediately built by the developers. To drill this into developers I often ask them how they would feel if they went back to a garage to pick up their car after a basic service, to find that the garage had decided to upgrade the engine to a new one, and that it would cost 5 times as much and not be ready for another week.
Tip 1: Stick to the defined requirements. Don’t guess them yourself. Don’t spend time and someone elses’ money building something that isn’t asked for, and very probably isn’t required.

Manage Risk Early

Focus entirely on the risks of the project and mitigate them. This is the role of the team leader. Building a piece of software is like trying to rob a bank. You don’t want to get caught by the cops. The cops in a software project are all the risks that will stop you achieving your goal. These risks will range across the board from requirements risk, to environment risks, to technical risk. Example1: You finish the entire code base on time, to find out that you needed to raise a change request two weeks ago to get the software released into the live environment. Example2: If you cannot integrate with Bloomberg for currency rates, then it makes no difference whether you write screens for cross currency transfers.

Tip 2: Write down all the project risks, and make sure everyone in the team knows what they are. mitigate them as early as possible.

Keep it simple

Keep the design of your code simple. Build only what you need now, and avoid ‘future proofing’. Again, this is a change of culture for many developers. Most developers like to try and design the most flexible solution to a problem that will future proof them should the user ask for a, b, c and d etc. This is wrong. Complex flexible solutions take longer to write, are harder to debug, and the user hasn’t asked for them. How many times have you found future proof code written which was never used. Think of how JIT (Just In Time) manufacturing works. You start to build things just in time for them being required. If you hold stock (over engineered code) it costs time and money to maintain it. Build the simplest thing that will work. It is cheaper and will be released quicker enabling you to get feedback from the users sooner.
Tip3: If the users ask for a Mini, build a Mini. Don’t build a Mini with a Rolls Royce under the bonnet. Keep it simple and build the simplest solution that meets the requirements.

Feedback, Feedback, Feedback

The majority of money spent on software projects is spent after they have been released, and are spent on changes and enhancements to the software. This is due to a number of reasons. One often cited reason is that users don’t know what they want until something is built that they can use. This is why prototyping can be useful. [Beware of prototypes too early in the requirements extraction stage though. Prototypes focus the user too much towards system requirements, rather than business requirements and business goals.] Still, getting software released as early as possible, and getting continuous feedback from the user is key. It mitigates the risk of building the wrong thing.
Tip 4: It is very likely that the requirements will change, so get something out quick and get feedback as soon as possible. Engage the users as often as possible.

Know your team

et to know your team. Every software developer is different. The productivity rate of one developer could be up to ten times quicker than another. Some developers are good and enjoy repeatative tasks, others don’t. Some will tell you the task will take ‘another 5 minutes’, when in fact it will mean a week. Some will like to build a Rolls Royce when a Mini is required and will take 10 times less time to build. Some will write poor quality code that isn’t fit for release. Others will spend too much time focusing on fixing minor bugs rather than moving onto show stoppers. Some developers don’t test their work. And so on.
Tip 5: Know your team. If you don’t know your team then their ‘surprises’ will present a risk to your deadlines.

Time Estimates

Most developers do not factor development, build, integration, debugging and testing into their estimations. To avoid surprises at deadline dates make sure the developers give you time scales that include the whole life cycle. Write down their estimates and get buy in from them. Use them to feed into subsequent estimates.
Tip 6: Make sure estimates from developers include the whole life cycle.

Refactor The Code

Hopefully you are no longer building complicated frameworks from the start and are focusing on keeping the code as simple as possible to meet the requirements. This gives you quicker delivery and mitigates the risk of building the wrong piece of software. However, you need to make sure that you also continually refactor the existing code base to avoid it rotting. This means changing the structure of the code internally, without changing the external behaviour of the system. You are now evolving the design of the system along the way, rather than trying to guess the whole design up front. Note though, that in order to go down the route of evolving design with refactoring, you really need automated tests.
Tip 7: Refactor your code to avoid it rotting. Back this activity up with automated tests.

Automate Testing

Show me a developer who always tests their code and I’ll introduce you to Father Christmas! They just don’t do it. Automating both your unit testing and system testing makes you develop quicker. You have exhaustive sets of tests that run quickly, are documented, are standard, and are repeatable. They also support the refactoring activity. For more on this see my other articles on Test Driven Development , and Developing Tests With NUnit 2.0 .
Tip 8: Automate the testing of the application. It massively increases quality saving you an enormous amount of time having to do manual ad-hoc testing and debugging. It also enables you to do effective refactoring.

Manage Your Problems

Make sure you keep track of all the issues and risks on the project, and also track your bugs. Prioritise them and deal with them accordingly. If you don’t formally log them, they will get lost and you run the risk of not resolving some important issues raised.
Tip 9: Log and manage the project issues, risks and bugs.

Justify New Technology

Don’t use technology just because it is new. Developers like to open all the new presents that the market constantly tries to claim as the next silver bullet. Some new tools are great, but make sure that developers justify their use in terms of the value they will bring to the project. Being ‘cool’ is not a business reason.
Tip 10: Use new tools only if they provide business benefit.

Posted by: Ibrahim Faisal | January 22, 2008

Internet Joke

Customer: “I want to download the Internet. Do I need a bigger hard disk?”

Download internet here

Older Posts »

Categories