891 reputation
411
bio website
location
age
visits member for 2 years, 10 months
seen Jul 10 at 19:38

May
19
comment How to design the relation between a Game and a Player in a game?
+1 for the GameState-object. I would also consider making the GameState-object immutable, which may sound counterintuitive at first but could lead to the simplest and most efficient design. If the performAction-method actually mutates the state instead of just returning a new object representing the state after the action, you'll soon need to make a copy of the state before each performAction-call for backtracking purposes. (Think about an undo feature or a backtracking AI or a complex action that could fail halfway through, leaving behind an undefined game state...)
Mar
19
comment How to find number of points with same minimal distances on matrix
How many fixed points are given, typically or in worst case?
Mar
17
comment Is there any issue if ternary operator is used in super() method
@nigelthomas Ok. It's very hard to see what the reviewers are trying to point out without seeing the actual code... :)
Mar
17
comment Is there any issue if ternary operator is used in super() method
Do you need the parameter name at all when hasName == false? It seems to me that the problem is not about superclass constructor call or ternary operator. Your constructor method signature looks a bit strange. I would probably get rid of the hasName-parameter.
Mar
17
comment Is there any issue if ternary operator is used in super() method
Does your code compile? It's hard to see what the reviewers are trying to point without seeing the code...
Jan
30
comment Are classes with only a single method a problem?
@Phoshi: Yes, I understand. I never claimed that a functional approach wouldn't work as well. However, that is clearly not the topic. A video compressor or a video transmogrifier or whatever is still a perfectly valid candidate for an object.
Jan
30
comment Are classes with only a single method a problem?
@Phoshi: Yes, I agree. There's no need for subtyping or state. There's just a need for some sort of video manipulation which doesn't really require a single object. However, yjwong has chosen a certain object oriented approach to meet that need, and that approach opens the possibility to use subtyping and state and all sorts of other object oriented tricks if needed later on. I still fail to how using objects to provide the needed functionality is "not object oriented".
Jan
30
comment Are classes with only a single method a problem?
@JanHudec: Extending an interface (adding more visible methods) does not affect existing clients.
Jan
29
comment Are classes with only a single method a problem?
@JanHudec: By extending I mean adding state and functionality to the class. That means more members and probably more visible methods. I certainly agree that there are situations where free functions are handy and classes are quite awkward, but this doesn't seem to be the case here.
Jan
29
comment Are classes with only a single method a problem?
"Why pretend it's a class when it isn't." Having an object instead of a free function allows state and subtyping. That could prove valuable in a world where requirements change. Sooner or later there's a need to play with video compression settings or to provide alternate compression algorithms. Before that the word "class" simply tells us that this function belongs to an easily extensible and interchangeable software module with a clear responsibility. Isn't that what OO really aims at?
Jan
3
reviewed Reviewed Motivate developers to keep up with admin tasks
Jan
3
reviewed No Action Needed What's a similar functionality in JavaScript that insures the object has X data before any actions are taken?
Jan
3
reviewed No Action Needed Drawback of mixing C++ code with C for performance purposes
Jan
3
awarded  Custodian
Jan
3
reviewed No Action Needed Which methods should be put in an interface and which in abstract classes?
Jan
3
awarded  Citizen Patrol
Nov
26
comment Teaching Classes and Objects
+1 That's not only a good example or metaphor but an actually working model to start with. Writing a runnable program and playing around with it is the best way to learn after all. That example also leads easily to understanding collections and thinking about algorithms: how to sort cards, how to shuffle a deck, how to score a poker hand, etc.
Oct
17
comment Empty interface to combine multiple interfaces
Isn't the correct syntax <RW extends Readable&Writable>?
Oct
16
revised Can a beginner in programming start learning game development?
added 153 characters in body
Oct
16
answered Can a beginner in programming start learning game development?