Monday, June 22, 2015

Starting on OOP(Object Oriented Programming) through Java




Hi readers,

I've been wondering if I should throw something out there about getting started with java, since many self taught programmers learn java some time in their life, or not. I teach an introductory class in college, well I guess I instruct. In that class students are introduced to the Java programming language and they learn Object Oriented Programming concepts.

So, in this post, I'd like to write something about getting some tools ready and set to learn the language and concepts that it teaches.


1. Set Up an IDE or Such
Setting up an IDE is important if you want to check or compile your code. There are different IDEs available for Java just like there are several for other programming languages. To see different types of them see here.

2. Use Online Resources
I give my students TutorialsPoint references very often. They give information by variable types; Strings, arrays, etc. If sometimes you don't see the information you want, using Google to search the site and the topic usually will bring up a TutorialsPoint link for it.


Java Oracle Documentation: Many of my students don't like using this site since it's not always the simplest explained. Nevertheless, some still find this page useful for finding what they need.








Stackoverflow: Yes yes, it doesn't give documentation like oracle or tutorialspoint, but it does give you insight to similar problems and similar solutions once you get started. Stackoverflow is also useful for other languages as well.

3. Tutorials
Oracle also gives tutorials here, although the effectiveness of the tutorials are up to you. There are many Youtube videos that give great amounts of info about java, going through things step by step and talking slower so that you can process concepts more properly. Derek Banas give really fast tutorials but if you slow it down or you pause to think through it, it will work out well. His tutorials are more like reviews sometimes so you possibly want to use it as a review when you think you've got the jist of Java.

Through this mini guide I hope that you find some useful resources on where to look to learn Java! :D
I also hope to put up a few more posts/tutorials for Java and possibly videos to go with it, I look forward to helping anyone with the language through my tutorials.

Tuesday, June 16, 2015

Java 101 - 01 What is Java and What is it Made of?

 Whether you're a computer Science major or just someone thinking of picking up a pastime skill, this post will explain what Java is and also give some beginning introduction to it. :)


An Introduction to Java's birth and life:
Java was born on June 1991. Created by James Gosling, Mike Sheridan, and Patrick Naughto. Apparently I learned through some research that Java was created for the purpose of television improvement but it was too advanced to be used during that time. It was originally named Oak after some oak tree. Later, the name changed to green during their green project and then changed to Java after the coffee. Something I know about Java is that things are being added and have been added since the creation of it and everything accumulated from all these years is still in the language. Reason of this that there were five established goals at the time they created it.

1. It must be "simple, object-oriented and familiar"
2. It must be "robust and secure".
3. It must be "architecture-neutral and portable".
4. It must execute with "high performance".
5. It must be "interpreted, threaded, and dynamic".

With these rules the now commonly used language was birthed. If you like to know more about the creator or the language, visit the wiki or webpage I have linked to each of the creators.

How this little tutorial is going to work:
In this tutorial (or any future tuts) I will try to go through the talking step by step, where each tutorial will go along the development of a small program. Each step will include little snippets of code, where at the end I will make a code combination. The final code combination allows you to see what you have done after the whole tutorial, as well as see what you have learned. These tutorials, hopefully, can be easily followed and the code snippets can be copied into your own compiler for you to learn.

Suggestion: Use a text editor or a simple compiler program to help you with the code. In our University Java class we use Dr. Java. Usually the jar file is easier to use. It's also portable so you can stick in on a flash drive.

Straight to the basics:
Now to the fun. We will get started with the basic syntax since all background information is provided in the section above.

Syntax:
Java code is case sensitive, so beware your capitalization or your keyboard's auto-capitalization features. Many times my students go nuts over their code error forever to only find that it was one letter. ONE LETTER!!!!

Naming Conventions:
Naming conventions are just the rules of how to keep organized names of different things. Class names should have the first letter capitalized,with each word's first letter also capitalized.
class MyClass{
}

Method Names:
Method names should have the first letter lowercase,with other words' first letter capitalized.
 public void thisMethodNotAllLowercase(){

}

The Main Method:
The main method is a mandatory part of a java program; it is used to tell the Java program where to go and what to do.
public static void main(String []args){

}

Program File Naming:
The name of your program file should always be named the same as your class name. Going with the class name example we put above, our program file would be named MyClass.java


Keywords:
Keywords are special words that are used to "command" the program. Words like class, public, or static(like those used in example above). So, don't use these keywords as names unless you want your compiler to yell at you. And you don't want your compiler to yell at you.

Summary:
We learned about how to name things in our Java program in this tutorial; don't worry I will explain what class method and all that jazz is in a later tutorial! But, here is the end code if you want to try it anyways.
//this is a comment. We'll talk about it later don't worry.
//This is the Myclass class naming
class MyClass{
//This is the main method we always need
public static void main(String []args){

}
//This is some random method we made, notice the capitalization rules.
public void thisMethodNotAllLowercase(){

}
}


If I made any errors please point out to me with comments! I'm human, despite what my nephew says; Unfortunately I make mistakes too.