MonthJanuary 2012

My First Program

Note: These are almost a decade old. Reproduced as close to memory as possible

My first memories of programming aren’t actually C. They were GW-BASIC, and later on, LOGO. I don’t remember any of my BASIC – but I do remember the look on my computer science teacher’s face in 5th grade when I managed to draw a flower with LOGO when everyone else was doing rectangles and lines. I vividly remember it – you draw an arc for a certain length, then stop, draw another arc in the reverse direction for the same length – and you have a petal. Then you just offset your next arc by a few degrees, repeat the previous thing, and you have another petal. Do this a few times such that offset-degreese * count = 360 and you have a flower. That I could just modify the variables length and offset-degree to draw flowers as big, and with as many petals as you want – it blew my mind. This was in 5th grade – and I immediately started pestering my parents to put me in a programming language class outside (I had already gone to classes for coughMS Officecough and DOS back then). And the SSI nearby happened to be teaching a reasonably cheap Unix/C/C++ class.

The first thing I remember still is someone telling me “you don’t need to type out clearscreen(); – clrscr() would do”. This was TurboC, and to me, at that point of time, a ‘good program’ was one that had a getch() call at the end and a clrscr() in the beginning :)

The Unix/C/C++ course – I don’t remember any Unix in it. And the C++ was disinteresting to me, because I saw no point in inheriting mammal from animal or car from vehicle. So I went about writing ‘C++’, which was basically C but with cout and cin instead of printf() and scanf() (I wouldn’t understand classes and how/why they were useful until I read Hardcore Visual Basic 5 and saw the ways classes are useful and how much it sucks that VB doesn’t have them).

I had written a program called DOSTutor then (end of 5th grade, I guess?). It had screens and screens of text that ‘taught’ you DOS commands, and then ones that made you type them in and ‘checked’ it. Initially I had written it as a long series of printf() and scanf() statements. Suddenly some bulb went on and I realized I could cut my program size by about 90% if I separated code and data, and put the data (screen text and responses) into arrays. The feeling you get when you can reduce code drastically with no reduction in functionality (+ easier to make ‘fixes’) is quite incredible :)

But nobody ever used that program, so I wouldn’t consider that my first ‘program’. I spent the next year or so messing around with random sound() and nosound() calls producing ‘music’ (including a few times when my code hit the sound() call, but crashed before the nosound() call – thus making the PC Speaker whine constantly, without any apparent way to turn it off. I used to just reset the computer then – until I learnt what exactly a DOS System Call meant. Then I wrote another small program that just called nosound()). I also remember messing around with BGI Graphics, mostly taking the example programs for graphics.h and modifying them to make somewhat-pretty figures.

My first ‘real’ program was an implementation of a variant of Book Cricket. It even had a stored High Scores file. It was my stint at a ‘programming center’ (SSI, for those who remember), and I kept it in a Network Drive that I accessed using ‘Map Network Drive’. The amount of fun that was had when I discovered rand() was quite something. It even beeped when you got out!

I lost it all in a server crash. Just do ‘Map Network Drive’ once and it was no longer there. I think I came home and cried :(

What was your first program?

DevLog: December 26, 2011 – Jan 3rd, 2012

Back in Chennai

  1. Moving yuvi.in to my prgmr server. I want wordpress for my blog, but I don’t want to run MySQL. Solution? Keep blog where it is (with the awesome webfaction people!) and use nginx to proxy requests to blog/. Seems to work, so yay!
  2. Rewrote tawp.in to use python/flask/memcached. Available on github. Replaced older node.js version
  3. Reading through The Art of Unix Programming on kindle. Amazing book so far.
  4. Fixed a few more bugs on Wikipedia App. I think I’ll keep ‘official’ Wiki related stuff off this, unless it’s big?
  5. Partied along new year’s. Yay. Not particularly ‘dev’, but still :)

© 2017 Yuvi Panda

Theme by Anders NorenUp ↑