views:

929

answers:

41

To me it was the If statement, I'm psyched up, since then I believed that computers are very intelligent, or I can at least make it appear intelligent because of it.

+6  A: 

Making the computer obey me. Awesome.

I also love (love to hate) that the computer will obey even when I'm wrong.


But seriously folks.

I was hooked when:

  • I saw that you can do rich and dynamic things with code.
  • That the machine is generally consistent.
  • That programming is like math in the sense that for all the "it depends" out there, we still have more than our fair share of questions with actual, provable answers.
  • That I could automate menial tasks with logic and loops.
Michael Haren
+1  A: 

When I was first learning, I think arrays for sure. Before that I really just thought in terms of single variables. When I learned about arrays, I was able to do a lot lot more with my qbasic :).

Now I have all sorts of data structures available, not just arrays :)

Doug T.
+16  A: 

For many of us who were introduced to computers in the late 70's or early 80's, the first program we saw looked like this:

10 PRINT "Commodore sucks!  "
20 GOTO 10

("Commodore" could be replaced with "Apple", "Atari" or "TRS-80").

GOTO is awesome.

Kristopher Johnson
I got hooked on the same program! I used "Hello" though (not knowing of "Hello World!" at the time...) Infinite loops FTW.
DavGarcia
Ofcourse "Commodore" MUST be replaced by Atari. Ataris are for weenies. ;-)
EricSchaefer
Yes. Goto was the first construct I ever was exposed to. I remember making stuff dance across the screen on my C64 :)
Stephen Cox
Wow! BOTH uppercase and lowercase characters in the same program! This was pretty advanced stuff!
DrJokepu
Did the same with my name. :)
Arnis L.
A: 

Functions as a programming construct. No matter how big the problem, I could break it down into sensible calls to a set of functions. If the problem to be solved by any one function was too big, I could break it down as well (we didn't call it refactoring then). Sooner or later, I thought, I could solve anything by just finishing the functions.

More generally, I was hooked on development when I realized that I could create processes that determined how a team, a department, a business, or even an entire industry would work. And that I could help them work better and faster.

Mark Brittingham
+6  A: 

Started out in QBasic, so, I think it was something along:

INPUT "What's your name?", a$
PRINT "Hi, "; a$; "!"

Being able to show something on the screen with PRINT was enough to get me excited about programming. Interactivity using INPUT was icing on the cake!

coobird
+1  A: 

For me it was Pointers.

Whilst I won't even pretend to fully understand pointers it was the first time that I really got stuck with programming. After messing around with Visual Basic 6 and server-side scripting languages I moved onto C, picked up the bare basics, then met pointers.

During that lecture I can remember peoples reaction to pointers. Self-proclaimed programming gods cowered in fear, those that knew little started reading the job ads in the local papers. I actually remember one girl in my class saying "whaaa?"

Many programmers get a wake-up call when they hit pointers. The programming world has just introduced you to the world of Computing and if you've only really just met you'll find very little to talk about.

EnderMB
+3  A: 

Pointers.

When I started programming in Turbo Pascal, I really couldn't understand, how the heck they write big programs. Memory was limited, and whatever I was trying to do - I would often hit the stack limits.

When I finally was introduced to pointers I was finally hooked, because I could finally start making something big! Not that I made anything big, but... :)

Paulius Maruška
+1 pointer was a real eye opener
Dead account
+2  A: 

For me, it wasn't a specific syntax - it was finding out I could break out and change ZX Spectrum games - I guess discovering source code is what got me hooked.

Then, when I actually started programming, and was copying code from books, being able to customise what was in the book and have the program still work, but how I wanted.

Peter Boughton
+1  A: 

I remember the first computer problem that truly fascinated me. It was a problem I got in my highschool programming class.

Write a program that will read a number from the console

Why did that fascinate me? Well it didn't at first. I wrote a quick and dirty program that did the deed but then the teacher did something quite unexpected. She entered "a" into the program and it died a horrible death.

It took me the rest of the day to deal with evil input but eventually I got it working. This process completely hooked me on the idea of program correctness.

JaredPar
+3  A: 

When I first started learning programming with QBASIC the whole idea of flow control using if statements and loops was great. I think it was just a few days after I learned about the if statement that I built my first "Choose your own adventure" game. Looking back I know it must have been horribly inefficient and massive in terms of lines of code, but the fact that I could branch the story using nothing but if statements was wonderful.

TheTXI
+1  A: 

IF-GOTO.

No joke. I was hooked long before I got such a language as had pointers.

I had already written pointer-like algorithms using array indexes by that point.

Joshua
+10  A: 

Answer #2 :)

The actual language construct that first really fascinated me was recursion. The problem

Write a function named SumDigits which summed the digits of a number. Example: SumDigits(1234) -> 10

At first I wrote a very long iterative solution. But after awhile I came up with this answer.

string SumDigits(int value) {
  if ( value > 10 ) {
    return SumDigits(value/10) + (value%10);
  }
  return value;
}

The succinctness of the answer amazed me and I instantly found a new love in recursion and terse programming.

It only took a couple of weeks though to learn the evils of recursion :)

JaredPar
What are the evils of recursion? (Beyond being aware of what happens on the stack and languages that suck at optimising tail calls.)
ShreevatsaR
@ShreevatsaR, I was mainly refering to hitting a stack overflow.
JaredPar
Yes, and rewriting this algorithm to not use recursion would not be hard.
Brian
+2  A: 

? "HELLO WORLD"

Leon Tayson
+2  A: 

From my first BASIC book (BASIC for kids I believe):

10 INPUT A
20 INPUT B
30 LET C = A + B
40 PRINT C

That was on the cover of the book, and I was thrilled with the possibilities (it could do my homework!)... It took me like a couple of weeks to grasp that simple concept, but once I got it, the world of programming opened up for me.

Ivan
My mom showed me how to use the Atari's BASIC interpreter to "double check" my math homework. ? 5+3
Greg D
+1  A: 

Function pointers in C.

First I learned C, but not function pointers.

Then I began programming in assembler for about a semester in the university. I used function pointers then without even knowing about them. Somehow they seem like a natural thing in assembler for me. I had to explain them to my teachers a few times, because they didn't understand them :).

Then, I came back to C, and revelation hit me.

Now I laught at Java methods, generics, late polymorphism and such said "magic" things.

+2  A: 

I really fell in love with programming languages once I discovered comments. You can do all kind of stuff with it, like

// a commment!
int /* whoa, an inline comment! */ a;

;)

Roman Plášil
And code compiles a lot faster if you comment it out ;)
fishlips
+2  A: 

For Loops + Arrays did it for me. Once I realized that I could loop through an arbitrarily large set of things and do something to each of them, it all started to come together.

EndangeredMassa
A: 

Inspired the word

BASIC Beginners All Purpose Symbolic Instruction Code

+1  A: 

PRINT 3 + 4
The Computer said 7. And all this was visible on my parents TV. ON A TV!!! Can you imagine that? I was imediately hooked. You could tell a machine what to do and you could see on a TV. Wow.

Backgound: My dads employer bought a small computer (Robotron KC 85/1) for the engineers to get in touch with this technology. They could take it home to play with it at the weekend. So my dad brought it home and all he new about it was how to connect it and how to turn it on. One of his collegues told him the trick with the "PRINT" command and the addition of numbers. He showed me and I was hooked. This was about 1986 when I was 12. I am still hooked for basicly the same reason (telling a machine what to do).

EricSchaefer
+1  A: 

qBasic, when I was around 10 - 12 i started making a copy of that "The doctor asks you weird questions"-game. Which ended up as a lot of nasty questions. That's when i knew I wanted to work with computers.

A couple of years later i started playing with HTML and PHP, giving me a couple of customers and i started a company, that's when i knew i could get bloody rich on this :)

Filip Ekberg
A: 

I found ++ to be fascinating in high school.

Everyone else knew Basic, Pascal, etc. But i++ was code! And code that only I knew!

And such tiny changes could have very important effects: ++i is different in many important ways from i++. And ++ translates so directly all the way down to machine code. So by learning this, I had direct access to the CORE of the MACHINE. Imagine the power!

Learning about this made me want to learn all the other strange operations and corners of the C language.

abelenky
A: 

Aside from if statement(which I learned first from Pascal[first language learned]). The one-to-one correspondence between pointers and arrays in C was what truly hooked me to programming. It brings my understanding of computer's ability to great heights, including but not limited to, efficient memory traversal, stacks, passing a specific portion(slicing) of an array to a function, treat the pointer to memory-mapped IO(e.g. VGA address) as an array. In Pascal, the pointer is so opaque that the programmer's understanding of computer memory and its ability is severely hampered.

Michael Buen
A: 

The beginnings of structured programming in BASIC with...

GOSUB 1000
Ed Guiness
A: 

The DOS interrupt

INT 21h
Ed Guiness
A: 

TRS-80 graphics

POKE 15360, 191
Ed Guiness
+1  A: 

I've only been programming for about a year, so for me, it was LINQ. I looked at codes in books that exposed the query string to the DB, and thought "wow, that's kind of lame.". The I met LINQ and we have been happily married ever since.

BBetances
+1  A: 

When DBase II allowed me to print records to a text file AND stick exactly the right typesetting codes pretty much where I wanted -- before them, inside them, behind them, around them. I can still feel the chill on the back of my neck. WOW a whole whole typesetting system right here in my tiny computer! Warm up the 300 baud modem and send this file straight to an 8-inch disk and run it through a Compugraphic. Yards of beautifully shiny photo-type paper with all the letters in the right place. I do not deserve this happiness ...

John Turnbull
+1  A: 

Mine was goto in basic. I thought it was incredible you could make the program jump where ever you wanted it to. Only later did I realize with great power comes great responsibility.

Jared
+1 for spidey-lisciousness
Carl Manaster
+2  A: 

Most definitely the FOR loop - at 6 years old, having that lil' LOGO Turtle go from drawing a line to drawing a square to drawing a circle was all it took to turn me from a user into a programmer.

Greg Hurlman
A: 

I started at around 7-8 years of age (1992-93) in QBasic. A friend (same age) showed me the amazing graphical programs he could do. I often asked something like "Could you make the ... do ... instead?", and he could!

One program I still remember was something resembling fluid filling up the screen, intially containing a few big and thick circles. Scanning left to right and back again, bumping into walls, and exploding (!) if it gets stuck somewhere.

MizardX
A: 

Absolutely while! But my programming experience is pretty recent.

tunnuz
+2  A: 

Clear case, the loop. Specifically looping in Gwbasic. Just for fun I wanted to print all the numbers from 0 to 100 on the screen. So I started:

10 print 1
20 print 2
30 print 3
40 print 4

At some point I thought WTF or something similar. There must be a better way. So I asked someone (perhaps a teacher or some fellow pupil) who then introduced me to the magics of variables and the loop. That must have been the moment I got hooked.

10 SET i = 0
20 IF i > 100 THEN GOTO 60
30 PRINT i
40 SET I = I + 1
50 GOTO 20
60 REM END LOOP

Thats 6 lines instead of 100!!! That was just so much better. Sorry if I got the syntax not exactly right. :-) I am really fond of that moment.

pi
+2  A: 

The first Fortran code I wrote had an if statement in it, and was one of the most fascinating things I had seen at the time. Something like this one

     integer n

     n = 1
  20 if (n .le. 100) then
        n = 2*n
        write (*,*) n
        goto 20
     endif
mndoci
+1  A: 

for or while loop since I could use it in molecular dynamics simulations and I wouldn't have to do the computations one at a time by hand

Casey
+1  A: 

What really made me hooked on programming was the following lines of x86 assembler:

mov ax, 13h
int 10h
mov ax, 0a000h
mov es, ax

When I got how easy it was to draw things by messing with the video memory, all the other stuff I've learned was suddenly useful for something.

Laserallan
A: 

This is not a language construct, but I was enchanted when I discovered that the effect of changing TextAttr (text color, Pascal) would remain even after returning from my program to DOS.

Adrian Panasiuk
A: 

In QBASIC there was the command PLOT, and when I first wrote a program that would draw a spiral on screen, there came the feeling of accomplishment. And I guess that was when I understood computers can do awesome things, and I stuck with them for the next couple of decades.

(Nostalgia. I can still remember the lime-green spiral on the black screen...)

Peter Perháč
A: 

I started with basic, but what really blew me off was LOGO, a language that allowed you to program a "virtual pen" (called turtle) to draw stuff on the screen. I started drawing very complex shapes, and considering my young age, I was totally involved.

Stefano Borini
A: 

I think my first program (aside from noob PHP) was something building towards an RPG for Nintendo GBA. I loved how you could manipulate the bits and bytes into an awesome game. I lost interest when Nintendo DS was released, not only because it hadn't been reverse engineered for homebrew compiling, but also development requirements substantially increased.

It didn't "hook" me, but cout << "Hello World!" << endl; was pretty awesome. I never understood how anyone could use a console though, so I went straight to win32 UI, lol. Lost interest very quickly until adulthood. Good times.

Eric Muyser
A: 
POKE 53280,5

Changes the screen border on the C-64 to purple. Put that in a for-loop to loop the color from 0 to 15 and you will get kids excited about programming. Well, at least in the late 80's/early 90's, that is.

Michael Stum
+2  A: 

Lambda expressions

Been programming my nearly my whole life, but even now find excitement in new things like Lamdba expressions.

 MyList.Any(p => p.IsCurrent)

Hmm.. love it.

Dead account
(My "very first" program was a Basic "Hello " + $name)
Dead account