November 22, 2007
October 24, 2007
October 19, 2007
OOPs
Inheritance Vs. Composition vs Parameterized Types:
Inheritance - white-box-reuse. Internals of parent class visible.
Inheritance defined at compile time. Possible to modify implementation. (overriding)
Disadv - Parent class influence the physical representation.
Composition - black box reuse. No internal details visible.
Composition - defined at run time. Wont break encapsulation. Class hierarchies will remain small.
General rule of thumb - Prefer Composition over Inheritance.
Parmeterized Types - Generics , Templates
Inheritance - white-box-reuse. Internals of parent class visible.
Inheritance defined at compile time. Possible to modify implementation. (overriding)
Disadv - Parent class influence the physical representation.
Composition - black box reuse. No internal details visible.
Composition - defined at run time. Wont break encapsulation. Class hierarchies will remain small.
General rule of thumb - Prefer Composition over Inheritance.
Parmeterized Types - Generics , Templates
October 18, 2007
Soul touching renditions
By Nusrat Fateh Ali Khan
Tere bin dil naiyo lagda - http://youtube.com/watch?v=rrfITzLhCqM
Afreen Afreen - http://youtube.com/watch?v=zmB8yt-wf7A
Piya re - http://youtube.com/watch?v=7oscIjdZix8
Tere bin dil naiyo lagda - http://youtube.com/watch?v=rrfITzLhCqM
Afreen Afreen - http://youtube.com/watch?v=zmB8yt-wf7A
Piya re - http://youtube.com/watch?v=7oscIjdZix8
October 14, 2007
Short n sweet
I came across this algorithm - Sieve of Eratosthenes to generate prime numbers from 2 to n.
public boolean[] sieve(int n)
{
boolean[] prime=new boolean[n+1];
Arrays.fill(prime,true);
prime[0]=false;
prime[1]=false;
int m=Math.sqrt(n);
for (int i=2; i<=m; i++)
if (prime[i])
for (int k=i*i; k<=n; k+=i)
prime[k]=false;
return prime;
}
September 03, 2007
Some lines these
A love is immortalized even as it dies...
A union is celebrated even as it breaks...
A hero is born, even as he is defeated...
A union is celebrated even as it breaks...
A hero is born, even as he is defeated...
September 01, 2007
Java Lessons - part 1
My java learnings for the day -
1. Always implement toString - It seriously is a pain for otherwise to decode the object.
2. Be aware of memory leaks! Nullify object references when required but NOT always. At times trust the garbage collector ;).
3. Evaluate static factory methods vs. constructors.
4. Singletons are a great way to ensure single object instance.
5. Object creation is costly! It hurts performance many times over. Create only when you should.
1. Always implement toString - It seriously is a pain for otherwise to decode the object.
2. Be aware of memory leaks! Nullify object references when required but NOT always. At times trust the garbage collector ;).
3. Evaluate static factory methods vs. constructors.
4. Singletons are a great way to ensure single object instance.
5. Object creation is costly! It hurts performance many times over. Create only when you should.
August 24, 2007
Not again!
Sachin out on 99! Not again :(
Tondulkar is missing it by whiskers time n again so often these days :(
Damn it.. I get back to watching Friends.
Tondulkar is missing it by whiskers time n again so often these days :(
Damn it.. I get back to watching Friends.
July 20, 2007
Lost in the wilderness
A bunch of toys
The little best doll
Cycling to school
The paperboat adrift
Hide and seek
Dance in the rains
Lost in the wilderness
A lullaby
A squirrel's run
A breath of fresh air
Green and green fields
Mountains to climb
Roads to run
Lost in the wilderness
The touch that would heal
The kiss that would seal
The bosom that would feel
Lost in the wilderness
Love all around love
Hearty Heaven above
All that peace dove
Lost in the wilderness
The little best doll
Cycling to school
The paperboat adrift
Hide and seek
Dance in the rains
Lost in the wilderness
A lullaby
A squirrel's run
A breath of fresh air
Green and green fields
Mountains to climb
Roads to run
Lost in the wilderness
The touch that would heal
The kiss that would seal
The bosom that would feel
Lost in the wilderness
Love all around love
Hearty Heaven above
All that peace dove
Lost in the wilderness
July 16, 2007
Subscribe to:
Posts (Atom)