Reputation
4,384
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
1 10 27
Newest
 Nice Answer
Impact
~280k people reached

Jan
25
comment I don't understand why algorithms are so special
While applying existing algorithms is well and good, practicing the art of understanding and developing new and novel algorithms is not only challenging but requires a high degree of creative (ie divergent) thinking ability. As opposed to memorizing (ie convergent) existing implementations. Not everybody is satisfied with mindless assembly. Algorithms are the soul of programming.
Jan
25
comment I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?
+1 The number spinner is an especially useful example. For the Op's specific case, UI feedback would be the best approach for an invalid or unmatched input. An exception would be used of, for instance, the wrong type (ex an integer instead of a string) is encountered.
Jan
25
comment Implementing the command pattern in a RESTful API
In this case the URI should represent a transaction where debiting (taking money) and crediting (giving money) are actions done via POST requests. POST is used for both because each time money is moved in either direction it represents a new transaction being created. In your specific case, the transactions are taking place on a cardholder's account so the card's account number is the resource URI.
Jan
25
comment Implementing the command pattern in a RESTful API
(cont) Database logs use transactions in a similar manner. That's why it's possible to replicate and/or rebuild a dataset using only the logs. As long as the transactions are replayed in the chronologically, it should be possible to rebuild the dataset from any point in its history. Removing mutability from the equation ensures consistency.
Jan
25
comment Implementing the command pattern in a RESTful API
@Mithir I was describing the accounting rule. In a standard double-entry bookkeeping system you never remove transactions. History once committed is considered immutable to keep people honest. In your case you could still use a DELETE action but on the back-end (ex general ledger database table) you'd add another transaction representing crediting (ie giving back) the money back to the user. I'm no bean counter (ie accountant) but it's one of the standard practices taught in a "Principles of Accounting I" course.
Jan
25
comment Implementing the command pattern in a RESTful API
I would have elaborated in an answer but Gary's answer already covers most/all of what I'd add. I say it's not rest because URIs are only supposed to represent resources (ie not actions). Actions are handled through GET/POST/PUT/DELETE/HEAD. Think of REST as an OOP interface. The goal being to make the API fit the general pattern and decouple it from implementation specific details as possible.
Jan
23
comment Implementing the command pattern in a RESTful API
+1 "technically this should not be allowed in a balanced accounting system". Somebody knows how to count beans. That statement is absolutely correct, the way to reverse would be to create another transaction crediting the funds back. General ledger entries should always be considered immutable and permanent once a transaction is completed.
Jan
23
comment Implementing the command pattern in a RESTful API
Short answer, that's not REST.
Jan
11
comment I've had 7 jobs in 16 years. Is that OK?
Oooh, simulators. Flight or combat? I used to do electrical design/wiring on commercial flight sims. The work was extremely challenging and a ton of fun.
Jan
11
answered What is best pratice for user stories containing two roles
Jan
11
comment Effectiveness of FizzBuzz and Beyond
An even better question is, is this problem deterministic or non-deterministic? In all seriousness, this question should be doable for anybody who has ever used a substr() method.
Jan
11
comment Recursion or while loops
I have also noticed a pattern in a sync programming where loops are avoided in favor of recursive calls on an iterator that contains a .next() method. I assume it keeps long running code from becoming too CPU greedy.
Jan
11
comment Establishing an API to provide end-user apps/scripts access to multiple types of databases
@hulkmeister Sorry about the delayed response, I answered your question and added a bunch more useful info. I would post examples of controllers but implementations can be wildly different across the wide variety of languages/platforms/frameworks used on the server-side. So far the GoogleAppEngine (python) webapp2 has the cleanest implementation I have seen yet unfortunately it's hard to find good examples online.
Jan
11
revised Establishing an API to provide end-user apps/scripts access to multiple types of databases
added 3219 characters in body
Jan
9
answered Establishing an API to provide end-user apps/scripts access to multiple types of databases
Jan
9
answered Shipping my first class library. Any gotchas I need to be aware of?
Jan
9
comment Is the carriage-return char considered obsolete
@RossPatterson Whatever you say Shakespeare. But there's an easy way to ignore CR chars and still support Windows. I've updated the question to outline how it's handled.
Jan
9
revised Is the carriage-return char considered obsolete
added 587 characters in body
Jan
8
comment Is the carriage-return char considered obsolete
Finally, a good counter-point. If I could select two answers I'd pick this one too.
Jan
8
comment Should your best programmers have to check everyone else's code into source control?
+1 Best answer. Especially pointing out that one dev committing a build-breaking bug negatively impacts everybody.