The Source for Java Technology Collaboration

Home » java.net Forums » JDK » Java SE

Thread: Add useful things to the API to help beginners.

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 14 - Last Post: Nov 2, 2004 6:31 AM by: kobit
epesh

Posts: 9
Add useful things to the API to help beginners.
Posted: Oct 24, 2004 11:14 AM
  Click to reply to this thread Reply

I think Mustang should have something like java.homework, to handle common homework assignments for classes like data structures or simple Java homework.

Examples might be: "java.homework.BankTellerList" or "java.homework.CalculateAverageOfFloats" and stuff like that. That would make homework assignments much easier, and for people who couldn't do the homework, helping them would be easier too: You'd just say "see java.homework.j101.HelloWorld".

patrikbeno

Posts: 268
Re: Add useful things to the API to help beginners.
Posted: Oct 24, 2004 12:19 PM   in response to: epesh
  Click to reply to this thread Reply

-1
These kind of things belong to demos and tutorials, not to platform. This forum is not about demos and tutorials, I believe.

brucechapman

Posts: 75
Re: Add useful things to the API to help beginners.
Posted: Oct 25, 2004 8:27 PM   in response to: patrikbeno
  Click to reply to this thread Reply

He was joking Patrick :)

patrikbeno

Posts: 268
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 1:10 AM   in response to: brucechapman
  Click to reply to this thread Reply

I realized that after his another post ;-) (Taking this just too serious :-))

monika_krug

Posts: 144
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 1:36 AM   in response to: patrikbeno
  Click to reply to this thread Reply

He might have spent too much time on forums.java.sun.com and have meant this seriously ;-) .

Monika.

vikstar

Posts: 13
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 10:34 AM   in response to: epesh
  Click to reply to this thread Reply

Add the class: YetAnotherStupidBeginnerError extends Error.
public class MyClass {
  public static void main(String args[]) {
    try {
      for (int j = 0; j <= args.length; j++) {
        System.out.println("arg " + j + " = " + args[j]);
      }
    } catch (YetAnotherStupidBeginnerError e) {
      e.printStackTrace();
    }
  }
}
In this case, the YetAnotherStupidBeginnerError will be thrown when the JVM analyses the code, before it is executed and has a chance to throw an IndexOutOfBoundsException.

monika_krug

Posts: 144
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 11:39 AM   in response to: vikstar
  Click to reply to this thread Reply

Well that would really be a great addition to Java which would finally lead to Java's world success over .NET etc ;-) Might even prove the halting problem wrong.

Monika.

patrikbeno

Posts: 268
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 12:03 PM   in response to: vikstar
  Click to reply to this thread Reply

Horrible ;-)
I suggest that compiler automatically optimizes such code by fixing accidental '

vikstar

Posts: 13
Re: Add useful things to the API to help beginners.
Posted: Oct 26, 2004 8:22 PM   in response to: patrikbeno
  Click to reply to this thread Reply

Good idea, it would also automatically fix stuff like:
boolean a = false;
boolean b = true;
if (a = b) {
  System.out.println("a and b were equal");
}
or
public class Light {
  private boolean on = false;
  public void toggle() {
    on = !on;
  }
  public boolean isOn() {
    return !isOff();
  }
  public boolean isOff() {
    return !isOn();
  }
}


monika_krug

Posts: 144
Re: Add useful things to the API to help beginners.
Posted: Oct 27, 2004 3:06 AM   in response to: patrikbeno
  Click to reply to this thread Reply

> Horrible ;-)
> I suggest that compiler automatically optimizes such
> code by fixing accidental ' and use switch -XXnewbie-fixes:off
>
> ;-) What do you think?

Great idea. Should be the minimal requirement for JDK 6.0 ;-)

Monika.

smbell

Posts: 11
Re: Add useful things to the API to help beginners.
Posted: Oct 28, 2004 10:34 AM   in response to: monika_krug
  Click to reply to this thread Reply

I'm sorry, but I don't think the compiler playing with operators is a good idea at all. Even more so when it's a newbie programming. You don't learn how to code without making a few mistakes and tracking down a few bugs. I would lose my mind if I wanted something like if(a=b), the compiler decided that wasn't a good idea, and I had to find out what the compiler flag was to make the code compile as I had written.

sumitkishore

Posts: 41
Re: Add useful things to the API to help beginners.
Posted: Oct 28, 2004 10:38 AM   in response to: smbell
  Click to reply to this thread Reply

Uhh ... with tools like the Inspection Gadgets plugin to IDEA, these kind of newbie errors could easily be pointed out. Or with PMD integrated, you could get compile-time warnings of newbie errors.

Sumit.

patrikbeno

Posts: 268
Re: Add useful things to the API to help beginners.
Posted: Oct 28, 2004 3:53 PM   in response to: smbell
  Click to reply to this thread Reply

guys, this is funny section. don't enter until you've drunk enough ;-)

carmello

Posts: 14
Re: Add useful things to the API to help beginners.
Posted: Oct 29, 2004 12:22 AM   in response to: smbell
  Click to reply to this thread Reply

I totaly agree with smbell, the compiler shouldn't be a teacher.
Beginners should read books/articles and write code to learn
how to write code.

kobit

Posts: 4
Re: Add useful things to the API to help beginners.
Posted: Nov 2, 2004 6:31 AM   in response to: carmello
  Click to reply to this thread Reply

ROFL
All these suggestions were just jokes!

Anyway, do you know about plans to support JDK 5.0 syntax
by tools like PMD, checkstyle and so on?

I have just switched to JDK 5.0 and miss these tools a lot.

Artur




 XML java.net RSS