Good OO-Programming Practices

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
700 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 19, 2010

Good C oriented programming practices.

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (LeftTechticle)

  • For C#, there is not much said about naming of controls, but if you use Visual Studio and put a control on a form, the control will not use mnemonic notation; it will be textBox1, or radiobutton1, etc. As a result, I name my controls as, startButton, firstNameTextbox, etc. and use camel case as Microsoft does. (Use Pascal case for all other methods.) It reads like English. However, txtFirstName is cryptic.

    Also look at the metadata in the .net framework as your guide.

  • @Entropy56 What your are telling me is that its all about microsoft conventions, which is not how I look at it, and hungarian can seem a bit cryptic, but I like it.

  • Some of your naming practices do not apply to C#.

    Specifically, Hungarian prefixing, underscores, screaming caps. You will see a lot of bad code examples on the Internet and even at MSDN.

    The book "Clean Code" by, Robert C. Martin, was written from a Java perspective and he calls it "noise", which also applies to C#. If you have to prefix a field or control, then your class or method is too long.

  • @Entropy56 Thanx for that insight, which to my surprise has much solid logic

see all

All Comments (9)

Sign In or Sign Up now to post a comment!
  • @heidihas300 I'd be interested how one can be consistent with Hungarian notation. How do you prefix properties in .net? How about delegates? Classes? Class objects? Events? Methods? Strings? Pointer to an unsafe method? What about static member variables (i.e. fields)?

    int hwndOwner? string lpszPath?

    If you do a Google search on Hungarian Notation for C#, you will see that the majority do not recommend prefixed code.

  • @Entropy56

    Hungarian is a lot easier to read and reference when working with bigger projects. So when you are coding the intellisense puts the txt thing in a group and the btn thing so you know it is a button. And you did not know you can always check the designer to see what it is.

  • @LeftTechticle

    I agree with this:

    “The problem with Hungarian notation is that it's trying to implement a type system via naming conventions. This is extremely problematic because it's a type system with only human verification. Every human on the project has to agree to the same set of standards, do rigorous code reviews and ensure that all new types are assigned the appropriate and correct prefix. In short, it's impossible to guarantee consistency with a large enough code base.”

  • @henryhenriquez Did you get this comment?

  • @LeftTechticle Hungarian prefix notation, screaming caps came from a bygone era where the compilers were not intelligent enough to know when you are assigning a string to an integer variable, or a long to a short. However, .NET managed code compilers are far better. Also, as I said before, if you need to prefix code, then the class or function is too long. Spell the word out. Here is some C style nonsense… What is: int *rgwDic; or bltbyte(sz, psy->sz, cch+1); ???

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more