Reputation
5,434
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
1 10 25
Newest
 Revival
Impact
~253k people reached

  • 0 posts edited
  • 10 helpful flags
  • 183 votes cast
1d
answered AngularJS and ASP MVC
Sep
1
comment Strategy to avoid running out of memory in memory intensive application
@John Although if I understand your question around available memory correctly, you might be interested in checking the FreePhysicalMemory on the Win32_OperatingSystem WMI object (Example 1 and 2). Although it might be easier just to provide a configuration setting for your program to set the limit at which it stops growing, rather than managing it dynamically in code. That said, I'd still seriously consider the other suggestions, I think they provide simpler alternatives.
Jul
17
comment Good practice to hold Constants in their own file?
@Snowman I agree (with both your answer and your comment); I just feel that the "types of cohesion" list has some value to add to the discussion, in that it actively lists and ranks different reasons for keeping things together. Representing it as a gradient helps with the justification, or at least it has helped me.
Jul
17
comment Good practice to hold Constants in their own file?
To add a bit and perhaps answer @insidesin 's question, I would argue topics like this from the angle of cohesion. The driving questions are: what is the underlying motivation for we grouping things together? Does it simplify things or complicate them? Could we have come up with a better grouping? In my opinion, grouping things together only because they share in a relatively unimportant implementation detail falls under coincidental cohesion, and there are likely much better groupings to use.
Apr
13
comment Is it okay to have code smells if it admits an easier solution to another problem?
Just to reaffirm this answer, I was going to write something with the very same two recommendations. Regarding the last paragraph, what OP describes seems to be a code smell in itself indicating that another level of indirection is needed. Whether that's a better factory class, facades, or even a full blown DSL that the AI can generate for is left up to the OP.
Jan
23
comment Is there any material difference between queries joined by WHERE clauses, and queries using an actual JOIN?
What'd really be insanely confusing is explaining to a beginner why commenting out one line in the WHERE clause is causing a million times more records to come back, and why the query won't finish running. This must be one of the worst introductions to SQL I've heard of.
Dec
4
comment Best OOP Practice in C#: Passing the object as parameter VS creating a new instance of the object
I'm not sure I agree with the premise: ... is essentially a Copy Constructor. Objects are passed by reference* in C# (which this seems to be, although I guess it could be something else). This code could be as simple example of DI, where does the copy constructor come in, am I missing something? * To be clear, the reference itself is passed by value, but the object referred to is not copied.
Oct
31
comment What is the actual reason that locks (sentinels) in OO are hard to reason about?
+1 especially for your 3rd point, which I believe is particularly true. There also tends to be a push to keep locks as fine-grained as possible (speaking generally) for performance reasons - very granular locks would prohibit concurrency.
Oct
27
comment Algorithm for a UI showing X percentage sliders whose linked values always total 100%
I understand... my issue is just that expressing something like a 60 / 30 / 10 split will require more than 3 actions, because when fiddling with the 30 / 10 part, the 60 keeps moving around. It gets progressively worse with larger lists, and is only really suitable for extremely vague input, since you will never get it to the number you have in your head.
Oct
27
comment Algorithm for a UI showing X percentage sliders whose linked values always total 100%
One suggestion would be to allow the user to switch between two modes, essentially one where the sliders are linked to each other, and one where they are not (and switching back to "relative mode" would re-normalise the distribution). This would allow side-stepping some of the issues you mention, but add so much complexity to the UI that it might just be easier to get the user to type the values in.
Oct
27
comment Algorithm for a UI showing X percentage sliders whose linked values always total 100%
Similar questions have been asked over on the UX site, although IMHO they have not been answered in a particularly satisfying way. I'm curious to see if there are any good solutions. Although to be honest, I find that having the sliders linked to each other causes more trouble than it's worth even for the user - it becomes difficult to end up with the distribution you'd like, since you keep altering your already entered values as you go.
Oct
17
awarded  Revival
Oct
15
revised Using ng-init to initialize data in Angular controller
Mostly formatting, summary
Oct
15
answered Using ng-init to initialize data in Angular controller
Sep
24
awarded  Autobiographer
Sep
13
awarded  Yearling
Aug
15
answered How to get a database on my filesystem that I can use in my application
Jun
20
comment What is the ideal length of a method?
@Calmarius agreed, but both of those statements are an argument against 6000 LOC functions.
Jun
20
comment What is the ideal length of a method?
@Calmarius the difference is usually that 6000 line functions tend to contain local variables which were declared very far away (visually), making it difficult for the programmer to build up the mental context required to have high confidence about the code. Can you be sure about how a variable is initialised and built up at any given point? Are you sure nothing is going to mess with your variable after you've set it on line 3879? On the other hand, with 15 line methods, you can be sure.
May
27
comment Is backing up a MySQL database in Git a good idea?
@AlbertoSolano I see; but reading the question ("can I backup my DB in in GIT?") and then your first statement ("it's fine to store the backup file..."), it seems like you're saying the opposite. The rest of the answer seems to be saying that it's neither here nor there, while I suspect most people think it's a train-wreck waiting to happen.