Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What are your code pet-peeves?

What are your code pet-peeves?

Scheduled Pinned Locked Moved The Lounge
csharpdatabasequestion
47 Posts 22 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Ennis Ray Lynch Jr

    You would call it wrong. One of the skills that will take a developer far is the ability to see past little things like this. Keep in mind C# is not the only language and Java in particular is notorious for the other style. It is probably my fault as I am growing cynical in my old age. I am just tired of seeing people call themselves Senior Developers who barely even know one language and one trait that is systematic of these people is going ballistic over something that has no rational basis in the quality of code. Don't mature into that guy!

    Need a C# Consultant? I'm available.
    Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

    H Offline
    H Offline
    Harvey Saayman
    wrote on last edited by
    #38

    i get that :) yes one day ill have to work on someone else's code one day but the project im working on now was designed and started by me so the dev's working on it will do it my way :-D

    Ennis Ray Lynch, Jr. wrote:

    tired of seeing people call themselves Senior Developers

    i didnt, not that i know of anyway... and i clam to be a junior dev right in my sig :)

    Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

    you.suck = (you.passion != Programming)

    E 1 Reply Last reply
    0
    • L leppie

      For the property, I would accept the get and set on each own line, if the property setter/getter was only 1 line long. Eg:

      public bool Selected
      {
      get {return selected;}
      set {selected = value;}
      }

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      R Offline
      R Offline
      RBARBA
      wrote on last edited by
      #39

      Yeah, or if you dont really need the private fields why not just:

      public bool Selected { get; set; }

      This is by far more readable, and works from C# 3.0 and forward

      1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        Not doing so makes reflection a PITA. If MS would have made no distinction between a field and a property maybe I would agree. Of course, I don't like properties, instead I prefer set and get methods. Interesting that the CLR doesn't support properties. (I am going to stop there so others can stick their foot in their mouth when arguing against me)

        Need a C# Consultant? I'm available.
        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #40

        Ennis Ray Lynch, Jr. wrote:

        Not doing so makes reflection a PITA.

        Yup, but reflection is normally an indication that something's broken in your design.

        Ennis Ray Lynch, Jr. wrote:

        Interesting that the CLR doesn't support properties.

        Of course it does - and they happen to be methods called get_ and set_ .... ;)

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        E 1 Reply Last reply
        0
        • H Harvey Saayman

          i get that :) yes one day ill have to work on someone else's code one day but the project im working on now was designed and started by me so the dev's working on it will do it my way :-D

          Ennis Ray Lynch, Jr. wrote:

          tired of seeing people call themselves Senior Developers

          i didnt, not that i know of anyway... and i clam to be a junior dev right in my sig :)

          Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

          you.suck = (you.passion != Programming)

          E Offline
          E Offline
          Ennis Ray Lynch Jr
          wrote on last edited by
          #41

          Yeah I know, that is why I put my last sentence, don't be that guy :p

          Need a C# Consultant? I'm available.
          Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

          1 Reply Last reply
          0
          • P Pete OHanlon

            Ennis Ray Lynch, Jr. wrote:

            Not doing so makes reflection a PITA.

            Yup, but reflection is normally an indication that something's broken in your design.

            Ennis Ray Lynch, Jr. wrote:

            Interesting that the CLR doesn't support properties.

            Of course it does - and they happen to be methods called get_ and set_ .... ;)

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #42

            I agree 100% re using reflection indicates a poor design choice, it does make nice hack when they lead designer is himself a hack.

            Need a C# Consultant? I'm available.
            Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

            1 Reply Last reply
            0
            • P Pawel Krakowiak

              Same here, unless there's specific logic involved. Automatic properties save some coding. ;)

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #43

              It's not about saving keystrokes, it's about reducing the chance for an unexpectedly recursive property.

              P 1 Reply Last reply
              0
              • P Pete OHanlon

                Actually - there's another pet peeve of mine. People using properties when a field would suffice. If the object is serializable then, fine, make it a property otherwise do you really need to have a property that does nothing other than assign a value?

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #44

                One should always use custom serialization anyway.

                1 Reply Last reply
                0
                • E Ennis Ray Lynch Jr

                  Than logic. Many of your wrongs are perfectly acceptable. In fact I author all of my code with squirlies on the same line as a construct because I prefer that style ... and it is a style issue not a right or wrong. Developers, such as yourself, who have pet peeves that have nothing to do with bad programming waste a lot of code reviews that could be better spent. Any developer worth his or her salt should be able to read any consistently written code without any difficulty.

                  Need a C# Consultant? I'm available.
                  Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #45

                  Ennis Ray Lynch, Jr. wrote:

                  squirlies on the same line

                  Plus, Visual Studio can modify it to the user's preference.

                  1 Reply Last reply
                  0
                  • H Harvey Saayman

                    agreed! its actually weird how furious i get for something so silly...

                    Harvey Saayman - South Africa Junior Developer .Net, C#, SQL

                    you.suck = (you.passion != Programming)

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #46

                    Ease off on the coffee? :-D

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      It's not about saving keystrokes, it's about reducing the chance for an unexpectedly recursive property.

                      P Offline
                      P Offline
                      Pawel Krakowiak
                      wrote on last edited by
                      #47

                      PIEBALDconsult wrote:

                      It's not about saving keystrokes, it's about reducing the chance for an unexpectedly recursive property.

                      Definitely about keystrokes for me, I never wrote a recursive property, maybe because I have different naming conventions for private fields.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups