About Practice, Man

If you’re just starting out, if you’re teaching yourself or you’re a first-semester student taking a computer science course in college,  when it comes to learning a new language, whether it’s Java, Python, C++, or anything else, there’s just one simple but painful truth that we cannot avoid: Practice.

Why am I blogging about practice?  Because it seems like for more than a couple of years, I have been searching for a short cut towards learning to program.  From taking free classes online, to download programming textbooks, to Lynda.com courses, I was always looking for an easy way in.

The thing is, all those routes are actually great roads towards learning the language.  But, you cannot complete them passively.  You have to dedicate a couple of hours each day to read the lessons, watch the videos, do the work, and then you need another block of time to practice what you had just learned.  Why?  Because without the practice you are not going to retain the information that may one day mean the difference between a successful block of code or a falling flat on your face.

Seriously, turn your phone off, go to your dedicated coding space, close the door, get comfortable, put on some music, then get to work.  The process is repetitive, that’s actually a good thing.

xjnpl9xFor example, do you think Steph Curry became the great shooter he is today just from watching his dad shoot threes?  Do you think he became great from just reading a couple of books on the methodology of shooting a basketball from long distance?  Do you think he became great without going to the gym, without working on the craft, without making mistakes, without learning from those same mistakes, without getting hit, without getting injured, without getting disrespected, without doubting his own abilities to be great?

Of course not.  The same goes for you.  Your journey is not going to be any different.

Yup, we’re talking about practice.  Now, go!  Practice man!

New Regimen, New Stage, New Level

Tonight, I sat down to start my Java regimen.  I opened up my book to where I had left off the night before, and I started reading the code in the book and writing it up on Eclipse.  For the past few weeks, this simple regimen has been effective.  However, as I’ve learned from my time in the gym, our muscles get used to regimens.  To help keep myself engaged and to avoid that rote mechanical feeling, I need to change things up. So, I did.  Here is what I did.

To start, here is the example code from the book:

Screen Shot 2017-08-11 at 10.17.42 PM

Naturally, the first step is for you to read the code.  But, to read the code you have to constantly ask, what is going on here?

On line 1, the code is importing the Scanner class, this signals to us that the User will provide some information.  Lines 11 and 12 show us that the program is going to use two integer variables: number, and maxValue.  Reading on, we see the scanner object, keyboard, is created on line 18 before prompting the user to enter a value to be stored in the maxValue variable.  The program is going to set up a table that is going to show, on one side, a number, and then right across, after a couple of tabs, its perfect-square.

From lines 27 to 31, we see the for-loop.  Here the first variable, number, is used as the loop control variable and is initialized to 1.  Right after, is the condition for the loop: the loop is going to cycle through the values, from 1 to the value less than or equal to the maxValue the user will provide. Finally, the program will increment the number variable.  Basically, this for loop is going to help create the perfect-squares table by showing a number and then calculating and displaying its perfect square all the while repeating until the loop reaches the maxValue at which point the loop and the program ends.

Not too bad; it’s an easy code to read.

Now that I know what the program is doing, I ask myself, what would be one simple specification that a client would possibly provide me when asking me to create such a program?

I came up with this: Screen Shot 2017-08-11 at 10.35.36 PM

That works.

What did I just do?  What is so great?

Well, I think what I did was first obviously read the code, but then, more significantly, I broke down the program to identify its parts. In doing so, I made a simple algorithm that is at the heart of the program.

At first, this all seems like a lot of work, but it’s work that my brain muscles need to get used to.

Passively writing and rewriting code is a good gateway exercise, to help develop the habit of sitting down and coding.  In my years of studying literature, that first step is actually part of three stages to reading and writing.  This first stage is called the textual stage where you’re learning to read, write, and decode texts.

Now, as this blog post exemplifies, I’m ready for the next stage, and my it’s actually my favorite stage: The Analytical.



Hi there, thank you for reading my blog post.  If you liked what you read, please give this post some love by clicking on the WordPress Like button.  And, if you have any comments, questions, and or concerns about anything, I invite you to post a reply in the comment section below.

The Do > The Done

I like to think that I am more honest with myself today than I was ten years ago.  Then again, how honest could a nineteen-year-old, with no real world experiences, be with himself?  Now, twenty-nine and not getting any younger, I can look at a situation and weigh what I can and can’t do, or how much time will or won’t I have to invest.  Compared to all the other life skills, it’s not that profound but it’s important.

I’m being honest with myself tonight and admitting that the pace at which I am working through the Java problems from last semester is too slow.  I need to cut out all the time wasted on the internet, collect those hours and then invest it all on mastering Java.  Because by this time next year, I don’t want to feel as though I am on a treadmill.  I want to feel as though I climbed to the top of a mountain.  It’s not done overnight but done through small steps, started with little sacrifices, and powered through with a vigorous determination to make it.

Where am I now?  I am on Chapter 4: Loops and Files, on sample code 5 of 25.  It’s 9:00 p.m. EST, and I am coding to code for the next three hours.

I don’t know how much I will get done but the point is to do, not do think about the done.

Update:  Two and a half hours later, I realize I may have to change my methods of practice.

What I have been doing, and it has been an effective way for learning to program, is to take one of the sample codes provided in Tony Gaddis’ Starting Out With Java, and repeat writing the code ten times.  It has been an effective means for memorizing the little things about syntax, spacing, and writing clean code.  If you’re just starting out, instead of memorizing the jargon, I highly recommend you repetitively code the examples you find in your textbook.

What I may have to start considering is to code five programs, then repeat them in sequence for a minimum of five times.  This way I cover more example programs and get to practice and learn through repetition.

This Is My Desktop

This is a picture of my Desktop.  It’s a stack of textbooks on programming, algorithms, discrete mathematics, and four blue labeled folders which hold even more books.

As a kid, my favorite place to be was the library.  This was before college, before high school, just around the time I started Junior High School.  I would count up $1.25 from a jar full of loose change, get on the Q54 bus from the corner of Jamaica Avenue and Van Wyck, ask for a transfer from the bus driver, then ride to Merrick and Jamaica where the Queens Central Library sat across from the bus depot.  Inside, the first place I went to was over to the Science and Mathematics section.  What was I doing there?  I was picking out the newest textbooks: Chemistry, Biology, University Physics, Calculus.  I would stuff my book-bag–over the years, I had ripped a half a dozen of these book bags from stuffing them full of textbooks from the library–then take them back home.

At home, I would stack them, high one on top of the other, then maybe read the introductions of each of the textbooks.  By then, my eyes would have been completely tired, and I would stack them up again on my desk, then crash into my bed.  The next morning, back to reality, catching up on homework and or preparing for an exam, and those stacks of textbooks would stay where they were until days past their due dates.  I remember once selling my junior high school lunch vouchers to have enough to pay the library fines I had racked up from collecting these giant textbooks.

When I think back to those habits, I wish I had someone to teach me how to study.  Or, someone to help me understand how you had to go about reading a textbook.  So, a lot later down the years, after I had messed up as an engineering student, completely had no chance of ever becoming a doctor, years after when I was at my lowest, I understood that one of the roads up was to study English Literature.  Why did I think that?  Because I saw myself as an eternal student who was missing a couple of critical tools: critical thinking and some basic writing skills.

Anyway, fast forward to now, after all the years of reading textbooks, novels,  theoretical philosophical arguments, and of course tons of articles from the sports section, I realize I still repeating a bad habit: I hoard books out of a genuine desire to learn, but I end up not learning anything from them, because there aren’t enough hours in the day to read everything.

I need to be honest with myself and focus on just what I need.

So what does my Desktop look like now?

Screen Shot 2017-08-09 at 9.40.59 PM

Unity Game Engine, Writing==Developing, Final Coming Up, Planet Earth Loop

I’m installing Unity, the game engine.  Last summer, I left a project with an educational game development group where I was entrusted with the task to develop an original, nonlinear narrative.

You see, prior to computer science, my life long dream was, and still is, to write.  I was entrusted with the task of writing a game, something I had never done before.  I ended up writing an outline, after outline.  Each week I would meet with the team and present my new ideas.  These sessions slowly disheartened me because I wouldn’t leave the meetings with boundaries or direction on what was good or what was bad.  Instead, I was asked to think more outside of the box.  While the team ultimately was not able to produce a finished product, what I realized through the experience was the importance of retraining and finding myself in the future of computer science.

Now, a year after, with a solid two semesters of computer science, I am installing Unity on my Macbook Air because I want to try developing games again.  This time around, I understand how object oriented design works, I am familiar with all the complex jargon commonly heard in the tutorials.  So, like picking up a book I had given up on because it was too hard, I’m hoping this time around it will be much easier.

I plan to build these early copy-cat games for the web, so hopefully, my blogs will soon have embedded games.

My dream has and still is, to write.  Nowadays, that writing has become developing.  They’re the same thing, I tell myself.  Just as Hemingway woke up each morning to write the next paragraph of a project, I wake up excited to write the next block of code for a program.

In the long run, having studied Literature for four-years, developing an attention span that can work on a project hour after hour, mastering methods of changing one’s perspective to look through another lens, thinking outside of the box, all of the little skills like that will help me in my coming career as a software developer.

Thoughts on School.  A week before my Discrete Math final, I am glad summer courses are easy.  But I know very well that my Discrete Structures course is going to balance the easy out and be super difficult.  Either way, after my final exam next Tuesday, I have to take the initiative and practice, like hardcore, all the example problems in Rosen’s Discrete Mathematics.

I also need to get myself a copy of Cracking The Coding Interview, as I’ve read and re-read on different forums that it’s best to study Discrete Mathematics, Structures with questions that are asked during coding interviews.  Afterall, one day I do want to land a job, at a company, make a comfortable living, etc.

Other Thoughts:  Some folks like to listen to music while they code.  Then there’s me.  I like to turn on my TV, load up Netflix, then watch BBC’s Planet Earth on mute.  Sir Attenborough is great, but I just want to code on my computer then when I need to recharge, I just look up and watch the weird, beautiful, crazy things that make up life outside of modern humanity.

If You Are Interested in Computer Science You Must Watch BBC’S “The Secret Rules of Modern Life: Algorithms” (2015)

Last night, I watched a cool documentary on algorithms, The Secret Rules of Modern Life: Algorithms.  It’s available on Netflix.  If you’re a new student to computer science, you’ll definitely want to watch this documentary.  Marcus du Sautoy introduces, explores, and explains algorithms in everyday language.  It’s best to watch this documentary before forcing yourself to study CLRS’ Algorithms–an inevitable text for anyone considering to become a computer scientist.

If you don’t have Netflix, it’s also on YouTube: https://www.youtube.com/watch?v=Q9HjeFD62Uk

Did I learn anything?  Yeah.  Honestly, you could treat this documentary like an introductory textbook.  Which is what I will be doing.  Like right now, I can tell you that the most important contribution this documentary will make to your computer science education is to compare and contrast bubble sort, merge sort, heap sort, pigeonhole sort, and why we’re still searching for an algorithm to the traveling salesman problem.

Another cool thing about this documentary is meeting all the world renowned computer scientists through interviews.  I think the next time I watch it, maybe sometime this coming week, I’d like to make a list of all the people interviewed.  Then, I would look up each scientist on Amazon to see what books they’ve written.

In my next post, I am going to write about resumes for computer science.  I follow a Facebook Group called HH Resumes, where students and pros share their resumes to be critiqued, and I have noticed that a lot of us really don’t know how to write a resume.  I’m not going to write a DOs & Donts post, what I am thinking of creating is a post with all the resources that can help us learn to write better resumes.

Thanks for reading, hit that LIKE button, hit that FOLLOW button, and don’t’ be shy to leave a comment.  Take care.

Shortcut, Pseudo-Modular Design Code

So, check it out.  When you’re writing programs there’s a lot of prompt messages.  It’s repetitive.  So, what I did today is think ahead, figure out all the prompts I am going to ask the user in the program.  Then, with my list at hand, I keep them inside individual String variables.  For example, I wrote a small program that asks the user to enter the name of a season, the prompt itself is contained in a String variable called “message.”  Then, I contained the translation of each season inside distinct variables, like fall = “El otono.”  I did this sort of pseudo-modular organizing of my code and I found it all to be more organized.  I feel more comfortable with this workflow because I don’t have to bother with concatenating long messages.  Instead, just write out the message and then plug it into System.out.println(plugThatVariableIn);

If you’re curious, here, take a look.

Screen Shot 2017-08-04 at 11.38.16 PM.png

If you’re an advanced programmer, in a comment could you tell me whether or not this is going to lead to good coding habits?  Thanks.