code

There are 3 entries for the tag code

Dealing with singular plural phrasing

This is an age old problem and one that’s probably been solved countless times before, but I’m going to write about it anyways. Say you’re writing code like this: <p>You have the following themes:</p> <ul> @foreach(var theme in Model) { <li>@theme.Id</li> } </ul> The natural inclination for the lazy developer is to leave enough alone and stop there. It’s good enough, right? Right? Sure, when the value of Model.Count is zero or larger than one. But when it is exactly one, the phrase is incorrect English as it should be singular “You have...

Write Readable Code By Making Its Intentions Clear

I don’t think it’s too much of a stretch to say that the hardest part of coding is not writing code, but reading it. As Eric Lippert points out, Reading code is hard. First off, I agree with you that there are very few people who can read code who cannot write code themselves. It’s not like written or spoken natural languages, where understanding what someone else says does not require understanding why they said it that way. Hmmm, now why did Eric say that in that particular way? This in part is why reinventing the wheel is so common (apart...

Writing Maintainable Code

Jeremy Miller believes that among the various beneficial and important qualities a codebase can have, the single most important quality of code is maintainability. I totally agree, having spent many hours maintaining legacy code written years ago as well as code I wrote a week ago. As soon as a line of code is typed on the screen, it becomes legacy. You are now maintaining that code. Enterprise software systems change.  Business rules change, technology platforms change, third party dependencies are upgraded.  ... Enterprise systems typically aren’t replaced because they stop working.  The end of life cycle for an...