Reputation
770
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
4 9
Newest
 Nice Answer
Impact
~19k people reached

  • 0 posts edited
  • 1 helpful flag
  • 272 votes cast
Jul
19
comment When speaking, how can I say that the time complexity order of an algorithm is O(N log N)?
“can't expect there to be a single word to describe every complexity class” – certainly not. But 𝓞 (n ⋅ log n) is such an important class that it does deserve a name of its own, IMO; and as said by Steve Jessop, linearithmic is pretty common already.
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
I second Steve Jackson. Don't use OO where it's not necessary. Just because Java enforces this style doesn't mean it's a good idea to make everything a class.
May
19
comment How do you avoid getters and setters?
FTR, I think more “experts” still teach to meaninglessly create getters/setters for everything, than to never create any at all. IMO, the latter is less misguiding advice.
Apr
15
comment performance versus reusability
Modularity and optimisation are not necessarily at odds. Modern compilers can inline pretty much anything anywhere, so no matter how modular you write, as long as the compiler can stitch it together to a “non-modular executable”, there's no reason it couldn't be as fast as code that was written non-modular in the first place. Of course, not all compilers can do this very well, but...
Apr
2
comment Does path coverage guarantee finding all bugs?
@MatthewRead: if you apply this consequently, then the “error space” is a proper subspace of the space of all states. Of course it's hypothetical because even the “correct” states make up a far too large space to allow any exhaustive tests.
Apr
2
answered Does path coverage guarantee finding all bugs?
Mar
25
awarded  Nice Answer
Mar
24
answered Is there a reason to have a bottom type in a programming language?
Mar
10
comment Why aren't `void *`'s implicitly cast in C++?
Well, templates aren't really needed for such a complete safe type system: Hindley-Milner based languages get along without them quite well, without implicit conversions at all and no need to write out types explictly either. (Of course, these languages rely on type erasure / garbage collection / higher-kinded polymorphism, things which C++ rather avoids.)
Jan
22
awarded  Yearling
Jan
22
revised class in OOP language and type
added 89 characters in body
Jan
22
comment class in OOP language and type
...more importantly, my anwer does consider behaviour. Indeed behaviour is usually the reason why you use inheritance, and the unification of different possible behaviours precisely captures the sum-type aspect of OO classes.
Jan
22
comment class in OOP language and type
@ruakh: no. You can of course implement functions in OO, but in general, methods are not functions (because they modify state etc.). Nor are "functions" in procedural languages functions, for that matter. Indeed, single-static-method interfaces come closest to function/exponential-types, but I hoped to avoid the discussion of that because it has no relevance for this question.
Jan
22
revised class in OOP language and type
Typos in footnote
Jan
22
answered class in OOP language and type
Dec
31
comment What is different between the internal design of Java and C++ that lets C++ have multiple inheritance?
@MasonWheeler: well, surely nobody is going to choose a dynamic over a static language just because it supports multiple inheritance. But it's certainly a valid point to remark here that problems like Diamond can be better solved in dynamic languages (how true that is I'm not actually sure), whereas general flamewar about dynamic vs. static is hardly on topic here (question already has enough Java vs. C++ flamewar).
Dec
23
awarded  Pundit
Dec
22
comment Is every language written in C?
1970: Niklaus Wirth creates Pascal, a procedural language. Critics immediately denounce Pascal because it uses x := x + y syntax instead of the more familiar C-like x = x + y. This criticism happens in spite of the fact that C has not yet been invented...
Dec
20
comment Are all magic numbers created the same?
The ideal way to eliminate magic numbers is to make the literal itself unnecessary. In this case: store such sizes not in integer variables but in a type-system enforced variable of some physical-dimension type Information. In an OO language that would be a class with methods to output readings in specific prefix, or as a string with automatically-chosen prefix ("human-readable"). But the conversion by multiplication / division should never appear anywhere openly. (Admittedly, what I'm describing is still a bit of a utopia.)
Dec
20
comment Are all magic numbers created the same?
@LightnessRacesinOrbit: I could bet that somebody used #define BYTES_PER_MBYTE 1024*1024 somewhere, and later wondered why they got MBval ≡ byteVal...