Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
6
Impact
~2k people reached

  • 0 posts edited
  • 1 helpful flag
  • 18 votes cast
1d
comment What are the problems with boolean variables?
Booleans, almost universally, represent derived state from some question (ie, array.isEmpty(), object.equals(...), etc). Couple that with advice in Clean Code like, "don't use Boolean flag parameters", and I've come to the general conclusion that programmers probably shouldn't be passing or storing them, only returning them; in most cases, you probably want some sort of Enum or limited-instantiation type.
1d
comment What are the problems with boolean variables?
The underlying representation is unimportant, since you can run into similar problems with any type (character-based data having major problems).
Apr
5
comment How is one or more aggregate function implemented in most SQL engines?
Many aggregate functions are trivially parallelizable - MAX, MIN,SUM`, etc - which is a boon to database response times. Also, several databases allow you to define custom aggregate functions; you may want to look at the documentation for them.
Apr
5
comment Tracking a program-wide state of tasks being done and making it testable
Depending on how you're running this, storing the information in a class may not be sufficient; some containers and frameworks might spin up multiple runtimes or instances. The resulting problem should be obvious...
Apr
5
comment Which layer should convert timezones given querying on aggregate tables?
You're translating the returned data to a graph on the frontend, which presumably includes the rendering; are you sure the timestamp translation is going to be the big performance cost? At minimum, you're going to want to keep this out of the database - many handle timezones poorly, if at all.
Feb
14
comment Consistency of Undefined behavior
@5gon12eder - if you could reproduce the exact same circumstances of the die roll (ie, hand position, starting position of the die, the direction of the toss, etc), you should get the same result. It's just that generally there are too many factors for people to control. I do know people that can fairly reliably flip and catch a coin so it ends up on whichever face they want.
Jan
26
comment Should we avoid language features that C++ has but Java doesn't to increase maintainability?
You'd be surprised by how fast the differences will bite you (and hard). SomeObject a = previousObject;does very different things in Java and C++. In Java it copies a reference, while in C++ it copies the object. In Java, modifications to a would also affect the previous object. In C++, you have two separate objects.
Jan
13
comment Designing Pricing table in MYSQL
I'd probably end up with a view like this, too. DB permitting, I'd probably structure the underlying table to only have start dates, and let the view create the end dates automatically. Note, that your end date should be exclusive - that is, the end date of one row and the start of the next one should be the same value: conceptually, a price is in effect until the same instant the new one starts. It also makes certain types of queries far easier (like not having to worry about precision mismatch between timestamp and dates).
Jan
13
comment Designing Pricing table in MYSQL
...At least with dates you can use a simple index probe for the price. With something like this, you need a greatest-n-per-group query... and that assumes that the price in effect is always the "most recent". If they were uploaded early you're in trouble.
Jan
8
comment Why was conversion between Instant and Date named the way it was?
"Is this made so because of an expected deprecation of Date" - I suspect this is, maybe, eventually on the table. In which case you wouldn't want to touch the new API when getting rid of the old one, no.
Dec
15
comment Time elapsed between two 8-bit timestamps
...I'd probably start by getting a 16bit timestamp representing milliseconds.
Dec
3
comment Referencing database values in business logic
In the database, the numerical id is being stored for child records, specifically to avoid that problem. This question is about how to interface to a programming language.
Nov
11
comment Manage lock of a software feature
You're talking about DRM. Every major program with DRM has been cracked to get around it (in some cases, "just because"), and this is with millions of dollars spent by other companies. Barring a feature requiring a resource physically under your control, it'll be circumvented. Among other things, what happens if somebody installs your program and then takes their machine off the network?
Sep
27
comment How to sell an application? Licensing problems
Microsoft and other app store operators can only help you with sales tax (and there appear to be additional wrinkles depending on where you live/are incorporated). This is distinct from income tax, which you may also owe, and they can't help you with.
Jun
21
comment How widespread is the use of arabic numerals in Japanese and Chinese?
The interesting ones at the smaller restaurants (I'm in Japan at the moment) are the prices that look like this: 五00 - (the first character is 5). There isn't really a "0" kanji in this context.
Jun
21
comment Why should I use lookup tables at all?
A few things: 1) For the fastest lookup, you want a compact array, but under real-world use your lookups will use non-sequential ids (especially when dealing with internationalized data). 2) There are situations where this stuff is cached application-side, but there are tools/libraries for it (at least in Java). 3) You want this stuff stored in the db (in one or more flavors), because it enables all sorts of query chewy goodness anyways.
Jun
16
comment Injecting locking policy into a class
...at the point where you'd know what your read/write situation is, you could use specialized collections instead of this locking policy. In the second instance it sounds like you want ConcurrentQueue, or maybe to implement the reader/writer interface in System.Collections.Concurrent
Jun
15
comment Injecting locking policy into a class
Note: Dispose isn't guaranteed to be called by the framework, so things could be locked longer than you think. Naming your release-lock method that is going to confuse people no end (that, and while you can safely call Monitor.Enter(...) multiple times, you need the same number of Exit(...) calls). My question was less about the exact implementation of the policy classes, and why you think you need them, or what the code calling them is actually doing.
Jun
14
comment Injecting locking policy into a class
Define "different situations". What particular problem are you trying to solve? Normally wouldn't a locking token have to be shared to be used between threads (ie, can't dispose it afterwards)? It feels like attempting to do this will make you think you're running stuff safely, but at some point you're going to put NoLockingPolicy instead of SimpleLockPolicy, and then...
Jun
8
comment Why pointer symbol and multiplication sign are same in C/C++?
Many older languages (such as BASIC) used the $ in variable declarations. Too, it's usually only available on US keyboards, although I don't know if this consideration would have been important to the original designers.