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. Keep it simple!

Keep it simple!

Scheduled Pinned Locked Moved The Lounge
6 Posts 4 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.
  • M Offline
    M Offline
    morzel
    wrote on last edited by
    #1

    Oh the joys of maintaining other people code under very strict SLA… Three (at least) layers of indirection between log4net and code + var keyword used everywhere compiler allows it… X|

    P S 2 Replies Last reply
    0
    • M morzel

      Oh the joys of maintaining other people code under very strict SLA… Three (at least) layers of indirection between log4net and code + var keyword used everywhere compiler allows it… X|

      P Offline
      P Offline
      peterchen
      wrote on last edited by
      #2

      morzel wrote:

      SLA

      Shutter Leech Absolver?

      ORDER BY what user wants

      1 Reply Last reply
      0
      • M morzel

        Oh the joys of maintaining other people code under very strict SLA… Three (at least) layers of indirection between log4net and code + var keyword used everywhere compiler allows it… X|

        S Offline
        S Offline
        Super Lloyd
        wrote on last edited by
        #3

        NDA? BTW I like var!! ^^ If you don't I can see only 3 reason... 1. you haven't understand var 2. it is used in case where it is very hard to guess the type for a human without assistance 3. a good IDE will solve 2, but you don't have one! ;P

        My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

        B M 2 Replies Last reply
        0
        • S Super Lloyd

          NDA? BTW I like var!! ^^ If you don't I can see only 3 reason... 1. you haven't understand var 2. it is used in case where it is very hard to guess the type for a human without assistance 3. a good IDE will solve 2, but you don't have one! ;P

          My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

          B Offline
          B Offline
          BobJanova
          wrote on last edited by
          #4

          I don't really like var, but it is unambiguously a good thing in one case only: when you are constructing an object and therefore have the type on the same line. There's no reason for

          SomeLongTypeName<String, List<DomainObjectType>> myVariable = new SomeLongTypeName<String, List<DomainObjectType>>(...);

          ... when the type is right there. I don't like the common usage of var for Linq queries. It's never immediately obvious what the type of one of those is (it's Queryable<T> where T is the type of the last select clause, unless there's a call to First or Count or something similar ... working out the type requires a full reading of the whole query and hinting the query with what the type is is, imo, helpful in understanding it).

          S 1 Reply Last reply
          0
          • B BobJanova

            I don't really like var, but it is unambiguously a good thing in one case only: when you are constructing an object and therefore have the type on the same line. There's no reason for

            SomeLongTypeName<String, List<DomainObjectType>> myVariable = new SomeLongTypeName<String, List<DomainObjectType>>(...);

            ... when the type is right there. I don't like the common usage of var for Linq queries. It's never immediately obvious what the type of one of those is (it's Queryable<T> where T is the type of the last select clause, unless there's a call to First or Count or something similar ... working out the type requires a full reading of the whole query and hinting the query with what the type is is, imo, helpful in understanding it).

            S Offline
            S Offline
            Super Lloyd
            wrote on last edited by
            #5

            Well, what if the result is anonymous type?! Or the guy changed his mind 17 times and got tired of typing the full type every time the 16th time? Just saying.. I understand you too! ;P In case you like a tip, maybe it's obvious, but how about skimming the query to the 'select ...' statement?

            My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

            1 Reply Last reply
            0
            • S Super Lloyd

              NDA? BTW I like var!! ^^ If you don't I can see only 3 reason... 1. you haven't understand var 2. it is used in case where it is very hard to guess the type for a human without assistance 3. a good IDE will solve 2, but you don't have one! ;P

              My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

              M Offline
              M Offline
              morzel
              wrote on last edited by
              #6

              I assure you that I know what var means and I consider VS2010+R# to be a pretty good environment. Sometimes var makes code more readable, but sometimes it's just the opposite. Code writing time is less important than reading time...

              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