The Furry Forums

Furry Chat => Tech Central => Topic started by: Sergie The Sergon on September 16, 2015, 02:45:20 AM

Title: New to Java Programming
Post by: Sergie The Sergon on September 16, 2015, 02:45:20 AM
Hi,

So, I'm doing a unit at the local University called Programming Fundamentals, which is basically a unit for those wanting to do other Programming units that have little to no experience with Programming.

In this unit, we are learning how to make programs using Java.  I'm still new to Programming in general, but it is an interesting class.  Does anyone have any experience with Java that could give me some tips?
Title: Re: New to Java Programming
Post by: Aldebar on September 16, 2015, 10:53:46 PM
I'm currently in a second-level programming fundamentals class where we use Java, and I've taken both a basic programming fundamentals class and a basic Java class. I had pretty much no prior programming experience and struggled with it at first, and still do a little when it comes to new concepts, so I know how challenging it can be. Especially if you're like me and have never been very good with math.

What helps me the most is to just practicing coding; once I know I can get something working and written correctly it comes much more natural to me the second time. It might also help to look up tutorials online (on Youtube and the like) and find programming-based communities such as Stack Overflow (http://stackoverflow.com/) where you can ask questions and get help. Also check to see if your school offers peer tutoring for programming courses.
Title: Re: New to Java Programming
Post by: MrRazot on September 19, 2015, 09:06:32 AM
Java is fun, just don't forget the basics and the more complicated stuff will be a breeze.

Also depending on which program you're using, there may be a load of documentation that comes with it in regards to different coding terms. It may even have some form of auto-fill or auto-correct which can make things easier.

Once you start making your own classes, the sky is the limit.
Title: Re: New to Java Programming
Post by: anoni on September 29, 2015, 09:13:56 AM
Thing you have to know is object oriented design. Java has the capacity to have programs that are very nice and modular, so using that fact is the best bet for a good java programmer.

Here are some things to know:

  1. Java is made of objects, each object is part of a class. A class will contain a definition of an object, so it will contain what variables it has, what methods it can use, the object is the actual instantiation of a class. So you NEVER ACTUALLY USE A CLASS DIRECTLY, you use objects. Think of a class as like a definition, and an object as the actual word.

  2. All variables in Java are references, not values. Lets say you have a class called Point, which has a variable x and y. When you have say "Point p = new Point()" p is not a value of x and y, it's a reference to an Point object. IE: p is an ADDRESS IN MEMORY, it is not an object it simply is the address of where the object is! This is important to note cause some weird problems can occur if you don't take this into account, for example

If I have a list of points and I want to fill them with many points, I can't do this

Code: [Select]
  Point p;
  List<Point> points = new List<Point>();
  for (int i = 0; i < 10; i++) {
    p = new Point();
    points.Add(p);
  }

  Because p is simply an ADDRESS to a point, when you add "p" to the list points, you're just adding the REFERENCE, but not the actual point object! So upon execution of this code, you'll have a list full of the SAME POINT OBJECT (the last one you instantiated), not a list of unique point objects. To get a list of unique point objects you'd need to do this

Code: [Select]
  List<Point> points = new List<Point>();
  for (int i = 0; i < 10; i++) {
    Point p = new Point();
    points.Add(p);
  }

  This way you're assuring that each instantiation in the list points is a new point object. I know, it's a very small change, but I've ran into this bug before and it takes forever to figure out!

  If you don't understand any of what I said now, don't worry, but in the future when you become more used to Java you'll realize this advice is important.