Maciej Stachowski

CS student and .NET programmer extraordinaire, currently starting out in the corporate world.

Feb 2015

Abuse of Properties

by in CodeSOD on

Every .NET programmer is familiar with the concept of properties. They’re a nice language feature, allowing the programmer to inject little bits of logic into the process of retrieving or setting the value of a field. A getter can, for example, lazily initialize a field when it’s first used, and a setter can validate the value before it’s set. Even a simple property with no logic beyond providing access to a backing field can be made useful by appearing in an interface or being overridden by a derived class.

An important aspect of properties is that to the outside user, they appear almost no different from a regular field. As such, they’re supposed to behave like regular fields. Any visible side effects beyond what’s necessary are heavily frowned upon, and the developer who uses the property can reasonably expect it to provide transparent access to data from his point of view.


Wrongness

by in Feature Articles on

Wrong Way Sign"You BASTARDS! You stupid little brats! Don't you even dare to try that again, ya hear me?! YA HEAR ME, PUNKS?!"

It was a quiet day at the IT department. For the last few weeks, the team has hit a dry spell – there were hardly any calls, and they spent most of the days desperately trying not to die of boredom. Ron managed to dig up an old copy of Counter-Strike and was currently getting his ass handed to him.