16,614 reputation
33267
bio website contactandcoil.com
location Ontario, Canada
age 38
visits member for 4 years, 2 months
seen yesterday

By day I'm a Professional Engineer, currently working as a .NET software developer. My CV.

I also wrote and maintain an open source extensible application framework called SoapBox Core, and an open source C# library for communicating with Insteon home automation devices called FluentDwelling.

You can follow me on twitter.


Dec
16
comment Is it better to use strings or int to reference enums outside the java part of the system?
@Neil - true but we're trying to play the odds here. I'm not familiar with Java enums, but in C#, I explicitly set the values for enums if the values need to have meaning outside the program (such as in a database) (e.g. Hearts = 1, Diamonds = 2, etc.). Since that's not the default way to use an enum, it should give a later editor pause. Plus a comment noting where else these are used is handy.
Dec
16
comment Is it better to use strings or int to reference enums outside the java part of the system?
Good points, but you're forgetting about the case where someone decides to change the name of one of the enum entities (HEARTS to Heart or something in your example) and suddenly everything breaks again.
Dec
16
awarded  Nice Answer
Nov
22
revised Unit of Work Concurrency, how is it handled
added 134 characters in body
Nov
22
answered Unit of Work Concurrency, how is it handled
Nov
6
awarded  Custodian
Nov
6
answered Why do we use non-descriptive internal codenames?
Oct
16
awarded  Yearling
Sep
30
awarded  Explainer
Sep
29
comment recalculation model for GUIs
@AgostinoX - As I said, you can choose to do the calculation in the JavaScript on the client side, as long as it's just a convenience calculation. When the user commits it, then you have to do that calculation again on the server side to be sure you trust it. I think getter with lazy evaluation is your best bet (and would be the Functional Programming way to do it). Anything else seems like it's overly complex.
Sep
29
comment recalculation model for GUIs
@AgostinoX - assuming a trivial amount of recalculation, you would typically recalculate everything every time a change was made. In fact you could implement the calculation in the property getters, such as GetC() { return GetA() + GetB(); }. If you want to get fancy, then your setters could set a dirty bit, and your getters could call a recalculate() method that checks if it's dirty, recalculates all values, and then sets dirty to false (i.e. lazy evaluation). Going fully lazy on every property is only worth the overhead if you have significant calculation cost.
Sep
29
revised recalculation model for GUIs
added 1065 characters in body
Sep
29
answered recalculation model for GUIs
Sep
29
answered Decision making and maintenance
Sep
26
comment which pattern is most intuitive for a calculator app?
@MrClan - the typical UI architecture is one of MVC or MVP. What I've described in ICalculator is the Model. The View would be the Form you build using Winforms. You typically have a separate class called the Controller or Presenter. In the event handlers, you call methods on the Controller. It makes calls to the Model to get answers, and updates the View. How much goes in the Model vs. Controller would be up for some debate.
Sep
26
answered which pattern is most intuitive for a calculator app?
Sep
26
comment Is the “Objects First” approach a good idea?
@KonradMorawski - agreed, the typical examples fail to teach real OOP. A better example to teach OOP would be a Calculator or CalculatorService, i.e. something that provides a service to the rest of a program through a generalized interface.
Sep
25
comment What should I understand before I try to understand functional programming?
If your language doesn't support a lambda or delegate feature, then how do you write the Map function? Functional programming is more than just immutability.
Sep
17
comment Test Driven Development for Complex Games
...then you can write a separate test that uses statistical methods to check the actual workings of your real implementation of RandomNumberGenerator.
Sep
17
comment Test Driven Development for Complex Games
Normally if part of your code uses random numbers, you abstract out your random number generator into a service (IRandomNumberGenerator) and anything that needs to use random numbers accepts a reference to that service interface in their constructor. Then when your test creates that object to run a unit test, it injects a MockRandomNumberGenerator that feeds a fixed known stream of numbers out. Then you have a repeatable test. The same idea is useful for anything that needs to get the current date/time or downloads information from a web service - just inject a mock service.