• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming... help me GA!

Status
Not open for further replies.

Chrono

Banned
I don't have a programming question.

What I want to know, is this:

Does programming stop sucking?

I started my first ever programming course on tuesday. NEVER knew anything about it. Hell I don't know much about computers. The course is intro prog. JAVA. We did a "welcome to Java" application.. that was easy..

Then came project two.. write a program that computes the area of a circle. We had to turn it in on the second class-- the same class we were introduced to a programm with input and declaring "doubles and "ints" and whatever. He wanted it to read in diameter too. I quickly put my notes next to the lab pc and tried to COPY as much as possible from the application he went through earlier which calculated grosspay (hourse worked * pay rate) and tried to replace the variables with radius and pi..

it didn't work.. I have NO IDEA what the hell is an object.. a class... a method.. when do I declare things? what should be declared? in what order? relative to what? wtf? fhuta?

80% of the application he went through he said "just memorize it and I'll explain later." I can't think like that. So I went out to the bookstore and got Schaum's outline to programming with Java. It has lots of exercises so I thought it would benefit me. WRONG. First, it also doesn't explain anything and says classes, for example, will be explained in later chapters. OK. I guess that's how programming is.

I took the same problem, calculate the area of a circle, from both school and schaum's outlines. In school we imported JOptionWhatever (system class? blah) BUT in schaum's outlines they DID not import those.. schaum's imported the java.io.* and addes stuff like "throw IO exception" after the main method.. That's something the professor NEVER mentioned.. same goes for the stuff after that like "Input Stream Reader" and bufferReader.. never mentioned in school. Is it because Schaum's outline Java is published in 98 and it's old?

I browsed Amazon and all books got mixed reviews.. What the hell am I to do? I really want to learn it. I just have no idea on what to do right now. :(

Also, for some reason I can't install JGrasp, the editor the professor wanted.. it says can't install unisntaller, can't find jGroup, can't freaking find lift its head from it ass. I tried GWD editer but there are no features to run or compile. can't find them. I also can't compile or run the programs using Dos.. it says "javac" is not a freaking command or something. I uninstalled and installed the SDK dozens of times.. :(

*starts wailing*
 

beerbelly

Banned
If you just started programming in college, then you are behind. Programming should be learned as a second language; it takes years to fully understand and lots of practice to 'perfect'. If you are just not interested in this course or, to a lesser extent, not good in math, then I highly advise you to drop it.
 

RiZ III

Member
Programming doesn't suck however there are a ton of programming teachers that really blow. Also, programming will always suck for you if you don't have interest in it.
 

Chrono

Banned
beerbelly said:
If you just started programming in college, then you are behind. Programming should be learned as a second language; it takes years to fully understand and lots of practice to 'perfect'. If you are just not interested in this course or, to a lesser extent, not good in math, then I highly advise you to drop it.


I'm not going to drop this one. I'll stick with it to the end and do my best. I don't know if I'm good at math, but I'm not bad and can improve. What I want to know is, is it normal for beginners to NOT fully understand classes and methods at the start? I don't feel like I understand a program until I see a 100% anatomy on every single line and what EXACTLY they stand for and all the rules associated with them. >__<
 

RiZ III

Member
Its normal dude. Dont worry about it so much. If you dont understand something, open ur editor and screw around with things to see how they work. One of the best ways to learn imo.
 

Vlad

Member
Well, I've yet to try my hand at Java, but as far as some of your questions go...

When you declare something, you're telling the compiler to make space in memory for a certain type of variable, so your program can use it.

In C++, this would be done like:

float radius;
float diameter;
float circumference;

This declares three variables of type "float" (floating point numbers, as in, numbers that can have decimal values). The "double" and "int" stuff you mentioned are different data types. Ints are integers, and doubles are like float numbers, but with a higher maximum value. Other common data types are char (can store a single character) and bool (stores a value of TRUE or FALSE). The three variables are radius, diameter, and circumference. Once those are declared, you can then write code using those values. You can have users of your program input data to those variables, or you can set the values directly in the code.

In C++ (and C, and Pascal), you declare stuff in the beginning of a program (or a function, but don't worry about that just yet). So before you have any of the body of code, there's usually a bunch of variable declarations of different types, followed by the meat of the program.

Basically, for any program you're working on, just think of, step by step, what it needs to do, first. For example, the easiest way to do your circle program would be something like:

- Prompt the user to enter the diameter of the circle.
- Get the input from the user and input it into the variable "diameter"
- Compute the area of the circle using pi times (diameter/2)², and input the result into the variable "area" (which would be declared above).
- Output the content of the variable "area" to the screen.

The thing to keep in mind is that no matter what, a program only executes one line at a time, so if you're having trouble, just follow the program through line by line and see what does what.

Of course, it's also entirely possible that Java is completely different from the other programming languages I've worked with and everything I just wrote doesn't apply, but I'm sure someone who knows better will say so if that's the case :).
 

Cooper

Member
Is this class for a major, or are you taking it because it sounded interesting? If it's not a required class, it's probably worth dropping and either doing some self study or finding a better teacher.

It's not something you'll understand right away, no matter how good your teachers or textbooks are. However, if the idea of making a computer do whatever you tell it and using it to solve problems sounds fun, you'll enjoy it after a lot of practice.

Java certainly could be an overwhelming language for a complete beginner. You might find C (not C++) or a variant of BASIC easier to manage initially. They were the languages I learned programming with many years ago. Like beerbelly said, it tooks years before I actually thought of myself as pretty good at programming.
 

Vlad

Member
Chrono said:
I'm not going to drop this one. I'll stick with it to the end and do my best. I don't know if I'm good at math, but I'm not bad and can improve. What I want to know is, is it normal for beginners to NOT fully understand classes and methods at the start? I don't feel like I understand a program until I see a 100% anatomy on every single line and what EXACTLY they stand for and all the rules associated with them. >__<

Yeah, that's normal. There is a bit of a learning curve to get over before it clicks usually. If you want, post (or pm) that gross pay program and I'll see if I can figure out what does what for you. That said, don't expect to know exactly what every line does right off the bat. In C++, for example, you need to put a couple of lines at the beginning of most programs to get them to work correctly (or at least, code them easier), and while you do learn exactly what they mean soon enough, it's a little much to get into for someone who's learning the basics of programming.
 

marko

Member
Where is pascal when you need it. Obviously not a useful language in the real world, but a heck of a good first language to learn (much better than C/java). Many kids come out of college these days and hardly know any procedural languages.
 

SD-Ness

Member
Good books I use:

Java Methods: An Introduction to Object Oriented Programming
by Maria Litvin

Java: An Introduction to Computer Science and Programming, Third Edition
by Walter Savitch

The first one is probably better for a beginner. It's made for a 'student' taking an introduction to java course.

Programming is a very controversial task. Some people enjoy it a lot. Some people hate it. Some people are really good; others suck. It takes a lot of logic thinking, puzzle based thinking, computer knowledge, and math skil. You can get better if you're not good initially. It just takes a lot of practice.

Post the code that you have written so far and I'll try to fix it.

You have to compute the area of a circle? Okay, so here is some pseudocode: First you have to know the area of a circle. What is that? A = 1/2*pi*r(squared) You have simple variables given in this formula. You have the A for area. You have the r for radius. You can also have d for diameter as radius and diamter are related. So basically in order to compute the area of a circle you need the radius value. You have to get this from the user. Once you get this value you will have to mulitply it by 1/2 and pi. This will give you the area in units squared.

I'm kind of tired right now and am about to sleep, heh, but I'll post a quick summary of what it should look like:

public class Circle {

private double Area;
private double Circumference;

public static final double PI = 3.14159;

public double GetRadius()
{
double Radius;
System.out.println("Enter the radius of a circle:");
Radius = SavitchIn.readLineDouble();
return Radius;
}

public double FindCircumference(double R)
{
Circumference = 2 * R * PI;
return Circumference;
}

public double FindArea(double R)
{
Area = R * R * PI;
return Area;
}

public void Print(double circ, double area)
{
System.out.println("The circumference of the circle is " + circ);
System.out.println("The area of the circle is " + area);
}

/** Creates a new instance of Circle */
public Circle() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double circ, area, R;
System.out.println("This program takes an inputed radius of a circle from the user, calculates its circumference and area.");
Circle circle;
circle = new Circle();
R = circle.GetRadius();
circ = circle.FindCircumference(R);
area = circle.FindArea(R);
circle.Print(circ, area);
}

}

Yeah I added in circumference too...so just take out the circumference parts that you don't want. I'll explain what I did if you have any questions.
 

Scrow

Still Tagged Accordingly
Oh man, I haven't coded in Java for ages. Looking at the code Zero posted is bringing back memories. When I started the uni course I'm doing now, they started us in Java doing the exact same stuff you're doing now Chrono, then they moved us onto coding in C and C++, which has been the case for about a year now, so I'm not much help when it comes to Java. Though I can look at the code Zero posted and fully understand it, I just wouldn't have been able to come up with that from scratch.

What are you hoping to get out of learning programming? And where are you learning this?

Chrono said:
Does programming stop sucking?
Depends on what you want from it.

Chrono said:
In school we imported JOptionWhatever (system class? blah) BUT in schaum's outlines they DID not import those.. schaum's imported the java.io.* and addes stuff like "throw IO exception" after the main method.. That's something the professor NEVER mentioned.. same goes for the stuff after that like "Input Stream Reader" and bufferReader.. never mentioned in school. Is it because Schaum's outline Java is published in 98 and it's old?
The problem is that there are so many ways you can do the same thing. If you don't know what you have to import, I've found that it's best just to import everything, within reason (though this is probably a really bad habit to get into). Also with trying, throwing and catching exceptions, that's stuff you shouldn't worry about when you're just learning programming. Ignore those sections from the book for now.

Chrono said:
I tried GWD editer but there are no features to run or compile. can't find them. I also can't compile or run the programs using Dos.. it says "javac" is not a freaking command or something. I uninstalled and installed the SDK dozens of times.. :(
Hmmm, I just taking a guess here, but after you've put the SDK on your computer have you set up CLASSPATH and PATH evironment variables (if you're using WinXP)?
 

iapetus

Scary Euro Man
Zero: This being Java, of course, there's no reason to store PI as a variable: just use Math.PI

Chrono: Your problem is that both your teacher and the book you bought suck. They suck the great dangly donkey dick. Any book that promises to explain classes later (probably towards the end) was written by an incompetent C++ programmer who thought they'd try writing a book on Java because other C++ programmers kept making them look bad. (For further reference, see Deitel & Deitel)

What you need is a good book on programming in Java. A couple of recommendations that are a step up from the crap you're using:

The Sun Java Tutorial
Thinking in Java - Bruce Eckel

Both of these are available for free online, and are vastly superior to the book you paid money for. Sorry.
 
Dude, you only started this week. Email your professor and let him know you're having some trouble. Usually they are very willing to help if you just ask.
 

Ghost

Chili Con Carnage!
When working with Java, never underestimate the power of the sun homepage (Java.sun.com) literally everything you can do in java is documented there.

And dont worry about not understanding the jargon, i had the same problem in my first year, just keep coding things and it'll start making sense.
 

Scrow

Still Tagged Accordingly
iapetus said:
Chrono: Your problem is that both your teacher and the book you bought suck. They suck the great dangly donkey dick.
I don't know why... but this had me rolling on the floor laughing ;P
 

SFA_AOK

Member
iapetus said:
(For further reference, see Deitel & Deitel)

Not a fan?

As for the OP - there's always going to be a "don't worry how or why for now, we'll explain in a bit" but I agree with Iapetus, it sounds like the book and the lecturer suck.

I'd be tempted to find myself a good book and teach myself.... much better to move at your own pace (though of course, you have to try and keep up with the class so you know what's going on). I'm quite fond of Sams' "Teach Yourself X in Y Days books" - many of them are written from the perspective that you don't know how to program so go over the fundementals. They'll start with a basic program and work from there, explaining how and what it does. I've only read a couple though, and not their Java book so I couldn't recommend it.

Part of the problem is that it's easy to get results in Java even though they may not be correct so some teachers will get you doing things but not really understanding the nuts and bolts... another good reason for teaching yourself.

But don't worry - this stuff is confusing at first but you'll click sooner or later :)
 

iapetus

Scary Euro Man
SFA_AOK said:
As for the OP - there's always going to be a "don't worry how or why for now, we'll explain in a bit

I disagree - I think it's lazy teaching and bad practices that lead to that in training. It's possible to teach Java quite successfully starting with a good OO basis. I know this because it was my job to do that for several years, and I was almost as proud of our course material at the time as I was sickened by some of the other stuff I saw out there.

That wasn't just a throwaway jab at C++ programmers (and Deitel and Deitel's book represents the worst of what I'm about to complain about) - C++ can be taught in a different way to Java. You can start off treating it as C with single-line comments, and ignore the OO stuff until later on. I think that's a bad thing to do, and responsible for a lot of the bad coding practice out there, but it's a sane approach and I can see why people do it.

You just can't get away with that in Java. Because you can't write code outside a class and because everything you do beyond the simplest mathematical operations requires you to use the class library, which while it isn't the best designed thing out there does follow a lot of sound OO principles, and does require you to know a bit about OO and how it relates to Java to understand what's going on.

That's why I recommend Eckel's book - the first two chapters are about object orientation, which is the right way to teach Java (or any other OO language, for that matter). None of this 'we'll explain about classes later, for now just write everything in a single public static void main(String[] args) method, and we'll explain what that means later as well, once we've fully indoctrinated you in the art of bad programming' rubbish. The Sun Java Tutorial does the same sort of thing, in a somewhat more beginner-friendly way. The two combined should be required reading for anyone learning Java, and even more so for anyone who dares to think they can teach it.
 

marko

Member
I think what beerbelly said needs repeating. If your first exposure to programming is in an entry level course, then you are way behind. While suggestions of looking at the sun java tutorial are a decent idea. for someone with zero programming knowledge and experience, even that might be too advanced. Best to try looking at as many books/references as possible, and go with the one that helps you the most, especially if your instructor/course book are not doing the job.
 

SFA_AOK

Member
Think you over reacted a bit Iapetus. I was absoloutely NOT condoning "Don't worry about objects now, we'll explain later" I was saying there's some level of it to be expected. Even if it's an introductory "Hello, World!" program because they're likely to present the program first and then (after it) explain how and why it works. And there are going to be some subjects that need to be explained more in depth later because that's the way material should be broken up. Of course, there are some subjects that need to be priorities.

The result is that you typed all that stuff out and my viewpoint isn't far removed from yours.

As for D&D - reason I asked is I've got a D&D C++ book. I know how to program (far from being an expert at it) and I was thinking of giving it a go because I've neglected C++ for a while. Not worth it you reckon?
 

iapetus

Scary Euro Man
SFA: Wasn't so much reacting to you as taking the excuse to go off on my traditional how-to-teach-Java rant in more depth. :)

I don't know about the Deitel & Deitel C++ book - their Java book is pretty dire, complete with very dodgy 'multimedia cyberclassroom' that doesn't actually work, but they almost certainly have a better grasp on C++ (it's their habit of trying to treat Java like C++-lite that makes their Java books so bad).

That said, I don't see how Bruce Eckel's Thinking in C++ could be bad, and it's also available for free download from http://www.bruceeckel.com - so well worth a look as an alternative. I claim no expert experience in C++, though. Everything I ever knew about the language I learnt from a little yellow book called "Ot C k C++" and written (if the name wasn't sufficiently clear) in Russian, which I didn't speak particularly well at the time. I wouldn't recommend it as a good book even for a native speaker, for what it's worth - full of bad teaching (and coding) practice...
 

SFA_AOK

Member
I'm just interested in picking up some syntax, useful libraries and stuff... It looks pretty in depth. I think it takes a fairly OO approach come to think of it.

Saying that, my Java coding could use some spit and polish really. I'm working on a project with a friend of mine, people haven't been too critical of the code so far but there's some stuff in there that makes me cringe (the bigger howlers aren't mine though... I think) :)
 

Chrono

Banned
Wow. Thanks for all your help!

Cooper said:
Is this class for a major, or are you taking it because it sounded interesting?

It's the only programming class required for my Electrical Engineerng major.

Zero said:
Good books I use:
Java Methods: An Introduction to Object Oriented Programming
by Maria Litvin

I already ordered it and got another one: link. It has a lot of good reviews. Thanks for posting the code-- though I'm not having a problem with one particular program but with what the lines stand for. The books should help. :p

Scrow said:
Hmmm, I just taking a guess here, but after you've put the SDK on your computer have you set up CLASSPATH and PATH evironment variables (if you're using WinXP)?

Yeah I thought that was the problem (it was in the troubleshooting section in Schaum's program w/ Java) but now I got TextPad which is great. I compile and run the programs in it so no need for Dos right now.

iapetus said:
Zero: This being Java, of course, there's no reason to store PI as a variable: just use Math.PI

Chrono: Your problem is that both your teacher and the book you bought suck. They suck the great dangly donkey dick. Any book that promises to explain classes later (probably towards the end) was written by an incompetent C++ programmer who thought they'd try writing a book on Java because other C++ programmers kept making them look bad. (For further reference, see Deitel & Deitel)

What you need is a good book on programming in Java. A couple of recommendations that are a step up from the crap you're using:

The Sun Java Tutorial
Thinking in Java - Bruce Eckel

Both of these are available for free online, and are vastly superior to the book you paid money for. Sorry.

... I put down 90 dollars in Amazon for two books and one day shipping. I guess I should've waited lol. 60 dollars more and I could've got an xbox with halo! hehe. They're books though I and guess at least I'll learn something from them and their exercises. I downloaded the free book you linked and bookmarked the sun-tutroial. Thanks. It looks like i'll have a busy weekend. :D

My professor and test do suck. The reviews for the text are horrible (and it's not for beginners-it says so on the back of it that it's intended for experienced programmers to "review" stuff- link ).


Cerebral Palsy said:
Dude, you only started this week. Email your professor and let him know you're having some trouble. Usually they are very willing to help if you just ask.

I don't think he'd care. I can tell from lecture he just wants the class over with. When we go to lab he barely answers people's questions- he does it with the minimum and smallest answer possible lol.

Ghost said:
And dont worry about not understanding the jargon, i had the same problem in my first year, just keep coding things and it'll start making sense.

I'm just getting used to that. It really freaked my out at first though. No point in worrying I guess.


SFA_AOK said:
I'd be tempted to find myself a good book and teach myself.... much better to move at your own pace (though of course, you have to try and keep up with the class so you know what's going on).

Yep. I plan to learn ahead of the class. It's only a single class in summer I have, 2 hours a day in the morning and we don't get that much material in each lecture. There should be no problem with keeping up. :)
 
Status
Not open for further replies.
Top Bottom