Monday, January 16, 2017

Language and Code

            So, back in the fall I decided I wanted to learn programming. It wasn’t the first time I decided this – I’ve long had an interest in making my own video games and such – but this time I actually went ahead and did it.

            I started with a few free phone apps, but quickly came across a slight problem – most of the apps were teaching me a programming language without really explain how to code. It all seemed to assume I had a pre-existing knowledge of coding and programming terminology and, as such, I had to extrapolate a lot of information from context.

            When I came to the end of the free lessons in the best of these apps (it didn’t even tell me which programming language I was learning – I believe it was either Java or Javascript), I decided to look for something that taught a bit better. To refine my search, I decided to look for a specific language tutorial rather than casting my line out and seeing what I caught – my thought being that if I could find something that taught well enough, the terminology and skills could transfer to other programming languages.

            I decided to lean C programming, as my research revealed it to be one of the core programming languages. My search soon popped up with this site for C++, an upgraded form of C. Within the first few lessons, I knew I’d come to the right place. Rather than just telling me how to code, it goes into detail about how programming works, so I actually understand what I’m being taught to do. There’s even a review from a university professor saying this free online textbook is the best programming textbook he’s ever seen.

            So, now I’m buzzing along, learning to code and loving it – it comes naturally to me and feels like one of the things my brain was designed for. I’m not very advanced yet, mind you, but I’m getting there and making a list of programs to write once I have the skill.

            For now, though, I thought I’d share with you one of the things I find the most interesting about programming. It’s one of the things that inspired the thought process of, oh, three blog posts ago – how everything is broken into smaller pieces.

            You see, a programming language is just that – a language. It has certain words you use to combine together that tell the computer to do something. A line of code is like a sentence – only it ends with a semi-colon rather than a period. Code is broken into paragraphs called functions that look something like this:

Type of function and its name()
{
            Lines of code that give the computer its instructions;
            Just for appearances, we should have multiple lines;
            After all, a single sentence paragraph is boring;
            Also, there are usually more numbers;
}

            A program as made up of a bunch of functions (among other things) and they work together through logical progressions to make whatever the program is for happen. Just like how words, sentences and paragraphs fit together to tell a story.


            It makes so much sense, yet it never occurred to me that that was how it would work. When you think about it, the familiar structure makes it easier for programmers learn the new language. Plus, as with everything else in life, it means that if something is too big to accomplish, it can be done by breaking it down into smaller, more manageable, pieces.





Click here to find the charity anthology containing a couple of my short stories.




Also, make sure you check out my wife's blog and her life coaching website.


If there's any subject you'd like to see me ramble on about, feel free to leave a comment asking me to do so.

No comments:

Post a Comment