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. C# 4.0. w00t.

C# 4.0. w00t.

Scheduled Pinned Locked Moved The Lounge
csharpc++comarchitecture
35 Posts 20 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.
  • C Chris Maunder

    Named and Optional Parameters. My life is complete.

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    R Offline
    R Offline
    realJSOP
    wrote on last edited by
    #13

    Optional parameters would be damn handy.

    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

    B 1 Reply Last reply
    0
    • C Chris Maunder

      Named and Optional Parameters. My life is complete.

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #14

      Chris Maunder wrote:

      Named and Optional Parameters. My life is complete.

      A w00t for that! Jesus Chris, what you doing for Code Projects 9th birthday? Feel like a leisurely flight to Sydney and a few hours of drinking over at old Mount Druitt? You can even bring your snowboard along, we could do with the shade.

      Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

      1 Reply Last reply
      0
      • C Chris Maunder

        Named and Optional Parameters. My life is complete.

        cheers, Chris Maunder

        CodeProject.com : C++ MVP

        D Offline
        D Offline
        Daniel Turini
        wrote on last edited by
        #15

        Optional parameters are, imho, a bad thing, most of the time. It's a more structured variation of the "Accumulate and fire" antipattern. All too often, optional parameters are actually fields in a class that you are missing. And, if you're missing fields, you're missing methods. This, on the long run, means longer methods, repeated code, and harder to test. For quick and dirty code, it's a good tool, but not on larger projects.

        I see dead pixels

        S 1 Reply Last reply
        0
        • D Daniel Turini

          Optional parameters are, imho, a bad thing, most of the time. It's a more structured variation of the "Accumulate and fire" antipattern. All too often, optional parameters are actually fields in a class that you are missing. And, if you're missing fields, you're missing methods. This, on the long run, means longer methods, repeated code, and harder to test. For quick and dirty code, it's a good tool, but not on larger projects.

          I see dead pixels

          S Offline
          S Offline
          Steve Hansen
          wrote on last edited by
          #16

          You know how many string.Format methods there are? 5 You know how many have actual code (instead of calling another overload)? 1 And that is just one example, there are lots of overloads in the .NET frameworks that do nothing else. I don't see how you could handle this with extra fields...

          1 Reply Last reply
          0
          • P Patrick Etc

            Josh Smith wrote:

            I'd love to live in a world where things like this[^] are unheard of.

            Mmm, you'll be waiting an awfully long time. Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk. That's the nature of reality as we currently inhabit it. Now, if we could invent an alternate reality where freedom and absolutely perfectly responsible behavior went hand in hand... but I digress.

            J Offline
            J Offline
            Josh Smith
            wrote on last edited by
            #17

            Patrick Etc. wrote:

            Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk.

            True. So, with that logic, why not sell nuclear bombs at K-Mart? :)

            :josh: Try Crack![^] Sleep is overrated.

            P C 2 Replies Last reply
            0
            • J Josh Smith

              Chris Maunder wrote:

              Nice idea, but I can just picture the code that is going to come from developers who don't understand when and where to use them. And not use them.

              Please try explaining that logic to the manufacturers and distributors of firearms. I'd love to live in a world where things like this[^] are unheard of.

              :josh: Try Crack![^] Sleep is overrated.

              B Offline
              B Offline
              Bassam Abdul Baki
              wrote on last edited by
              #18

              Must be in Pakistan or India. Sorry. Off to the Soapbox for me.


              Web - Blog - RSS - Math - BM

              1 Reply Last reply
              0
              • C Chris Maunder

                Named and Optional Parameters. My life is complete.

                cheers, Chris Maunder

                CodeProject.com : C++ MVP

                B Offline
                B Offline
                Bassam Abdul Baki
                wrote on last edited by
                #19

                I keep telling people that Microsoft's big plan is to change C++ to C# and VB to C# and make all their developers use the same language. Obviously, they'll have to dumb things down if they want all their developers to be called .NET Devs.


                Web - Blog - RSS - Math - BM

                1 Reply Last reply
                0
                • R realJSOP

                  Optional parameters would be damn handy.

                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                  -----
                  "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                  B Offline
                  B Offline
                  Bassam Abdul Baki
                  wrote on last edited by
                  #20

                  You VB closet hider you.


                  Web - Blog - RSS - Math - BM

                  R 1 Reply Last reply
                  0
                  • J Josh Smith

                    Chris Maunder wrote:

                    Nice idea, but I can just picture the code that is going to come from developers who don't understand when and where to use them. And not use them.

                    Please try explaining that logic to the manufacturers and distributors of firearms. I'd love to live in a world where things like this[^] are unheard of.

                    :josh: Try Crack![^] Sleep is overrated.

                    R Offline
                    R Offline
                    rwinte
                    wrote on last edited by
                    #21

                    I'd also love to live in a world where are current laws are enforced. Ex-convicts aren't allowed to own firearms, let alone a fully-automatic? If current laws were enforced, this guy would have been in jail for violating two current laws. I guess laws don't stop criminals from selling fully-automatic weapons on the black market to ex-cons.

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      Named and Optional Parameters. My life is complete.

                      cheers, Chris Maunder

                      CodeProject.com : C++ MVP

                      W Offline
                      W Offline
                      Waylon Flinn
                      wrote on last edited by
                      #22

                      I actually don't program in VB because I think it produces code that's harder to read. This makes it more difficult to understand and thus more difficult to maintain. This is especially true for projects of any complexity or size. I thought with C# that MS had finally learned an important lesson from Java: They need a clean language with a simple, clear syntax and straightforward semantics. It seems like their resolve has begun to waver. They've finally given in to the temptation to turn their most beautiful language to date into something more like it's "easy" sister. I am saddened by this turn of events.

                      1 Reply Last reply
                      0
                      • J Josh Smith

                        Patrick Etc. wrote:

                        Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk.

                        True. So, with that logic, why not sell nuclear bombs at K-Mart? :)

                        :josh: Try Crack![^] Sleep is overrated.

                        P Offline
                        P Offline
                        Patrick Etc
                        wrote on last edited by
                        #23

                        Josh Smith wrote:

                        True. So, with that logic, why not sell nuclear bombs at K-Mart?

                        Hehe you got univoted :) And as for the logic, that was quite a leap there... just because risk is inherent doesn't mean we don't work to mitigate it ;) but that requires the wisdom to know when a risk-mitigation strategy throws the baby out with the bathwater. And that's about all I'm going to say else we dive into SB material.. :D

                        1 Reply Last reply
                        0
                        • B Bassam Abdul Baki

                          You VB closet hider you.


                          Web - Blog - RSS - Math - BM

                          R Offline
                          R Offline
                          realJSOP
                          wrote on last edited by
                          #24

                          Actually, optional parameters are a feature of C++. I've already stated this before, but the only bad thing optional parameters does is creates an additional thought process when coding because you are faced with choosing between function overloading or the use of optional parameters. There are times would an optional parameter would have been preferable to overloading.

                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                          -----
                          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                          B 1 Reply Last reply
                          0
                          • R realJSOP

                            Actually, optional parameters are a feature of C++. I've already stated this before, but the only bad thing optional parameters does is creates an additional thought process when coding because you are faced with choosing between function overloading or the use of optional parameters. There are times would an optional parameter would have been preferable to overloading.

                            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                            -----
                            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                            B Offline
                            B Offline
                            Bassam Abdul Baki
                            wrote on last edited by
                            #25

                            John Simmons / outlaw programmer wrote:

                            Actually, optional parameters are a feature of C++.

                            True, but it's been a while since I've seen people use default values.

                            John Simmons / outlaw programmer wrote:

                            There are times would an optional parameter would have been preferable to overloading.

                            What's your example?


                            Web - Blog - RSS - Math - BM

                            1 Reply Last reply
                            0
                            • C Chris Maunder

                              I was going to post tomorrow's survey as "Does the thought of Dynamic variables make you break out in a cold sweat?" Nice idea, but I can just picture the code that is going to come from developers who don't understand when and where to use them. And not use them.

                              cheers, Chris Maunder

                              CodeProject.com : C++ MVP

                              C Offline
                              C Offline
                              cpkilekofp
                              wrote on last edited by
                              #26

                              Chris Maunder wrote:

                              I was going to post tomorrow's survey as "Does the thought of Dynamic variables make you break out in a cold sweat?" Nice idea, but I can just picture the code that is going to come from developers who don't understand when and where to use them. And not use them.

                              Yes, but....what makes that any different from gotos, K & R C function parameters, MAPCARrion in LISP (the rotted remains of programmers trying to understand poorly implemented algorithms using MAPCAR()), etc.? It's just another new potential nightmare...maybe I'm jaded, I dunno :laugh:

                              1 Reply Last reply
                              0
                              • J Josh Smith

                                Patrick Etc. wrote:

                                Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk.

                                True. So, with that logic, why not sell nuclear bombs at K-Mart? :)

                                :josh: Try Crack![^] Sleep is overrated.

                                C Offline
                                C Offline
                                cpkilekofp
                                wrote on last edited by
                                #27

                                Josh Smith wrote:

                                Patrick Etc. wrote: Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk. True. So, with that logic, why not sell nuclear bombs at K-Mart?

                                I keep asking, for them, howitzers, claymores mines, and acid pellets for shotgun loads, but they just laugh like I'm not serious *bitterly holding onto his gun and Bible in Pennsylvania, and voting for Obama :laugh: *

                                1 Reply Last reply
                                0
                                • R Roger Wright

                                  Chris Maunder wrote:

                                  My life is complete.

                                  Not until you've tried women; then you're done.

                                  "A Journey of a Thousand Rest Stops Begins with a Single Movement"

                                  C Offline
                                  C Offline
                                  cpkilekofp
                                  wrote on last edited by
                                  #28

                                  Roger Wright wrote:

                                  Chris Maunder wrote: My life is complete. Not until you've tried women; then you're done.

                                  I've tried women, they continue to try me :O

                                  1 Reply Last reply
                                  0
                                  • C ChandraRam

                                    Chris Maunder wrote:

                                    Named and Optional Parameters.

                                    VB has had those since... oh... the dinosaurs. So C# 4.0 is really VB in disguise? ;P

                                    C Offline
                                    C Offline
                                    cpkilekofp
                                    wrote on last edited by
                                    #29

                                    ChandraRam wrote:

                                    So C# 4.0 is really VB in disguise? ;P

                                    C# 1.0 was VB in disguise...they had to complete the full implementation sometime :laugh:

                                    1 Reply Last reply
                                    0
                                    • P Patrick Etc

                                      Josh Smith wrote:

                                      I'd love to live in a world where things like this[^] are unheard of.

                                      Mmm, you'll be waiting an awfully long time. Every gun in the world could be destroyed and you'd still get random stabbings, baseball battings, getting run over by cars... the very nature of freedom is one of risk. That's the nature of reality as we currently inhabit it. Now, if we could invent an alternate reality where freedom and absolutely perfectly responsible behavior went hand in hand... but I digress.

                                      M Offline
                                      M Offline
                                      Mark_Wallace
                                      wrote on last edited by
                                      #30

                                      Your counter sounds logical, but it isn't. I doubt very much that even the most paranoid idiot would have answered the door to trick-or-treaters and knifed them, battered them to death with a baseball bat, or run them over with his car -- no matter how much illegally gained money he was "defending". Anyone who truly believes it necessary to keep a loaded AK47 in his home should be locked away in an insane asylum before he ever gets the chance to fire it.

                                      R 1 Reply Last reply
                                      0
                                      • M Mark_Wallace

                                        Your counter sounds logical, but it isn't. I doubt very much that even the most paranoid idiot would have answered the door to trick-or-treaters and knifed them, battered them to death with a baseball bat, or run them over with his car -- no matter how much illegally gained money he was "defending". Anyone who truly believes it necessary to keep a loaded AK47 in his home should be locked away in an insane asylum before he ever gets the chance to fire it.

                                        R Offline
                                        R Offline
                                        Robert Royall
                                        wrote on last edited by
                                        #31

                                        Did you actually read that article that Josh linked to, or did you just skim the part where he shot the 12 year old? The guy very much was a paranoid idiot, and he likely would have knifed or battered trick-or-treaters to death with a baseball bat. The AK47 was incidental - he probably would have made due with whatever weapon came to hand if he didn't have a gun in the house.

                                        Imagine that you are hired to build a bridge over a river which gets slightly wider every day; sometimes it shrinks but nobody can predict when. Your client provides no concrete or steel, only timber and cut stone (but they won't tell you what kind). The coefficient of gravity changes randomly from hour to hour, as does the viscosity of air. Your only tools are a hacksaw, a chainsaw, a rubber mallet, and a length of rope. Welcome to my world. -Me explaining my job to an engineer

                                        M 1 Reply Last reply
                                        0
                                        • L LucasBreedlove

                                          VS for C/C++ programmers (not necessarily MFC) has sucked since the end of VS 6. You want help with that function? No, you have too many template classes. It is nice that they continue to make their tabs rounder, and their gradients smoother. I've always said, "you know what VS could use? More gradients!"

                                          D Offline
                                          D Offline
                                          DannyVarod
                                          wrote on last edited by
                                          #32

                                          Actually, VS2005 was MS's first usable IDE, before VS2005 I could only use Borland's IDEs and freewares (which used to be better than VS), like Bloodshed Dev C++. For instant, try using the help in VS6 or VS2003 to look something up - worst help ever.

                                          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