Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

A Question For All The Greenhorns

 
Gerard Gauthier
Ranch Hand
Posts: 127
2
Monad Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to Java but I'm not new to programming and I'm wondering what areas of Java programming do rookie Java programmers tend to overlook or not give enough attention to?

This question is aimed at Java programmers who have experience with the language and writing real Java programs.Hopefully the answer will help us rookies on certain overlooked topics.

If I had to choose one area that surprised me with its lack of coverage in the intro materials -> the class path. I'm surprised how much(implicitly and explicitly) class path shows up in real java programs. Its everywhere but intro materials don't really emphasize its importance.


 
Junilu Lacar
Sheriff
Posts: 16718
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find that many people don't pay attention to testing that much. This is an extremely important part of development. Developers who don't know how to test their code tend to produce poor quality code and designs.
 
fred rosenberger
lowercase baba
Posts: 13014
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find rookie programmers don't spend enough time thinking and designing.  They figure their job is coding, and that means producing lines of code.  I was guilty of it too.  Some may argue I still am.

There is an argument that you should perhaps spend as much as 80% of your time thinking, and then 20% typing.
 
Junilu Lacar
Sheriff
Posts: 16718
278
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
90%+ thinking.

Typing is mechanical. When you type, you're simply letting your thinking overflow into the computer through your fingers. That's why it's important to learn how to touch type.
 
Paul Clapham
Marshal
Posts: 26915
82
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tutorials.

From what I've seen here (okay, maybe not a representative sample) a lot of programmers will start working on a part of Java which they haven't seen before, and their modus operandi is to just start writing code. And then they code themselves into a corner which they can't get out of. Whereas if they had starting by reading a tutorial, and downloading some of its code and playing around with it, they wouldn't be in that mess.

And it's not like the Internet is short of tutorials. There's plenty of them out there and some of them are even not bad.
 
Carey Brown
Saloon Keeper
Posts: 8777
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Beginners should be writing tons of code snippets. Reading the Javadocs on a class and method often leads you to make a lot of assumptions about it's real behavior (e.g. Scanner). Taking a bit of time out to write a few lines of code to exercise a method or methods to assure yourself that it indeed works the way you thought will save you lots of head scratching later. Snippets can also be the source for examples that you can cut and paste into projects.
 
Campbell Ritchie
Marshal
Posts: 74393
335
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That became much easier with Java9 when JShell was introduced. You can run one line of code and see it go wrong. I firmly believe that you can learn more from code going wrong than from code working beautifully first time.
 
Paul Clapham
Marshal
Posts: 26915
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nitpick:

Gerard Gauthier wrote:This question is aimed at Java programmers who have experience with the language...



But "greenhorns" are "beginners", so your question wasn't aimed at them.

Greenhorn definition

My local greenhorns: The Three Greenhorns
 
Gerard Gauthier
Ranch Hand
Posts: 127
2
Monad Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Nitpick:

Gerard Gauthier wrote:This question is aimed at Java programmers who have experience with the language...



But "greenhorns" are "beginners", so your question wasn't aimed at them.



Yes question wasn't aimed at them but the answers were.
 
Campbell Ritchie
Marshal
Posts: 74393
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gerard Gauthier wrote:. . . what areas of Java programming do rookie Java programmers tend to overlook . . .?

We see far too many people not writing object‑oriented code.

. . . the class path. . . .

Most true rookies don't need a CLASSPATH at all. You only need it after you have started using external resources.
 
Stephan van Hulst
Saloon Keeper
Posts: 13427
302
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:You only need it after you have started using external resources.


I think that one of the first lessons should be how to set up a project directory structure, including how to compile your classes into a different directory than where your source files are. To prevent you from having to switch between directories all the time, you would then need to specify the class path when you tell java or jar to run your application.
 
fred rosenberger
lowercase baba
Posts: 13014
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:But "greenhorns" are "beginners", so your question wasn't aimed at them.


well...to nitpick your nitpick...

Greenhorns here are folk with less than <some number of posts>.  If James Gosling himself joined here, he'd be a greenhorn for a while.
 
Liutauras Vilda
Marshal
Posts: 8144
572
Mac OS X VI Editor BSD Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@OP

Also I'd say, try not to mess around when writing a code. Meaning, make sure formatting is consistent, code is well indented. No excessive amount of empty lines between the code blocks, at the same time, code is not squeezed onto fewer lines as possible. Variables names are chosen carefully, so they tell exactly what they represent.

These things aren't difficult to get them right right from the beginning (except maybe it will take some time to name variables in an optimum way..), and they do help a lot.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic