Jump to content
Sign in to follow this  
TheSingularity

Why Do Beginning Programming Books Always Skip Things?

Recommended Posts

Hi all,

 

I made a post a while back about buying Java, A Beginner's Guide, Fifth Edition.

 

I read through the first introductions and history to Java and got up to typing my first simple program. Now I left it for a while then came back to it a couple days later. I tried typing the code in as suggested but I kept getting stuck and not understanding something. The problem was it didn't mention anywhere that I had to open command prompt type in where the Java Development Kit is installed and where Java and Javac were installed and then also place the coded Example.java file into that folder. So eventually after reading it a couple times I came across it mentioning something about writing the PATH so it is easier to find. So it also mentioned there the location in C:/Program Files/Java/jdk1.7.0_03/bin was the location of all the folders. So I manually went to that folder and tried opening javac and java and nothing happened command prompt flashes open and disappears. So I then tried moving the Example.java file I had created on top of javac which then created Example.class. So I was like ahhh that is what I am supposed to do, I then tried dropping Example.class onto java which did nothing...

 

So for a while I was stumped...I left it for a while longer, I also read over it some more, todayt after some more reading of it and trying again, of which I also read about it on the net. On the net found that ohhh you have to open command prompt and enter cd C:/Program Files/Java/jdk1.7.0_03/bin. From there you can write javac Example.java and get Example.class. And then from there you can type java Example and get "Java drives the Web." as a reply.

 

So I just read over the book again and find one mention to using command prompt on the page before stating "One other point: The JDK runs in the command prompt environment and uses command-line tools. It is not a windowed application. It is also not an integrated development environment (IDE)." It also mentions quite often in the A First Simple Program chapter abount command-line and command-line tools but not once that you need to open command prompt to be able to do any of this.

 

Anyway after this huge amount of confusion until I read up about it on the net myself, I've begun wondering why is it that so many books for Beginner's, I'm talking absolute beginners like it also mentions in the book does it not tell you the basics of the very basics?

 

I had this happen before where a guide didn't state I needed a compiler this was when I was younger and I just gave up because the guides weren't trustworthy after that or well I didn't trust them.

 

So any explanations as to why this is would be helpful. And any information on whether I'm now actually doing it right, I also read somewhere that I'm suposed to set the PATH which it also mentions in the book but also not exactly how but here it does in more detail: http://introcs.cs.princeton.edu/java/15ino...indows-cmd.html. And yet setting this PATH doesn't seem to do anything I still have to type in cd C:/Program Files/Java/jdk1.7.0_03/bin so what exactly is the point...?

 

At least now I can move on because I now know how to set it up -.- and enter some actual code and have it respond finally.

 

Thanks in advance for any replies.

Share this post


Link to post
Share on other sites

Have you closed and reopened the command prompt since changing the path variable? If so and it still doesn't work, paste here what you have.

Share this post


Link to post
Share on other sites

This is why beginner books are useless. Get a good book aimed at professionals and fill in the dots yourself, because you're going to have to do that once you start your own projects anyway. May as well get some practise in, because there won't be a "How to write X application for beginners" book.

 

Once the PATH is set, you don't have to change to the bin directory at all. You simply type:

javac Example.java
and it will compile. Of course, you have to be in the directory where Example.java is located. Edited by .:Cyb3rGlitch:.

Share this post


Link to post
Share on other sites

People that write books for beginners are always noble in intent, but they usually make too many assumptions about what the reader knows.

 

Glitch's advice is good.

Share this post


Link to post
Share on other sites

One common assumption with any programming book is that you are familiar with how the environment is setup and works. Your problem has nothing to do with Java and everything to do with environment variables on Windows.

Share this post


Link to post
Share on other sites

This is why beginner books are useless. Get a good book aimed at professionals and fill in the dots yourself, because you're going to have to do that once you start your own projects anyway. May as well get some practise in, because there won't be a "How to write X application for beginners" book.

 

Once the PATH is set, you don't have to change to the bin directory at all. You simply type:

javac Example.java
and it will compile. Of course, you have to be in the directory where Example.java is located.

That explains it, when I normally type javac Example.java I get back:

 

javac: file not found: Example.java

Usage: javac <options> <source files>

use -help for a list of possible options

 

Whereas when I type in cd C:\Program Files\Java\jdk1.7.0_03\bin where I've now moved the Example.java because from what I read and understood it had to be located where javac and java were, then typing javac Example.java works.

 

So from that I'm assuming I have to place any code in the default directory which for me is C:\Users\Powermaniac, right?

 

This book is rather detailed, its just either I forgot something when I came back to it, misread something, or just didn't understand something...Unless there really was no information whatsoever but that doesn't quite make sense.

 

Yeah, I understand what it says now it mentions you need to run it in command prompt but it mentions on the next page when talking about compiling it that I may need to set the PATH not specifying what the PATH is or where it is. It also mentions a faster way of just setting the directory to where the tools are, not mentioning again you have to type "cd" before hand to actually set the directory and not just C:\Program Files\Java\jdk1.7.0_03\bin.

 

Anyway I can move on now I guess...Just see what the response to having my coded files placed in c:\Users\Powermaniac if that is necessary or if I can just place them on the desktop...Seeing as that would be easier...

Share this post


Link to post
Share on other sites

Y'know, it wasn't until I moved to a Linux box and understood *nix, paths, the shell, etc. that I could finally get compiling stuff under windows via cmd.exe (vs an IDE). To this day, I'm not sure that beginner books really should have people messing about with that stuff under Windows. *shrugs

Share this post


Link to post
Share on other sites

Yeah the book also advises against using an IDE...But I think that may have been a better idea if they had of suggested using a particular IDE with the explanations on how to set that up or atleast a link that explains setting it up.

 

I've messed around in Linux before...Its just not very often that you are actually told to use cmd.exe in Windows...So I either payed no attention to it, or skipped it, or misunderstood it, or it wasn't there although I'm sure it is just not very clearly...

Share this post


Link to post
Share on other sites

Not using an IDE for Java? You're kidding, right? That's like not using an IDE for .Net - utterly retarded. The only time I think an IDE is not needed is straight-up interpreted languages, where you get feedback instantly anyway, and even then I prefer Intellisense style features (hence why Aptana is my go-to for PHP-based web dev)

Share this post


Link to post
Share on other sites

Not using an IDE for Java? You're kidding, right? That's like not using an IDE for .Net - utterly retarded. The only time I think an IDE is not needed is straight-up interpreted languages, where you get feedback instantly anyway, and even then I prefer Intellisense style features (hence why Aptana is my go-to for PHP-based web dev)

It says this about IDEs:

 

"In addition to the basic command-line tools supplied with the JDK, there are several high-quality IDEs available for Java, such as NetBeans and Eclipse. An IDE can be very helpful when developing and deploying commercial applications. As a general rule, you can also use an IDE to compile and run the programs in this book if you so choose. However, the instructions presented in this book for compiling and running a Java program describe only the JDK command-line tools. The reasons for this are easy to understand. First, the JDK is readily available to all readers. Second, the instructions for using the JDK will be the same for all readers. Furthermore, for the simple programs presented in this book, using the JDK command-line tools is usually the easiest approach. If you are using an IDE, you will need to follow its instructions. Because of differences between IDEs, no general set of instructions can be given."

 

...So...Yeah...The only thing it mentions about command prompt is this:

 

"One other point: The JDK runs in the command prompt environment and uses command-line tools. It is not a windowed application. It is also not an integrated development environment (IDE)."

 

Again, as i said earlier not much indication of the fact you have to open command prompt to be able to do anything...And it then goes on to talk about setting up a PATH but doesn't say where it is you would set that up just what it needs to be set to. And it also shows a quicker way of setting the directory up manually each time that is faster but it advises against that and says you should setup the PATH correctly -.-...

Share this post


Link to post
Share on other sites

An IDE is unnecessary for a single class app.

wot?

 

the number of classes is not indicative of lines of code, amount of functionality, etc.

 

I don't think a single class app should even exist, but unforunately it's possible to write a TransactionScript style, uber class that does way more than it should. too many bad developers don't stick to the single responsiblity principle

Share this post


Link to post
Share on other sites

An IDE is unnecessary for a single class app.

wot?

 

the number of classes is not indicative of lines of code, amount of functionality, etc.

 

I don't think a single class app should even exist, but unforunately it's possible to write a TransactionScript style, uber class that does way more than it should. too many bad developers don't stick to the single responsiblity principle

 

If you have a single class that requires an IDE to navigate, then you have bigger problems than your development environment. Besides, I wouldn't expect examples from a beginners book to require the power of an IDE.

Share this post


Link to post
Share on other sites

If you have a single class that requires an IDE to navigate, then you have bigger problems than your development environment. Besides, I wouldn't expect examples from a beginners book to require the power of an IDE.

So, making them struggle with a command-line compilation routine that they're never going to do again once they move past the book is a better idea?

 

When I was younger, it nearly scared me off (it was C++). I got an IDE (Dev-C++ at the time, years back now) and then everything started clicking, I was able to do things much quicker.

 

I honestly think learning workflows is just as important as the languages themselves

Share this post


Link to post
Share on other sites

I'm in the process of learning my first coding language (Inform 7), and if it weren't for the awesomeness of the IDE I would have given up already. Why not use an IDE which lets you concentrate on learning the language, helps you find errors, etc, rather than having to mess around every time you want to test / run your code?

Edited by TazFromOz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×