Ok will do. Thanks.
Any reason why I should avoid stringtokenizier?
53 Replies - 1311 Views - Last Post: 22 January 2013 - 07:54 AM
#46
Re: 20 questions on a variety of topics to aid me learn Java.
Posted 21 January 2013 - 08:18 PM
#47
Re: 20 questions on a variety of topics to aid me learn Java.
Posted 21 January 2013 - 08:19 PM
farrell2k, on 21 January 2013 - 10:08 PM, said:
jon.kiparsky, on 22 January 2013 - 03:03 AM, said:
You might have something as simple as this:
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.
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.
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
#48
Re: 20 questions on a variety of topics to aid me learn Java.
Posted 21 January 2013 - 08:19 PM
#49
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.
#50
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:
http://docs.oracle.c...gTokenizer.html
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
#51
Re: 20 questions on a variety of topics to aid me learn Java.
Posted 21 January 2013 - 08:24 PM
Oh ok thanks.
#52
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!
#53
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
http://www.youtube.c...er/thenewboston
This post has been edited by slehmann101: 22 January 2013 - 07:53 AM
#54
Re: 20 questions on a variety of topics to aid me learn Java.
Posted 22 January 2013 - 07:54 AM
|
|

New Topic/Question
Reply




MultiQuote






|