Skip to main content
added 7 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation checks into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident this thing is usable once it exists.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident this thing is usable once it exists.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation checks into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident this thing is usable once it exists.

added 1 character in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident an objectthis thing is usable once it exists.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident an object is usable once it exists.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident this thing is usable once it exists.

added 184 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validationvalidation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident an object is usable once it exists.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

What you're being tempted by has a name:

Primitive Obsession

Yes it is very nice that unboxed int's can't be null. Testing for null is a pain. But so is testing for -1. For that matter, so is testing for the carry flag. Sorry but primitives aren't perfect representations either. They also require validation*. And since we're going to be doing validation anyway we might as well treat ourselves to the best model of our domain that we can.

That said, I dream of the day I can code in a language that will let me move such validation into the type system where they can become compiler errors. Until then I work with what we have.

* or strict parsing, or hell any method that lets me be confident an object is usable once it exists.

added 5 characters in body
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading
Source Link
candied_orange
  • 119.7k
  • 27
  • 233
  • 369
Loading