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. Two lines of code I wrote today with a straight face (at least for a while)

Two lines of code I wrote today with a straight face (at least for a while)

Scheduled Pinned Locked Moved The Lounge
43 Posts 23 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

    I find the comment more problematic. But it's good that I instill fear in those that write code of dubious quality* :D * The quality of code shall be measured by braceless single line if statements, indentation, lack or abundance of white space, naming conventions and comments. Whether the code does what it should do is of secondary concern. Code written in Java shall be considered bad quality by default.

    Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

    H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #19

    see, I used to care about that stuff. now it's (re other people's code) a) does the code do what it's supposed to? b) can i read it? i guess i've gotten good at b because i'm fine with just about whatever.

    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

    1 Reply Last reply
    0
    • H honey the codewitch

      my hubby used to work helldesk in college and he said he kept a paperclip around for rebooting the imacs and an icepick around for rebooting their users.

      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

      D Offline
      D Offline
      Daniel Pfeffer
      wrote on last edited by
      #20

      honey the codewitch wrote:

      icepick around for rebooting their users

      Is that what they call a LART in your part of the world? :)

      Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

      H 1 Reply Last reply
      0
      • D Daniel Pfeffer

        honey the codewitch wrote:

        icepick around for rebooting their users

        Is that what they call a LART in your part of the world? :)

        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #21

        something like that, yes.

        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

        1 Reply Last reply
        0
        • N Nagy Vilmos

          An old C system I once worked on had a routine `abortOrphans()`. :laugh:

          veni bibi saltavi

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #22

          According to democrats, that's okay (and it's called "full term abortions" now.).

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

          1 Reply Last reply
          0
          • C CPallini

            Technically is just a line of code. :-D -- Carlo The Nitpick

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

            There's no such thing as a "line of code" in C-style languages.

            G 1 Reply Last reply
            0
            • N Nagy Vilmos

              An old C system I once worked on had a routine `abortOrphans()`. :laugh:

              veni bibi saltavi

              K Offline
              K Offline
              kalberts
              wrote on last edited by
              #24

              We once created an object factory whose core function was named GOD - General Object Dispenser.

              1 Reply Last reply
              0
              • Sander RosselS Sander Rossel

                You have my blessings on the underscore :D But why is there a comment that just puts the two words of the function name in a different order? :~ Why not change the function name to _Terminate_Users (or TerminateUsers if you want to do it right ;) ) so it's slightly more readable and ditch the comment?

                Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                K Offline
                K Offline
                kalberts
                wrote on last edited by
                #25

                Sander Rossel wrote:

                Why not change the function name to _Terminate_Users (or TerminateUsers if you want to do it right ;) )

                That was last month. The coding standard of this month says that functions should be named __. The argument for that is that in a sorted list of function names, you get all the actions on one object class gathered together. I have no information wha will be the right way to format code next month, or what the arguments will be, but I am really happy that modern IDEs have support for coding style changes. For newlines, indents and spacing it can be fully automated. Changing naming standards usually require some more manual work, but compared to the old days where you had to manually search for every occurence of a symbol to change it to the standard of the month required a lot more work.

                G 1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  You have my blessings on the underscore :D But why is there a comment that just puts the two words of the function name in a different order? :~ Why not change the function name to _Terminate_Users (or TerminateUsers if you want to do it right ;) ) so it's slightly more readable and ditch the comment?

                  Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                  G Offline
                  G Offline
                  Gary Wheeler
                  wrote on last edited by
                  #26

                  The comment was removed shortly thereafter. The "user termination" logic was directly after the comment, but was moved into its own method. This was part of a reorganization/refactoring going on in preparation for a new feature.

                  Software Zen: delete this;

                  Sander RosselS 1 Reply Last reply
                  0
                  • K kalberts

                    Sander Rossel wrote:

                    Why not change the function name to _Terminate_Users (or TerminateUsers if you want to do it right ;) )

                    That was last month. The coding standard of this month says that functions should be named __. The argument for that is that in a sorted list of function names, you get all the actions on one object class gathered together. I have no information wha will be the right way to format code next month, or what the arguments will be, but I am really happy that modern IDEs have support for coding style changes. For newlines, indents and spacing it can be fully automated. Changing naming standards usually require some more manual work, but compared to the old days where you had to manually search for every occurence of a symbol to change it to the standard of the month required a lot more work.

                    G Offline
                    G Offline
                    Gary Wheeler
                    wrote on last edited by
                    #27

                    Fortunately for me, our coding standard (all 1½ pages of it) hasn't changed significantly since 2000.

                    Software Zen: delete this;

                    1 Reply Last reply
                    0
                    • H honey the codewitch

                      I do similar. Private members have leading underscores in my code. I was just yanking Sander's chain.

                      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                      G Offline
                      G Offline
                      Gary Wheeler
                      wrote on last edited by
                      #28

                      honey the codewitch wrote:

                      yanking Sander's chain

                      Chain-yanking is almost always a useful thing. :-D

                      Software Zen: delete this;

                      1 Reply Last reply
                      0
                      • G Gary Wheeler

                        The comment was removed shortly thereafter. The "user termination" logic was directly after the comment, but was moved into its own method. This was part of a reorganization/refactoring going on in preparation for a new feature.

                        Software Zen: delete this;

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

                        The best comment is a removed comment :thumbsup: :D

                        Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                        G 1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          The best comment is a removed comment :thumbsup: :D

                          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                          G Offline
                          G Offline
                          Gary Wheeler
                          wrote on last edited by
                          #30

                          A long time ago I took a programming class from Dan Saks, one-time secretary of the ISO C++ standardization committee. He said something to us which has stuck with me ever since, and has led to a profound reduction in the number of comments I write:     "If you can, say it in code. If you can't, only then say it in a comment." While we do maintain change history in our source, my comments now tend to serve other purposes than simple documentation. For example, our code base is in the neighborhood of 3 million lines so navigation can be a problem. Comments can serve as markers for 'find in files' destinations when Intellisense doesn't work.

                          Software Zen: delete this;

                          M 1 Reply Last reply
                          0
                          • G Gary Wheeler
                                    // terminate users
                                    
                                    \_Users\_Terminate();
                            

                            :-D

                            Software Zen: delete this;

                            Z Offline
                            Z Offline
                            zpinklb
                            wrote on last edited by
                            #31

                            The function name is clear enough, is the comment necessary? ;-)

                            1 Reply Last reply
                            0
                            • G Gary Wheeler

                              A long time ago I took a programming class from Dan Saks, one-time secretary of the ISO C++ standardization committee. He said something to us which has stuck with me ever since, and has led to a profound reduction in the number of comments I write:     "If you can, say it in code. If you can't, only then say it in a comment." While we do maintain change history in our source, my comments now tend to serve other purposes than simple documentation. For example, our code base is in the neighborhood of 3 million lines so navigation can be a problem. Comments can serve as markers for 'find in files' destinations when Intellisense doesn't work.

                              Software Zen: delete this;

                              M Offline
                              M Offline
                              Morten Raaasted
                              wrote on last edited by
                              #32

                              One of my mentors once stated "The comments are the part of the code that even the compiler cannot understand"

                              1 Reply Last reply
                              0
                              • N Nagy Vilmos

                                An old C system I once worked on had a routine `abortOrphans()`. :laugh:

                                veni bibi saltavi

                                M Offline
                                M Offline
                                maze3
                                wrote on last edited by
                                #33

                                I like specificity with wording, so reading this I had to look up whether abort or terminate would be the best word choice.

                                1 Reply Last reply
                                0
                                • G Gary Wheeler
                                          // terminate users
                                          
                                          \_Users\_Terminate();
                                  

                                  :-D

                                  Software Zen: delete this;

                                  K Offline
                                  K Offline
                                  Kirk 10389821
                                  wrote on last edited by
                                  #34

                                  And I thought the problem was: _Users_Terminate( IgnoreUser=Me ); // Bug found that after terminating my user, program stopped...

                                  1 Reply Last reply
                                  0
                                  • P PIEBALDconsult

                                    There's no such thing as a "line of code" in C-style languages.

                                    G Offline
                                    G Offline
                                    Gary Wheeler
                                    wrote on last edited by
                                    #35

                                    You mean I've spent all these years doing... nothing? :wtf:

                                    Software Zen: delete this;

                                    1 Reply Last reply
                                    0
                                    • N Nagy Vilmos

                                      An old C system I once worked on had a routine `abortOrphans()`. :laugh:

                                      veni bibi saltavi

                                      H Offline
                                      H Offline
                                      Hooga Booga
                                      wrote on last edited by
                                      #36

                                      Many years ago my team was working with an inherited system based on FoxPro. The original designer had used abbreviated table names like ASS instead of Assignment. A normally straight laced co-worker bust out laughing one day when he had to write a SQL statement "INSERT INTO ASS ..." :laugh:

                                      Outside of a dog, a book is a man's best friend; inside of a dog, it's too dark to read. -- Groucho Marx

                                      G 1 Reply Last reply
                                      0
                                      • H honey the codewitch

                                        my hubby used to work helldesk in college and he said he kept a paperclip around for rebooting the imacs and an icepick around for rebooting their users.

                                        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                        O Offline
                                        O Offline
                                        obermd
                                        wrote on last edited by
                                        #37

                                        honey the codewitch wrote:

                                        my hubby used to work helldesk in college and he said he kept a paperclip around for rebooting the imacs and an icepick around for rebooting their users.

                                        Too bad I can't use that technique.

                                        1 Reply Last reply
                                        0
                                        • N Nagy Vilmos

                                          An old C system I once worked on had a routine `abortOrphans()`. :laugh:

                                          veni bibi saltavi

                                          P Offline
                                          P Offline
                                          purplemur
                                          wrote on last edited by
                                          #38

                                          My favorite was when I was in printing, there was an old Sun Systems network printing interface that, when shutting down, declared "Killing the orbix daemon." I loved that line so much, I stole it and built a D&D adventure around it. :-D

                                          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