2006/03/11

More on external influence ...

One factor that does affect the path(s) that you choose (as anyone - a developer, an engineer or an artist) is the kind of people you tend to come across. The good people I mean. And some people who influenced me to quite an extent include the following (in no particular order ...)
  • Srinath aka Mulla - Introduced me to ctags. And impressed people with a lot of funky vim scripting stuff!
  • Chirag Kantharia - Another cool hacker.
  • Sitaram Iyer - have already mentioned him in some other post. This guy could code faster than most others could even think! How fast did he think?
  • Sachin Sourav - Hmmm ... he seemed to know most of the arcane stuff always!
  • Kailash aka Kelly - Exploits, buffer overflows, machine code. Whatever!
  • Amitay Isaacs - Well, he was considered to be the God of the network of our campus, and did really cool stuff. Had an indirect influence - mostly through third party tales about him!
It's always good to come across good people, whatever field you are in. They raise the bar, and the passing minimum moves up by quite a margin. You are pushed to do something good!
Make sure you don't miss out on the good people around you!

Let there be a class!

Suddenly, eveything started becoming a class. Or, atleast, most of the things. To struct or to class?
Didn't make much difference in performance. But class allows one to make members/member-functions private and protected.
Now, you must have heard this saying (of sorts) - 'If you have a hammer, every problem looks like a nail!' Similarly, you are tempted to fit all your functions into some class. So much so, that you might end up declaring/defining classes entirely for the purpose of fitting some function somewhere!
OO is a good technique (if you got me wrong ...) - but how it should be applied comes only with experience. And experience is something that doesn't come only with time, sadly. You need to be exposed to good people, good projects, and sometimes, good search engines!
Another thing that you get with experience is this - you know what exactly to look for in a given situation. Or, approximately exactly.
I can say all this with the benefit of a lot of hindsight. Don't expect me to be absolutely right though. Because my hindsight next year would be definitely better than my hindsight today.
And for those who have reached this paragraph - I suggest you read this nice article by Scott Meyers. (Warning: The article's website needs you to register.)

So, what's with C++?

Is shifting from C to C++ supposed to be exciting? What changes?
Well, from nothing for some, to everything for some. And some fall in between.

A friend (Balsree) would program in a language he used to call (rightly!) C+. That's nothing but coding in C, with the freedom of getting to declare variables anywhere in the function, and using the C++ compiler to compile. C++ didn't particularly entice him, except for this thing.

And some tend to think - 'C++. Ok, I'll have classes, members and member functions ... encapsulation ... well-designed coupling/cohesion.' That was what I started off like.

And of course, all the new datatypes available with C++ seemed to be exciting too! The simplest and most interesting for beginners, I reckon, must be the string class. Maybe, cout/cerr are much simpler - but I didn't seem to be very keen on using them because I didn't realise their power immediately.

The STL had to wait. As a newbie, it's hard to even think about them. The syntax, to begin with, seemed so weird! 'Who in this world came up with such a syntax?'
So, my first C++ implementation of hypar was without any template code of my own. Some borrowed code, which seemed to work with my classes (and were needed for hashing) seemed to do the trick, was included.

Thus, started my tryst with C++. Even today, almost 5 years down the line, I seem to discover new things, and get scared at times of some syntax-constructs! (See boost source code.)

2006/03/09

Editors?

I am a Vim guy, of course! And nothing but GNU/Linux works for me!

CS101 was a Fortran course, and I used vi on Linux. (Sorry, RMS, I can't use GNU/Linux everywhere, but I do really mean it. And after meeting you, and attending your talk, I do appreciate the need for using "GNU/Linux" everywhere, but it's just not feasible for me! I try to use it once in the beginning ...)

vi was a real pain. No, I am not criticizing it! vi was written for some specific reasons. See this for some idea. So, I moved over to pico. Atleast, it was much more straightforward, and the menu at the bottom helped too. Let me confess, though, that at that time, both vi and vim meant the same thing to me. I only knew that vim was an improved version, but had no idea what the improvement was. Moreover, pine was another reason I moved to pico - atleast, editing code or email didn't mean I had to switch my keyboard handling contexts (mentally).

I was the first webmaster of Mood Indigo - something I did for MI 96, 97 and 98 - and I had the great fortune of getting in touch with Sitaram Iyer during the course of some MI-related work. He is one of the best hackers I've ever come across! Anyways, the point is this - I was completely swept away by the things that he did with vim. And there was no looking back. An escape for a week from the world of pico (and with a lot of associated pain) meant I escaped to vim forever.

Some pain points remained - What about pine? Well, it allowed using vim as the mail editor! Saved! :)
But it wasn't all that comfortable a feeling. Mutt soon won me over.

So, now for all my programming work, it's vim, exuberant ctags, and the GNU Compiler Collection.

(In one of my posts, I think I'll write something about vim (version 7), ctags, and something that I have very recently discovered - which helped me decide against playing with Eclipse, by the way - icomplete. The combination is just awesome!)

C++

Couldn't think of any proper title.
I started programming with Fortran. (Had some brush with Basic and Pascal, but nothing worth writing about.) I enjoyed Fortran enough. In fact, so much, that when I wanted to get some "advice" on whether I should be learning C from a senior (Ramkumar), my question was worded something like - 'Well, I can do most of my stuff with Fortran, right? No need to look into C, right?'

Hmm, somehow discovered some virtues of C. I did not know how to write functions in various files in Fortran, and how to re-use code, or how to dynamically allocate memory for interesting stuff. Maybe it was (or now, is) possible in Fortran. But I had absolutely no clues! But all that seemed easy in C. So, move over Fortran. Here's C ...

My final year project, where I did something related to Finite Element Analysis of structures, involved coding in C. And then, there was a numerical programming course, where I used C. So, I knew C somewhat by the time I graduated (undergraduate thing, that is)

Then, post-graduation time. As part of my Masters work, I developed HyParSuite. The first version was in C. HTML parsing code, stacks for storing elements, and all that stuff - all in C. I felt like an accomplished C coder! (Of course, the truth was no-where near that ... but feeling good about yourself is a good sign. It helps you be positive, and become better. So, my advice to anyone who cares - always carry a feeling of being one of the best! :))

Then, during one meeting with a friend - Mukul Joshi, who was another Masters student working under the same guide as mine - mumbled something about C++ and the power of templates. (Hrrmm ... he said something clearly, I suppose, but I felt he mumbled something. Because I couldn't make head nor tail of it!) But I liked the word - template. Sounded interesting - and felt like something that saved time. Indeed it is something of that kind, but for a first-timer to that word in the C++ context, the impact was spot on! I knew I had to learn C++.

And then, started the journey. I am not sure if I can capture all the new things I've discovered, or if I can, the sequence would be exactly right. But then, I am going to try.

Note: I had read quite a bit about OO principles, SmallTalk, and had done some Java programming too before this time.