Check out my latest book of drawings!
Rapid Transit

A contextual difference
July 11, 2015, 11:27 am

There is a major difference between fundamentally learning how to program, and learning a new programming language.

Let's look at an example.

$a = 0;

If you said, "That looks like code!", congratulations, it's your first day. Have a lollipop. If you said, "That's a variable assignment", congratulations, you seem to know how to do basic programming. If you said "That's a variable assignment in php", congratulations, you seem to know the basics of PHP. If you said, "That's a variable assignment of the number zero, which has a basic value type of Number, to a variable with the designation of $a, in the php programming language", then congratulations, you're a huge nerd! But what about when the language is less obvious, or you don't know that particular language. Should you still be able to figure stuff out?

function sqr(num:Number):Number{ return num*num; }

Now, if you didn't know that was Actionscript code, that's ok. Not everyone does. But you should be able to use your knowledge of basic programming to figure out what is going on. It seems to be a function definition. Something called sqr(). I'm not sure what those colon parts are, but it seems to be a basic type of value, so I'll bet it's saying num will be a number. I can only assume then by the second :Number placement that sqr() is also supposed to be a number? The function seems to be multiplying the number by itself, then returning that value.

Did you see what I did there? I don't know Actionscript 3. I learned Actionscript 2, back in the day. Actionscript 2 did NOT have type casting. I found that code on the Adobe help site when I searched for "actionscript function return value".

Learning to program means you should be able to know a few basic concepts, and recognize those concepts in any language.

  • What is a variable?
  • What is an array?
  • What is a function?
  • How do I if else?
  • How do I loop?

Those are the core concepts of programming. And they are (mostly) language independent. If you can figure out how to do those things, you can probably write anything in any language.

... after about 2 months of intensive study in that new language just to get anything to freaking show on screen...

It can be difficult in the early days of learning your FIRST programming language to measure the difference between learning that language's syntax and learning the essentials of programming in general. It might not even ever become clear to you until you attempt to learn your second programming language. Suddenly things that weren't important before can become very important. Suddenly things that were so hard before can become easy. Changing languages is a difficult task, and learning your first language can feel like a monumental challenge. It isn't until you learn to differentiate the fundamentals of programming, from the idiosyncrasies of a particular language, that you will truly begin to reach your potential.

  • 0