Click here to Skip to main content
12,545,876 members (60,874 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

Don't Name Things NAME....

, 4 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Why you shouldn't use reserved words

A Quick Lesson On How To Waste 10 Minutes ...

If you have a new puppy, and it pees in the corner of the room, the recommended thing to do is get a fresh newspaper, roll it up tightly, raise it high in air, annnnnd.... bring it down sharply on *your own head*, repeating the mantra "I should've watched puppy more carefully...." ten times... then clean up the pee....

I was putting together a Windows form in C#/VS and after dropping on a ListView, proceeded to add some columns and give them titles. One of the columns was for "Customer name", but space was tight so I decided to make the title "Name" ... and that's where the trouble started. You see I didn't give the title property the value "Name", **by mistake** I gave the *NAME* property the value "Name" ... and continued to build out the interface. A while later, when I started to add code and build, but of course it failed. Naturally, the error message I got was not especially helpful so much head scratching and digging ensued.

When I clicked the error, I don't see the entire picture...

That only jumps out at me when I started back tracking what I changed to see what happened...


Lesson (re-learned): Don't use reserved words when naming objects or controls, it's bad, and it will bite you. Whenever something goes wrong, look for the simplest solution first, then dig deeper. Remember, compilers are very good at doing what we tell them, so when you get build errors, the first thing to look at is what you have written, chances are you've done a sprinkle in a corner somewhere.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United Kingdom United Kingdom
Architect/engineer, student, always learning and refactoring my wetware. Happiest tucking into a big bowl of c# or python sprinkled with a crisp topping of Javascript...started with a single ZX80 a lifetime ago, now happily explore, build and create on interweb scale...

  • 7 Jun 2016 - "Upload large files to MVC / Web API using partitioning" - article of the day on
  • 16 Sep 2015 - "Single Page Application with MVC and SammyJS" - article of the day on
  • 01 Sep 2015 - "KnockoutJS nested arrays in MVC" - article of the day on
  • 21 Aug 2015 - "Audit trail and data versioning with C# and MVC" - article of the day on
  • 6 Oct 2014 - "Full Calendar – A Complete Web Diary System for jQuery and C# MVC" - article of the day on

You may also be interested in...


Comments and Discussions

QuestionGood Tip! Pin
Johnny J.4-Aug-13 22:10
professionalJohnny J.4-Aug-13 22:10 
AnswerRe: Good Tip! Pin
Maimonides4-Aug-13 22:11
professionalMaimonides4-Aug-13 22:11 
AnswerRe: Good Tip! Pin
Allen ONeill4-Aug-13 22:22
memberAllen ONeill4-Aug-13 22:22 
QuestionIts simple Pin
Member 101877103-Aug-13 17:31
memberMember 101877103-Aug-13 17:31 
AnswerRe: Its simple Pin
Maimonides4-Aug-13 22:10
professionalMaimonides4-Aug-13 22:10 
GeneralThoughts Pin
PIEBALDconsult3-Aug-13 5:51
professionalPIEBALDconsult3-Aug-13 5:51 
GeneralRe: Thoughts Pin
Allen ONeill3-Aug-13 6:06
memberAllen ONeill3-Aug-13 6:06 
GeneralRe: Thoughts Pin
HaBiX4-Aug-13 6:43
memberHaBiX4-Aug-13 6:43 
GeneralRe: Thoughts Pin
Allen ONeill5-Aug-13 1:30
memberAllen ONeill5-Aug-13 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161018.1 | Last Updated 5 Aug 2013
Article Copyright 2013 by AJSON
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid