Tuesday, July 04, 2006

Some basics of Java which I regularly forget

  1. Real numbers are treated as double unless specifically flagged as float by marking the value with an 'F'
  2. java.io.File is a pointer to the file rather than a reference to its location and by itself does not encapsulate the physical file.
  3. Integer values are treated as "int" rather than long,
  4. so long micros = 24*60*60*1000*1000 would result in a value different from expectation. so flag the values with an 'L' if you don't want them to be messed with
  5. When using BigDecimal, pass a String representation of the double value rather than the double value to the constructor.
  6. Use fill with GridBagLayout else the component won't occupy the grid area
  7. painting is at two level, System event; when a component is added or removed and VM event; when a component is resized

Why A tech blog

Well I was finding it difficult to write into books with my "genius" handwritings about my explorations in the tech world. Problem was not the writing, problem was the lookup at a later date. I have this tenacious habit of dragging the last 2-3 characters of everyword into a straight line and the result-you can guess. So finally decided to overcome my shyness to blog. So this blog is about WORK; work as in findings and researches in the bread and jam arena. No musings about economics, psychology literature here. Only Technology and technology.
Some Introduction: I started as a C programmer, made an easy migration to C++ and then was lost for a JOB. So took up VB training, then did some work on graphics in Borland C++ and then Java hit the world. Learnt java on my own and with the help of quite a few mentors (Rajasekharam Sir, Jagan Sir, Durga Anna, Praveen, Prashant and a host of others- hope you are reading this). Started working with JDK1.0 and looking back makes you realise that Java programmers of today have it a lot more easier than my peers and me. But if asked to do it again all over, I would certainly do it. My advice to any programmer is this - "Get your basics right". Basics as in 2+2 = 4 and 2*2 = 4 My work during Borland C++ made me do matrices once again (something I thought I left behind when I took up commerce stream for graduation); only to hit me 4 years later. And then I realised that Mathematics is a must - commerce or engineering stream being immaterial. This is the second basic requirement. Not because of the cliche statment of "Maths improves your logic etc". Logic my foot. More because programming is actually 2+2 and nothing more. Well not exactly ;)
Its been a long journey. Java has been my rozi-roti; so cannot ditch it and I ask all those who use eclipse, or netbeans or such IDDEs : "Did you use to write code this in notepad or god-help-you DOS edit before using IDDEs?" If the answer is no; then I would suggest you do that first. IDDEs really spoil the creativity of the beginners. I must say IDDEs are not for beginners.
I beg pardon, I write majority of my code in an advanced text editor - EditPlus.

As days progress, I intend to publish my findings which people can use, share but not plagiarise since what I find might be actually a collation of other findings. And where possible I would credit the individual concerned and where not possible, I would address them as Angel benefactor unknown.


Happy Coding