Reputation
1,019
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
8 11
Newest
 Pundit
Impact
~29k people reached

  • 0 posts edited
  • 0 helpful flags
  • 163 votes cast
Jun
28
answered What design pattern is this?
Jun
23
awarded  Pundit
Jun
23
comment How safe is it to compile a piece of source code from a random stranger?
Java does allow hiding of runnable code in comments. Not all Java IDEs perform unicode conversions when doing syntax highlighting, which is not remotely the same thing.
Jun
17
comment Scientific evidence that supports using long variable names instead of abbreviations?
Given that loop variables or intermediate values in long formulas often have single character names i, j, k without loss of meaning ( calling them outerIndex, secondIndex adds no value), is the code more understandable because of the longer names or because there are fewer nested loops or multi-line formulas?
Jun
7
comment How to tell your boss that his programming style is really bad?
I'd be very surprised if a checking tool would pick up the examples - if you get a warning gol comparing string values or having a loop with a break in it, then an awful lot of valid code will generate warnings
Jun
6
comment Abstract Property In Base Class To Force Programmer To Define It
@GisMofx If you want to force the state name in each subclass, make the get abstract but don't require a state. Then each subclass will have to provide return "MyState1" as their implementation, and can add mutable storage for the value if they need it. But you need to clarify the requirements in the question - does every type of state require a StateName which can be read, and does any type of state require it to be mutated after creation?
Jun
1
comment FizzBuzz on Large Scale
The order of keys in a Dictionary is not deterministic, so your div > i test isn't reliable.
May
28
answered Design pattern for mapping data fields
May
27
comment When is an object of real world a (computational) object in OOP world?
@overexchange that assumes a 1:1 mapping between real world state and object state. It is quite common for a real world objects to be represented as something higher dimensional - for example, an object representing a ball might have an associated sequence of seven dimensional vectors representing it position and rotation in space and time. The state of the real world ball at an instant corresponds to a value in the sequence, and the state evolves over time, but the sequence does not have to be mutable to implement that.
May
25
comment A new name for unit tests
You must write very simple code then. The amount of reachable states in most modern systems mean that to do end-to-end testing would take the lifetime of the universe - testing two pieces each with 4bits of state takes 16 cases to test each, or 32 test cases in total; made into an end-to-end system gives 8bits of state or 256 test cases to cover all states. Personally, I'd rather do 1/8 the work.
May
20
comment Why are shortcuts like x += y considered good practice?
Most functional programmers will consider this bad practice.
May
20
comment Problems with OO design for application with pluggable components
You also might find dl.acm.org/citation.cfm?id=1134016 interesting as a different approach
May
19
comment Python: Are all dictionary comprehensions just more expressive and compact for loops?
'Expressive power' has a specific meaning when discussing computer languages, if you use 'expressive' by itself then half your audience will think you mean the non-technical 'effective at conveying meaning' and half will think you mean 'having a greater expressive power'
May
13
answered “Sweep” a vector of pointers
May
13
comment Teaching myself, as a physicist, to become a better programmer
Although physics is potentially a rich source of metaphors, the intent in XP is finding a metaphor which facilitates communication with the on-site customer and other team members, so would generally tend to choose metaphors which are more commonly understood.
May
13
answered Why I need to make method of my class private, If I need to access it throughout my application?
May
8
comment Can a UML class diagram show two different relationships between two classes?
An inner class is not an aggregate of the outer class, so your reasoning is formless.
May
1
comment Is it okay to have objects that cast themselves, even if it pollutes the API of their subclasses?
@QuestionC yes, I read the assertion that can't be solved polymorphically to exclude the visitor option operating on the list of Bases themselves
Apr
29
revised Is it okay to have objects that cast themselves, even if it pollutes the API of their subclasses?
attempt to clarify what's odd about example
Apr
29
comment Is it okay to have objects that cast themselves, even if it pollutes the API of their subclasses?
@codebreaker you really need to clarify your question then - in most systems there would be a valid reason for calling a bunch of functions agnostic of what they do; for example to process rules on an event or perform a step in a simulation. Usually such systems have a context in which the actions occur. If the 'getRandomIngredients' and 'getFrequency' are not related, then then shouldn't be in the same object, and you need yet a different approach, such as having the actions capture the source of ingredients or frequency.