i work with a guy who constantly complains and posts on stackoverflow that i am a sloppy coder (he is a web developer, i am a .net developer, he has never actually looked at my programming).

but curiously, i researched. The only thing that I do not follow with best practices is certain .net naming conventions. I have developed a habit of using _s (function_name) and intInteger, strString, blnBoolean.

he says i am wrong and it is sloppy and not efficient. I should do it stringName, functionName, intergerName, booleanName.

is it really that big of a deal? is something magically going to happen if i break my old naming convention habbits? I use option strict on, option explicit on, comment what my code does in sequence, provide strong error handling which emails me the database query (if there is one) what went wrong who it went wrong for, what application and what function they where using when it went wrong. I use alot of structure and keep things need and clean, i use configuration files and i keep my database structered in clean, hell i even use database.table.column whenever i want to select/update something so i know what i am looking at

does my naming convention make me a sloppy coder

feedback is appreciated like always.

Recommended Answers

All 8 Replies

Let's take the "other" programmer's example and see what results we get.

Dim stringSomething As String = "some string"
stringSomething = "some other string"
MsgBox(stringSomething)

Total characters: 109

Now let's take "your" example.

Dim strSomething As String = "some string"
strSomething = "some other string"
MsgBox(strSomething)

Total characters: 100

... Now, 9 characters difference is not a big deal, but when constantly reused, "it is a big deal".
Here are a few reasons why.

1. The less code for an application to locate and process, the quicker the application. Correct?
2. The less time you waste typing extra "unnecessary" characters, the quicker you get results done. Correct?
3. The less time your application takes to respond to some code, the less "electricity" used. Correct?
4. The less electricity used, the more we have to offer to the future of our world, resources wise. Correct?
... This not only pertains to "electricity", but everything else, including hard-drive space, less usage of processor(s), among all that relates to a computer.
... If needed be said, the resources we use while typing "unnecessary" characters should also be taken in consideration. Food, water, etc.
5. The less time "the rest of the world" wastes to download/install your "extra characters", ... You do the math.

Overall, I can probably write an entire book on this thread topic alone.:D
But personally, I think that I have provided all the information needed within these few lines to hopefully make a difference. If not for you, then hopefully for the future "little you(s)" that you might bring/have brought into this world.

By the way, I think I have both of you beat. :)

Dim s1 As String = "some string"
s1 = "some other string"
MsgBox(s1)

Total characters: 70
And of course, having a Map Key somewhere in my application's code window, preferably at the top.

Public Class Form1
    '//-- s1 = Something

what codeorder said is absolutely right. in future u are saving alot of things related to your programs and hardware usage , efficiency , understanding the codes etc

opened my eyes to new things

i dont really agree with all the above(although i do agree with some of these)
the only real reason for me to change you naming habits it is to make your code more readable and more understandable by others( for instance your co-workers).
you should use your company's standards- that is why they are there anyway.

to give you a for instance:
we name the buttons with the appreviation btn infront- when ever someone forgot to put btn infront of the name it took me a long time to realise that the control i couldn't locate was just named wrongly(i admit that on rare occation i do forget one or two of those standard cause they are so many)


Also, you collegue shouldn't critisize your work - even if he saw the code and he was right- trashing your co-workers online or not is consider BAD MANNERS!!!

you should ask from your manager some material to see what is used in your company and i bet you will find that he is more of a sloppy coder than you

i understand your thoughts as well - there isnt really standards in my company. it consists of 3 programmers. i code in .net, applications that the associates use. another uses vb6 applications that associates use (in retail store, has own custom software). and the critic is a web developer that does php, flash, etc.

no one actually sees, uses, or anything dealing with my code. i do stick to basic naming conventions however (strString, blnBoolean, btnButton, frmForm) and so on. sometimes if something has to be done quick i mess up and leave it button1 or button2 but it still says button. I was just trying to figure out if there was truth behind me being a sloppy programmer due in part to me using so called bad naming conventions...

thanks for the feedback

Glad that there is finally some other input to this thread. :)

About me naming something like "s1", instead of "strSomething", it is only done for personal projects after all the code has been approved for publishing, by me of course.

I am currently working on quite a few projects with other programmers and we do try and keep a set standard of code rules, as "str" for "String", "i" for "Integer", etc.
I have now moved to using just "s" instead of "str". Seems more reasonable for my coding and locating Strings with IntelliSense, especially since "Str" is already part of vb.net.

Also, for all my Menu options, I have a standard way of Naming them.
Example for File/Save:
mSave_File
Example for Edit/Copy:
mCopy_Edit

"m" is for Menu, Save or Copy for the option, and _File or _Edit for the category that option can be located in.

This Menu style of naming controls also is of use for TabControls that contain similarly named controls.
Example for a TextBox:
txtSomeTextBox_tab1
and,
txtSomeTextBox_tab2.

....
The main reason for me getting so fired up about my first post was mostly for having another programmer criticize another, especially for something like a Variable name. Although I must agree, some good came from it. :D

Btw, that "other" programmer, does not name all of his controls the same way, does he?
Like: TextBoxSomeTextBox, CheckedListBoxSomeCheckedListBox?
or just simply: txtSomeTextBox, clbSomeCheckedListBox?

for local trouble shooting and finding variables , naming variables i also do same as Codeorder does, but when it is in publishing stage then name them proper. Its easy for self not for other programer or coder as well. every programer has its own standard for naming variables but mostly use international standard programer use.

i understand completely and do use naming conventions. no one really sees my code, but incase they do i always stick to the basic strString intInteger blnBoolean lngLong and so on.. its the way i learned along time ago

what i meant was is it a big deal that i do not name then stringString integerInteger booleanBoolean and so on because my code gets called 'sloppy' and un-understandable by a web developer (go figure). i think it is more not understanding vb syntax. if i used c# im sure it would be more readable to a javascript, php developer.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.