An amateurs guide to learning the amateur way.
I remember when I first started programming through the OSU Online Post Bacc program. The first language I utilized was Python. We started with some simple syntax on how to print to screen, get user input, perform mathematical operations, eventually this led to opening and closing files, object oriented concepts, and some advanced data structures. A few terms later I was introduced to CS290 (web development) which brought JavaScript, Node.js, MySQL. Which started with some simple syntax on how to print to screen, get user input, perform mathematical operations, eventually this led to setting up a server, some client side communication, and how to set up and manipulate a database. A few more terms later I took CS344 (Operating Systems) and CS492 (Mobile Development) where I was introduced to more languages and again we went through a similar learning style.
With the basics of all these fantastic languages under my belt. I felt arrogant enough to think companies should give me money to code. (I mean at this point I’d graciously given Oregon State a substantial amount of money). I browsed through the postings and submitted my applications and after some failed OA’s and rejections I was nowhere closer to where I wanted to be. Somehow, a familiar name kept coming up more and more in the applications. It seemed I had somehow stumbled into the infamous ‘Java’ country of New York City. It seems like it would be a good time to learn this infamous language.
I journeyed through the internet and pulled up my old friend Youtube and searched for Java tutorials. Some were 8, 10, 12, 40 hours long and claimed to be able to get anyone from beginner to somewhat competent. I clicked on the first video with millions of views and started watching. A friendly individual with a shiny bald head and an enthusiastic voice pulled up eclipse and started showing some basic Java. How to print to screen, accepting user input, perform mathematical operations, and eventua… I closed that video and opened the next, this time a shaggy haired young student was on. He introduced himself pulled up Intellij and began his lesson on how to use Java, starting with printing to screen, accepting user input… I closed that one and moved on to a more obscure channel. This individual had a relatively thick but understandable Indian accent, but same results. It is apparent that the majority of the tutorials online are geared towards newbies, with very similar styles. At this point syntax wasn’t an issue for me. There are nuances here and there (especially with the low level languages), but I didn’t need a run through casting primitive types. I wanted to go from a language I know and get enough Java to make me dangerous.
I realized I was on the cusp of gently lowering myself back into tutorial hell…
I closed Youtube and sat back and reflected. Every experience programmer will tell you that in order to get better you must code. But, when you learn a new language where do you start? Looking at the big picture of my classes I understood that a proper software project would have similar features. Aside from the obvious where there is sometimes a front end, back end, and database. There are also things that flow under the radar of newbies such as modularization, testing, and the industry standard for organizing a project. I knew I had to just throw myself into the deep end and figure it out, so I devised a method getting familiar called the Tic-Tac-Test method.
What is this method I threw together in an afternoon for a blog post and a different perspective? It’s a very simple project that covers a lot of the important basics. The goal is to perform test driven development on a command line version of tic-tac-toe.
THE TIC-TAC-TEST METHOD
Step 1: Set up the Environment
Before you can even learn a new language you need to set up the recommended environment. I did some research on what to expect as an enterprise Java developer. While it varied, a good majority of the recommendations were to use Eclipse and set up the project with Maven. From there I downloaded Java using the official Oracle documentation. I got Eclipse up and running, and i went over a guide on setting up a Maven Java project. Where the testing framework goes, and some information about pom.xml. (a file used for configuration, which comes into use for setting up a testing environment.) During this process I got some insight on how to set up environment variables and what to do with manipulating the .bash_profile file. It wasn’t as straightforward as I thought it would be, but I learned a lot.
Step 2: Create the First Method or Class
I knew how to set up a class in Python. I’m very familiar with inheritance, class methods and class variables as well as some practice with inheritance and polymorphism. I figured that since Java is a pure object oriented programming language (like c++) that it should be pretty easy to transfer those skills. While yes it was. There was some nuances I didn’t expect. Every class goes into their own file with the exact same name as the class within the file. All files go under src in the proper location. There is one main App.java file where the main function is that is the ‘entrance’ to the program. I made a couple dummy classes to get that all situated and I was ready to go.
Step 3: Figure Out the Recommended Testing Framework
I made it a personal goal to follow a test driven development process. Of course it’s an industry standard, but I also noticed it helped me a lot in the coding process. With a lot of classes testing would be brought up at the very end (if at all) and by the time we got there I was already pretty burnt out on assignments or testing so I just ‘got it done’. Like Python, Java has a wide variety of testing frameworks to choose from. Through my research, ‘Junit’ seemed to be the ‘unittest’ of Java so I settled on that. The latest version being Junit5. The syntax of Junit5 was very similar to unittest, but there was a lot of configuration to be done. This is where I learned more about utilizing the Maven pom.xml file and how to configure a dependency. From there I had to look into the specific libraries to import (there are A LOT to choose from) and I had my few tests up and running.
Step 4: Version Control
No matter what I think it’s important to figure out how to get this first project onto Github (or any of the other version control systems). I’ve used Github a lot but I put it down as a necessity no matter what. Aside from the essentials, this was where I researched what should be included in the .gitignore for a Java project and how to configure Git with Eclipse.
Step 5: Tic-Tac-Toe
I debated a lot with what would be the best first project and I think Tic-Tac-Toe just works. It’s got the first 8 hours on any tutorial built into it and it can be built in an afternoon. It involves the essentials how to use arrays, getting user input, displaying on the command line, creating methods, and setting up variables in a class. By the end of creating the game I had a good handle on the concepts.
Step 6: And Beyond
My step 6 almost folds in on itself. From here I want to look into making a more substantial project. As the best way to learn is to always get down and dirty and create something. Taking what I learned and building upon it. I think at this point tutorials are still useful only if they are specifically targeted. What I mean is that instead of a ‘Basics of x language and we built a to-do app’, I would look for something like ‘How to set up a J2EE server’ and try to apply it to the next project. Above all if I find myself sifting through the official documentation that’s a huge win.
To reiterate. I am no expert. I am still a student and this is just an idea that I thought of applying that I found very helpful to push myself away from tutorial hell. I believe that whatever gets someone creating is the best route to go.