20 questions on a variety of topics to aid me learn Java.

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4

53 Replies - 2259 Views - Last Post: 22 January 2013 - 07:54 AM Rate Topic: -----

#46 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:18 PM

Ok will do. Thanks.

Any reason why I should avoid stringtokenizier?
Was This Post Helpful? 0
  • +
  • -

#47 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 8010
  • View blog
  • Posts: 13,716
  • Joined: 19-March 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:19 PM

View Postfarrell2k, on 21 January 2013 - 10:08 PM, said:

View Postjon.kiparsky, on 22 January 2013 - 03:03 AM, said:

You might have something as simple as this:

view.update(state);


Where state comprises, essentially, the world. What does view do with this? That's up to view. That's the point: if I'm the model, I don't have to care.


And that update() is still a setter in my book. Maybe not. I'll have to think about it. :)/>/>



Sorry, I updated my previous post while you were posting this.
Bringing that forward:

Quote

EDIT: The difference between this and a setter is important. A setter tells a class what value one of its fields should have. This means that some other class is responsible for doing the work that properly belongs to that class. A more effective design centralizes all of the calculation for a given class in that class.
The important point to focus on is: you should never have direct access to another object's internal state. Tight coupling is to be avoided.




And for me that's the key: an update tells the class what the world thinks is going on, and lets the class figure out what to do about it. Think of the collision case: this is the difference between telling an object what its new velocity and direction should be, and telling it what force has been applied to it.

This post has been edited by jon.kiparsky: 21 January 2013 - 08:22 PM

Was This Post Helpful? 0
  • +
  • -

#48 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10809
  • View blog
  • Posts: 40,288
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:19 PM

Quote

Any reason why I should avoid stringtokenizier?


View Postmacosxnerd101, on 21 January 2013 - 10:16 PM, said:

StringTokenizer is legacy code

Was This Post Helpful? 0
  • +
  • -

#49 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:21 PM

Sorry, I must not have read what you said properly.
Was This Post Helpful? 0
  • +
  • -

#50 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10809
  • View blog
  • Posts: 40,288
  • Joined: 27-December 08

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:23 PM

Also, as per the documentation:

Quote

StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.


http://docs.oracle.c...gTokenizer.html
Was This Post Helpful? 0
  • +
  • -

#51 DrPerry  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 19
  • Joined: 21-January 13

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 08:24 PM

Oh ok thanks.
Was This Post Helpful? 0
  • +
  • -

#52 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 864
  • View blog
  • Posts: 2,653
  • Joined: 29-July 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 21 January 2013 - 09:01 PM

This thread is pretty much dead, so let me just say that I always use StringTokenizer, just to stick it to the man!
Was This Post Helpful? 0
  • +
  • -

#53 slehmann101  Icon User is offline

  • D.I.C Head

Reputation: 21
  • View blog
  • Posts: 146
  • Joined: 30-November 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 22 January 2013 - 07:53 AM

This guy has some good tutorials:
http://www.youtube.c...er/thenewboston

This post has been edited by slehmann101: 22 January 2013 - 07:53 AM

Was This Post Helpful? 0
  • +
  • -

#54 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 8010
  • View blog
  • Posts: 13,716
  • Joined: 19-March 11

Re: 20 questions on a variety of topics to aid me learn Java.

Posted 22 January 2013 - 07:54 AM

View Postfarrell2k, on 21 January 2013 - 11:01 PM, said:

This thread is pretty much dead, so let me just say that I always use StringTokenizer, just to stick it to the man!



If that's your kink, daddy-o, then go to.
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4