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. Programming isn't hard...

Programming isn't hard...

Scheduled Pinned Locked Moved The Lounge
66 Posts 31 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.
  • Sander RosselS Sander Rossel

    Thinking of names for your classes and variables, THAT's hard... :doh: Frustration #1 of the evening... :sigh:

    It's an OO world.

    public class Naerling : Lazy<Person>{}

    L Offline
    L Offline
    lewax00
    wrote on last edited by
    #36

    I always found naming the program itself hardest. Which is why most of my project names are fairly meaningless...

    1 Reply Last reply
    0
    • I Ian Shlasko

      Tenagra t = new Tenagra();
      t.Add(new Darmok());
      t.Add(new Jilad());
      t.Add(new TheBeast());
      t.EpicBattle();
      t.MoveItemsTo(new Ocean());

      Proud to have finally moved to the A-Ark. Which one are you in?
      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

      Q Offline
      Q Offline
      QuiJohn
      wrote on last edited by
      #37

      Ian Shlasko wrote:

      Tenagra t = new Tenagra(); t.Add(new Darmok()); t.Add(new Jilad()); t.Add(new TheBeast()); t.EpicBattle(); t.MoveItemsTo(new Ocean());

      Congratulations, this is the nerdiest thing I have read this month, on many levels. And considering the crap I read, that was an achievement.

      I M 2 Replies Last reply
      0
      • Q QuiJohn

        Ian Shlasko wrote:

        Tenagra t = new Tenagra(); t.Add(new Darmok()); t.Add(new Jilad()); t.Add(new TheBeast()); t.EpicBattle(); t.MoveItemsTo(new Ocean());

        Congratulations, this is the nerdiest thing I have read this month, on many levels. And considering the crap I read, that was an achievement.

        I Offline
        I Offline
        Ian Shlasko
        wrote on last edited by
        #38

        I blame Netflix, for having the entire Star Trek franchise available for streaming :)

        Proud to have finally moved to the A-Ark. Which one are you in?
        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

        1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          Thinking of names for your classes and variables, THAT's hard... :doh: Frustration #1 of the evening... :sigh:

          It's an OO world.

          public class Naerling : Lazy<Person>{}

          S Offline
          S Offline
          Slacker007
          wrote on last edited by
          #39

          Naerling wrote:

          Thinking of names for your classes and variables,

          I don't use anything under 80 characters in length. I try to name it and describe it all in one name. I also have a tendency to give it a feminine or masculine slant depending on what kind of work these objects are doing...names usually ending in either "ita" or "ito".

          Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
          "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011)

          1 Reply Last reply
          0
          • N Nish Nishant

            Naerling wrote:

            Thinking of names for your classes and variables, THAT's hard... :doh:
            Frustration #1 of the evening... :sigh:

            I solve this by using a single Object variable called theKey across my entire project. I assign all local references to this variable and cast to the required derived type before calling a method or property. On occasions I may need two or even three such variables (I suffix 1,2,3 to get theKey1 and so on). Problem solved. :-\

            Regards, Nish


            My technology blog: voidnish.wordpress.com

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #40

            I'm going to drive up to Dublin and hurt you now. I'll see you in an hour.

            Software Zen: delete this;

            N 1 Reply Last reply
            0
            • A AspDotNetDev

              I prefer to call all my variables a1, a2, a3, a4, and so on. Also, once I get to a6, I use another letter (say, b1)... that way, I only ever have to use my left hand and can keep my right hand on the mouse. It's a very efficient technique I wish everybody else would adopt. Until then, I just refactor all the code I see with overly long variable names like "count" (that's a particularly bad name because some of the characters require the right hand to type). I sleep easily at night, comfortable in the knowledge that all my refactoring has made the world a better place. :-\

              Somebody in an online forum wrote:

              INTJs never really joke. They make a point. The joke is just a gift wrapper.

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #41

              This is a particularly stupid tip and would never work. Apart from the fact that it would require superhuman mental gymnastics, once you have more than 42 variables, in order to maintain alphabetic ordering, it is yet another invidious ploy by the militant fundamentalist wing of the ASL (Anti-Southpaw League). Please remember that The Lounge is no place for these religious outpourings.

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

              A B 2 Replies Last reply
              0
              • G Gary R Wheeler

                I'm going to drive up to Dublin and hurt you now. I'll see you in an hour.

                Software Zen: delete this;

                N Offline
                N Offline
                Nish Nishant
                wrote on last edited by
                #42

                :laugh:

                Regards, Nish


                My technology blog: voidnish.wordpress.com

                1 Reply Last reply
                0
                • L Lost User

                  _beauw_ wrote:

                  There was a movie where Leo DiCaprio (or maybe Matt Damon?) was a maintenance man who did mathematics...

                  I believe you are refering to Good Will Hunting[^] and it stared Matt Damon.

                  Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                  _ Offline
                  _ Offline
                  _beauw_
                  wrote on last edited by
                  #43

                  That's the one! Ironically, I was too busy with mathematics classes to see that one when it came out.

                  1 Reply Last reply
                  0
                  • H Henry Minute

                    This is a particularly stupid tip and would never work. Apart from the fact that it would require superhuman mental gymnastics, once you have more than 42 variables, in order to maintain alphabetic ordering, it is yet another invidious ploy by the militant fundamentalist wing of the ASL (Anti-Southpaw League). Please remember that The Lounge is no place for these religious outpourings.

                    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                    A Offline
                    A Offline
                    AspDotNetDev
                    wrote on last edited by
                    #44

                    The obvious solution is to use a YTREWQ keyboard.

                    Somebody in an online forum wrote:

                    INTJs never really joke. They make a point. The joke is just a gift wrapper.

                    1 Reply Last reply
                    0
                    • N Nish Nishant

                      Naerling wrote:

                      Thinking of names for your classes and variables, THAT's hard... :doh:
                      Frustration #1 of the evening... :sigh:

                      I solve this by using a single Object variable called theKey across my entire project. I assign all local references to this variable and cast to the required derived type before calling a method or property. On occasions I may need two or even three such variables (I suffix 1,2,3 to get theKey1 and so on). Problem solved. :-\

                      Regards, Nish


                      My technology blog: voidnish.wordpress.com

                      L Offline
                      L Offline
                      Lutoslaw
                      wrote on last edited by
                      #45

                      You could use an array or a list to make the solution more flexible. Then you have theKey[0], theKey[1], ...

                      Greetings - Jacek

                      A 1 Reply Last reply
                      0
                      • L Lutoslaw

                        You could use an array or a list to make the solution more flexible. Then you have theKey[0], theKey[1], ...

                        Greetings - Jacek

                        A Offline
                        A Offline
                        AspDotNetDev
                        wrote on last edited by
                        #46

                        I would also allocate it right away with 640,000 elements (that ought to be enough for anybody).

                        Somebody in an online forum wrote:

                        INTJs never really joke. They make a point. The joke is just a gift wrapper.

                        1 Reply Last reply
                        0
                        • I Ian Shlasko

                          OriginalGriff wrote:

                          Star Fleet don't seem to have any truck with H&S legislation, or they wouldn't fill all the computer consoles with semtex...

                          Yeah, I always wondered why it was that they could manage matter-energy conversion, subspace communication, and warp drive... But couldn't seem to figure out how to make a surge protector or... *gasp*... a FUSE!

                          Proud to have finally moved to the A-Ark. Which one are you in?
                          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

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

                          Or a seat belt.

                          And from the clouds a mighty voice spoke:
                          "Smile and be happy, for it could come worse!"

                          And I smiled and was happy
                          And it came worse.

                          1 Reply Last reply
                          0
                          • Sander RosselS Sander Rossel

                            I just went for item. And yes, it is to remain abstract. It is an Interface Method that has a T (as in generic) as a parameter. That is the reason I did not want to go for obj. Because the parameter is of type T, which is more specific than an Object.

                            It's an OO world.

                            public class Naerling : Lazy<Person>{}

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

                            void DoSomethingGeneric(T t){ ... } If it's just any T, with no further restrictions, the fact it is a 'T' is the only thing that identifies it, so I'd call it 't'. The fact that it's a T that something is done with should be clear from the method name.

                            1 Reply Last reply
                            0
                            • H Henry Minute

                              This is a particularly stupid tip and would never work. Apart from the fact that it would require superhuman mental gymnastics, once you have more than 42 variables, in order to maintain alphabetic ordering, it is yet another invidious ploy by the militant fundamentalist wing of the ASL (Anti-Southpaw League). Please remember that The Lounge is no place for these religious outpourings.

                              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

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

                              I agree. Since all the syntactic characters are on the other side of the keyboard (parens, braces, semicolon, equals and single quote; double quote too for Americans), clearly variable names ought to use exclusively the right side of the keyboard (p0, p9, p8, ... p5, o0, ... etc).

                              1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                Thinking of names for your classes and variables, THAT's hard... :doh: Frustration #1 of the evening... :sigh:

                                It's an OO world.

                                public class Naerling : Lazy<Person>{}

                                R Offline
                                R Offline
                                radioman lt
                                wrote on last edited by
                                #50

                                it's easy when you coding some useless crap, real programming never was easy and will never be :~

                                d{^__^}b - it's time to fly

                                Sander RosselS 1 Reply Last reply
                                0
                                • R radioman lt

                                  it's easy when you coding some useless crap, real programming never was easy and will never be :~

                                  d{^__^}b - it's time to fly

                                  Sander RosselS Offline
                                  Sander RosselS Offline
                                  Sander Rossel
                                  wrote on last edited by
                                  #51

                                  It's called irony :)

                                  It's an OO world.

                                  public class Naerling : Lazy<Person>{}

                                  1 Reply Last reply
                                  0
                                  • _ _beauw_

                                    When Black and Scholes were figuring out how to value options, though, they probably were using one- and two-letter variable names, and they ended up winning the Nobel Prize. Maybe the difference is that people don't have to "maintain" mathematics. There was a movie where Leo DiCaprio (or maybe Matt Damon?) was a maintenance man who did mathematics... but that's a different story. :-D

                                    A Offline
                                    A Offline
                                    adudley256
                                    wrote on last edited by
                                    #52

                                    I always get those two mixed up, made watching The Departed very difficult to begin with :)

                                    1 Reply Last reply
                                    0
                                    • I Ian Shlasko

                                      Dijkstra didn't have to debug an option valuation model written in C++ by a math PhD... True story... Almost every variable in the Black-Scholes calculation was one or two letters long, and none of them had any relevance to what they represented. Don't get me wrong... It (mostly) worked, and it was fast, but... Ow, my eyes!

                                      Proud to have finally moved to the A-Ark. Which one are you in?
                                      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                      M Offline
                                      M Offline
                                      Mike Winiberg
                                      wrote on last edited by
                                      #53

                                      I know what you mean - my colleague (who writes the B-S module for his option pricing program (which I maintain)) loves names like henry, peter, peterp, peter2 etc - I'm just glad I don't have to work on that bit of code. I used to employ a programmer who was very good, and very hard working, but he never used any kind of meaningful names for anything, so a complex C function representing, say, a vector drawing interpreter, would contain tens of variables named a,aa,aaa,aaa, x,xx,xxx,xxxx, i,ii,iii,iiii,iiiii and so forth... 8)

                                      1 Reply Last reply
                                      0
                                      • Q QuiJohn

                                        Ian Shlasko wrote:

                                        Tenagra t = new Tenagra(); t.Add(new Darmok()); t.Add(new Jilad()); t.Add(new TheBeast()); t.EpicBattle(); t.MoveItemsTo(new Ocean());

                                        Congratulations, this is the nerdiest thing I have read this month, on many levels. And considering the crap I read, that was an achievement.

                                        M Offline
                                        M Offline
                                        Mike Winiberg
                                        wrote on last edited by
                                        #54

                                        Temba(his)::arms(wide){} ;P

                                        1 Reply Last reply
                                        0
                                        • _ _beauw_

                                          This is Dijkstra's opinion, not mine! But I think he would tell you that mathematicians get by with X, Y, theta, pi, etc., and that programming is just a species of mathematics. After all, Einstein didn't discover that realEnergy = realMass * [ (squareRootOfTheSpeedOfLight)² ] Rather, he was just fine with E=mc², and (amazingly, if all you know is programming) people still embraced his findings.

                                          S Offline
                                          S Offline
                                          StarNamer work
                                          wrote on last edited by
                                          #55

                                          _beauw_ wrote:

                                          After all, Einstein didn't discover that
                                          realEnergy = realMass * [ (squareRootOfTheSpeedOfLight)² ]

                                          He didn't.

                                          realEnergy = realMass * [ (theSpeedOfLightInVacuum)² ]

                                          FTFY

                                          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