Tag Info

New answers tagged


Data/Object Anti-Symmetry As others pointed out, Tell-Dont-Ask is specifically for cases where you change the object state after you asked (see e.g. the Pragprog text posted elsewhere on this page). This is not always the case, e.g. the 'user' object is not changed after it was asked for its user.address. It's therefore debateable if this is an appropriate ...


A bit of a late submission, but Atom (by GitHub) has support for Ruby, as well as many other languages, including Puppet.


As a user rather (than designer) of Python there are three reasons I'm happy with this decisions: Chiefly, it reads better. Of course I have to consciously decide to introduce a new variable when writing, but code is read far more often than it is written. A lot of code is simple in the sense that control flow and nesting has no influence on the meaning and ...


AFAIK, GCC use hand-written parsers in particular to improve syntactic error diagnostics (i.e. giving human meaningful messages on syntax errors). Parsing theory (and the parsing generators descending from it) is mostly about recognizing and parsing a correct input phrase. But we expect from compilers that they give a meaningful error message (and that they ...


Parser generators and parser engines are quite general. The advantage of the generality is that building an accurate parser quickly and getting it functional is easy, in the overall scheme of things. The parser engine itself suffers on the performance front because of its generality. Any hand-written code will always be significantly faster than the ...


You could always create a custom exception if you dont find the exceptions you have at your disposal fit correctly. class MyUsefulException < Exception end raise MyUsefulException, 'Huzzah, my exception lives!!!'


Does it matter which type of exception to throw as long as the error message is useful? In cases like this, I often defer to the official docs for definitions and usage examples. The docs for RangeError are a bit terse: RangeError Raised when a given numerical value is out of range. [1, 2, 3].drop(1 << 100) raises the exception: ...

Top 50 recent answers are included