An Assignment
By: Thomas Barr
Tags: Learning, Bootcamp, Learning To Code, Programming

I want to start this out honestly, I hate blogging. There I said it, I hate blogging. Probably because I was married to a professional blogger for 5 years and I learned the ins and outs of doing it for money which in turn just dragged me down emotionally and mentally and made me realize that I hated being involved in it. So I’m writing the following under protest, but I still need it for a grade. Yeah maybe I’m not the most stick to your principles type in this regard but we all do what we have to do to pay the mortgage.

So I’ve started learning a somewhat new subject, coding, yeah I’m basically going back to school at 35 and learning something completely different than what I’m used to and it’s not without it’s challenges, mainly because I’m used to dealing with humans in english. I’m learning html which is pretty straight forward, css (the details behind html) is a bit more technical but still pretty understandable, and ruby which is kind of a pain but maybe that’s because I’m trying to go too fast with it.

Growing up I learned the most programmers were basically Mathematicians having to create complex algorithms to do simple things with a machine and that admittedly scared me off learning it for years. However, now it’s pretty damned simple, but still a little complex, I realize I’m basically learning machine language shorthand with some mathematics terminology thrown in there just to keep one on their toes. Gone are the days of having to be almost fluent in binary, (although it doesn’t hurt) and there are so many pieces now that you don’t have to perform all the math yourself (Woohoo) but it’s putting things in the right place and knowing the shorthand that makes it interesting. Being able to go from nothing on the screen to a full fledged app is pretty cool, but then again I’ve always enjoyed building something from nothing going back to when I was a child and my grandfather would take me into the garage and teach me how to make various things.

Recently I’ve learned a technique called pseudo code, basically you write what you want the program to do in english (or whatever language you are most comfortable with) addressing each and every aspect of it so you can figure out where the different pieces of code are supposed to go (this includes indentation, and which line goes where) and it is surprisingly helpful when working on a more complex piece of software, and it works with every programming language I know of.

# Allows for random number generated within previously stated limitations, however it also defines the function “Diceroll” for future use

def diceroll(num, sides):

total=0

#Gives numbers from die/dice roll and total sum of roll with external output to user

for count in range(0,num):

die=randint(1,sides)

total=die+total

print count,die

return total

Yeah that’s something I wrote for a dicerolling app I’m kinda playing with to help learn things and it’s pretty self explanatory but I’ll go into the details.

Step the first: we have a definiton of what we are doing with the “def diceroll” bit and since it is supposed to be a digital version of a die we also need to have the number of dice (num) and how many sides(sides) with a starting total of 0 (total=0)

Step the second: we need to know the range of how many sides of die or dice we want to see results for (for count in range(0,num)) and how many die/dice we are going to roll (die=randint(1,sides)) granted it’s a little easier to use the standard Dungeons and Dragons method such as 4d6 which is 4 dice with 6 sides.

The final line of code gives us our total sum from the however many dice with however many sides and then shows it to us.

That’s all for now, as I’m trying to keep blog posts as short as I feel I can while giving some sort of documentation on how I’m learning and approaching all of this, I’m sure I’ll have another assignment that involves blogging again.