Posted February 27th 2014 03:02 pm
Lost on the concept? This may help explain it
As per the request of many a-people, I have started studying Java.
Personally, it's because I started an Android application course that apparently was a lot harder than I anticipated. I expected the course to be "Here's what you need to know in order to develop an Android program." Instead, it was "We're expecting you to know Java. Knowing that, create this program with these Android specifics."
Let's just say that I easily zoomed through the video lectures (it was via Coursera) and the quizzes, but the first assignment really handed me my rear end. I thought I was alone in the fact that I had absolutely no idea what to do.
// Create counter variables for onCreate(), onRestart(), onStart() and // onResume(), called mCreate, etc. // You will need to increment these variables' values when their // corresponding lifecycle methods get calledOkay, no biggie. I just need to create incremental variables in Java. How do I do that? In PHP, it's just
$counter = 0. How does Java do it?
// TODO: Create variables for each of the TextViews, called // mTvCreate, etc.Okay, creating variables. In PHP, it's
$variable = 'string';. So, is there any difference than the above step?
// TODO: Assign the appropriate TextViews to the TextView variables // Hint: Access the TextView by calling Activity's findViewById() // textView1 = (TextView) findViewById(R.id.textView1);Wait, what? So do I write
textView1 = (TextView) findViewById(R.id.textView1);?
And that's about as far as I got before I spent hours on Google searching on how to do these specific things (yes, they are extremely specific), and combed through the Course's forums.
Apparently, I was not alone. A lot of people were complaining about "I'm a Java beginner. I don't understand any of this stuff!" Even some people were saying "I've been studying Java for about 2 years, and even the first assignment took me about 7 hours to complete." WHAT? The first assignment of courses is supposed to be progressive. "Here's how you output 'Hello World'." and "Here's how you add color." and "Here's how you add a button." - you know, progressive
At this point, I said "I need to study Java more." So much for trying to "dive" into Android. I need to backtrack a bit.
Kilobolt to the Rescue!
So I followed some links in the forum and found many, many Java tutorials and found one that I really liked: Kilobolt, a student at Duke, has a lot of tutorials of basic Java (like understanding
privatemethods, classes, and variables, actually declaring variable types like
boolean, and even
ArrayTypes, referencing outside classes,
expanding classes, inheriting classes, and more. Overall, all of these items helps you develop a 2-D game to put all of these items to use: as in "Application Learning," which is what my Python course did last year.
Kilobolt has really saved me and helped me understand Java better. I don't think I'll be an expert by the end of the week, but I'll know more than I did a few days ago. And hopefully, by knowing this, I should be able to give Android a crack again.
Fruit of my Labor
Also, in the 8 (or so) hours that I have been going through Kilobolt's tutorials, I completed 2 out of the 4 Units for Java, and completed this nice little number:
It's not much to look at, but given the fact that as of 12PM on Wednesday, I had absolutely no idea how to do that, and, as of 3AM this morning, I created that, I think it's pretty awesome. I can't wait until the full project is done!
Wait a sec - you're studying Java, NOW? Why not in College?
I'm sure some of my programmer friends are asking "Why did you wait so long to study Java? Why didn't you go into Computer Science when you were in colleg?" Personally, I never really saw the appeal of "Desktop Software" (Software that only operated on your computer and nowhere else). I always saw potential in languages like HTML, PHP, MySQL, etc, because you could post it to the web and let the whole world see, without having to do any major marketing ("Here, try my software!"). Visual Basic and C++ gave me a taste of desktop programming back in high school, and although those were building blocks for what I know today, I had more fun with PHP and the like. When I entered into college, I saw that the CS department was teaching Java, and I thought "Why study something that was current 20 years ago?" and never thought twice about it (and seeing all of these "Applet Rich" programs on the web that took at least 10 minutes to download and run on a dial-up connection steered me away from learning a "pointless, single-purpose" language). However, now since Keat is going through a CIS 250 course and learning HTML 4.01 (ok, 13 years ago - yes, HTML 4.01 came out officially in 2000), I'm re-thinking my priorities. Entrepreneurship has its advantages, and it was fun while it lasted, but I love to code. I love to learn new languages. I love to push my potential. When I entered college, "Smart Phones" hadn't even been thought of. "Android" and "iPhone" programming was something completely foreign. I never thought "By learning Java, I can learn to program phones!" Never crossed my mind.
Looking back on it, I think I would have joined my friends in the CS department and been able to accelerate my programming knowledge further than today. Aside from 1 formal HTML course, a VB course, and a C++ course (and a Python course, if you count Coursera), I've always been self-tought in languages I learn. Maybe that's a problem with me - since I've never really had any advanced formal programming training, that's a flaw I have and didn't seek it out, thinking "I can learn all of this from the web." However, while trying to apply to jobs, I think a lot of people are saying "He has a degree in Entrepr-something. We want a Programmer!" and turning me down. Instead of saying "Ha! Their loss!", maybe I should look at myself and re-examine the priorities, emphasizing my experience in difference languages. Yes, I may have a degree in Entrepreneurship, but I studied and practiced web technologies, web strategies, web marketing tactics, PHP algorithims, code-based studies, SEO methods, and more while trying to build up my business.
I will say that I was against learning Java for the longest time. I always saw it as "slow, decrepit software". I always told people that it's like "learning Japanese when you know Spanish," which is technically true. However, the logic planning and orientation of the language is fairly similiar to PHP. The only main differences being that:
- Java (from what I've seen), like Python, is heavy on the "Object Oriented" portion of OOP.
- You must declare all of your variables at the top and specify their types, whereas PHP can just declare variables.
- You must have an IDE to complile Java, where as PHP you just need a text editor and a PHP-based web server.
- Changing variable types is not easy whereas in PHP, it doesn't really matter (example: integer to string to float and back).
I'm sure there are a few more, but that's the basics that I've seen so far. It's certainly more structured than PHP is, but I hope I can learn more about PHP through Java, just like I learned more about PHP Objects from Python.
After completing Unit 3 and starting Unit 4, this is what I have so far: