Posted by
pharo on
Mar 15, 2011; 12:17pm
URL: https://forum.world.st/Issue-3817-in-pharo-make-Object-error-deprecated-tp3353733p3356406.html
Comment #14 on issue 3817 by
[hidden email]: make Object >> error:
deprecated
http://code.google.com/p/pharo/issues/detail?id=3817I totally agree with Camillo. Error: does not convey any meaning. Even
though your code currently does not handle the error specifically, you
might later on want to catch it from the outside. Just getting back strings
makes this impossible.
It is just object-oriented programming to use specific objects wherever you
have a specific scenario! What do you gain by using strings? Maybe it's a
tiny bit shorter syntax-wise? It definitely doesn't gain you anything else.
It definitely makes your code less reusable.
It's the same as using `nil` everywhere as marker-object, and as Camillo
said, using arrays and dictionaries rather than objects of specific types.
It totally clutters the code and does not convey any meaning.
A very common "pattern" you end up using when throwing strings is
concatenating strings and serialized versions of objects to give more
information. If you throw a specific exception with the relevant objects
inside, you can actually start using standard Pharo tools such as object
inspectors to figure out what went wrong. The concatenated string doesn't
contain the actual relevant objects anymore and this makes it very hard to
understand what's going on. Using strings is just laziness, bad programming
and bad design all rolled up into one fuzzy ball.