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. Other Discussions
  3. The Weird and The Wonderful
  4. I just got greeted by this

I just got greeted by this

Scheduled Pinned Locked Moved The Weird and The Wonderful
phpvisual-studiocomquestion
10 Posts 7 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.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1
    private bool ContainsFilename(string reportfilename, string rdlcfilename)
    {
      return ((reportfilename.Contains(rdlcfilename)) ? true : false);
    }
    

    :doh: Today is gonna be a long day...

    xacc.ide
    IronScheme - 1.0 RC 1 - out now!
    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

    J K L 3 Replies Last reply
    0
    • L leppie
      private bool ContainsFilename(string reportfilename, string rdlcfilename)
      {
        return ((reportfilename.Contains(rdlcfilename)) ? true : false);
      }
      

      :doh: Today is gonna be a long day...

      xacc.ide
      IronScheme - 1.0 RC 1 - out now!
      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

      J Offline
      J Offline
      Jeroen De Dauw
      wrote on last edited by
      #2

      O_o! Just returning the value without casting it to boolean first! Definitely a horror!

      Jeroen De Dauw
      Blog ; Wiki

      L 1 Reply Last reply
      0
      • J Jeroen De Dauw

        O_o! Just returning the value without casting it to boolean first! Definitely a horror!

        Jeroen De Dauw
        Blog ; Wiki

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Jeroen De Dauw wrote:

        Just returning the value without casting it to boolean first! Definitely a horror!

        That's the minor part :( The person should just be calling string.Contains(). Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.

        xacc.ide
        IronScheme - 1.0 RC 1 - out now!
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

        R J 2 Replies Last reply
        0
        • L leppie

          Jeroen De Dauw wrote:

          Just returning the value without casting it to boolean first! Definitely a horror!

          That's the minor part :( The person should just be calling string.Contains(). Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.

          xacc.ide
          IronScheme - 1.0 RC 1 - out now!
          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

          R Offline
          R Offline
          Richard A Dalton
          wrote on last edited by
          #4

          leppie wrote:

          Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.

          Yeah, I hate working with superior programmers who write stuff like this that they can understand, but I can't. I still remember with awe the greatest programmer I ever worked with. Functions were hundreds of lines long, at his best he could write functions that were thousands of lines long. I would just gaze at it like a dog that's just seen a card trick, but he would roll up his sleeves and fix problems all day long. Not a try or a catch to be seen. Why would he need them? Only losers hit exceptions. Yeah, he was a fricken genius. -Rd

          Hit any user to continue.

          B 1 Reply Last reply
          0
          • R Richard A Dalton

            leppie wrote:

            Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.

            Yeah, I hate working with superior programmers who write stuff like this that they can understand, but I can't. I still remember with awe the greatest programmer I ever worked with. Functions were hundreds of lines long, at his best he could write functions that were thousands of lines long. I would just gaze at it like a dog that's just seen a card trick, but he would roll up his sleeves and fix problems all day long. Not a try or a catch to be seen. Why would he need them? Only losers hit exceptions. Yeah, he was a fricken genius. -Rd

            Hit any user to continue.

            B Offline
            B Offline
            BillW33
            wrote on last edited by
            #5

            Yeah, I have worked with several programmers like that. They usually impress management because they are so "productive". They create very large amounts of code. Code that is not robust, very difficult to maintain and contains hard to find bugs, but those things are not important after all. :sigh:

            Just because the code works, it doesn't mean that it is good code.

            1 Reply Last reply
            0
            • L leppie
              private bool ContainsFilename(string reportfilename, string rdlcfilename)
              {
                return ((reportfilename.Contains(rdlcfilename)) ? true : false);
              }
              

              :doh: Today is gonna be a long day...

              xacc.ide
              IronScheme - 1.0 RC 1 - out now!
              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

              K Offline
              K Offline
              Keith Barrow
              wrote on last edited by
              #6

              I can't see the problem, logically it works: if the reportfilename Contains rdlcfilename is true, return true, otherwise return false :Laugh: Truly awful. If I'm honest, I've written a few functions like this, but only in the middle of a protracted refactoring session in the middle of the night. Next morning such functions do tend to "disappear" before other people see them :-).

              Sort of a cross between Lawrence of Arabia and Dilbert.[^]

              1 Reply Last reply
              0
              • L leppie

                Jeroen De Dauw wrote:

                Just returning the value without casting it to boolean first! Definitely a horror!

                That's the minor part :( The person should just be calling string.Contains(). Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.

                xacc.ide
                IronScheme - 1.0 RC 1 - out now!
                ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                J Offline
                J Offline
                Jeroen De Dauw
                wrote on last edited by
                #7

                Apologies, apparently I forgot to include my sarcasm sign.

                Jeroen De Dauw
                Blog ; Wiki

                1 Reply Last reply
                0
                • L leppie
                  private bool ContainsFilename(string reportfilename, string rdlcfilename)
                  {
                    return ((reportfilename.Contains(rdlcfilename)) ? true : false);
                  }
                  

                  :doh: Today is gonna be a long day...

                  xacc.ide
                  IronScheme - 1.0 RC 1 - out now!
                  ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

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

                  If you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)

                  private bool ContainsFilename(string reportfilename, string rdlcfilename)
                  {
                  bool result;
                  if(reportfilename.Contains(rdlcfilename))
                  result = true;

                   if(!reportfilename.Contains(rdlcfilename))
                          result = false;
                   return result;
                  

                  }

                  Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\

                  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.

                  F L 2 Replies Last reply
                  0
                  • L Lost User

                    If you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)

                    private bool ContainsFilename(string reportfilename, string rdlcfilename)
                    {
                    bool result;
                    if(reportfilename.Contains(rdlcfilename))
                    result = true;

                     if(!reportfilename.Contains(rdlcfilename))
                            result = false;
                     return result;
                    

                    }

                    Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\

                    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.

                    F Offline
                    F Offline
                    fjdiewornncalwe
                    wrote on last edited by
                    #9

                    But only to management.

                    I wasn't, now I am, then I won't be anymore.

                    1 Reply Last reply
                    0
                    • L Lost User

                      If you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)

                      private bool ContainsFilename(string reportfilename, string rdlcfilename)
                      {
                      bool result;
                      if(reportfilename.Contains(rdlcfilename))
                      result = true;

                       if(!reportfilename.Contains(rdlcfilename))
                              result = false;
                       return result;
                      

                      }

                      Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\

                      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.

                      L Offline
                      L Offline
                      leppie
                      wrote on last edited by
                      #10

                      You clearly forgot to litter the methods with Debug.Assert statements. Eg:

                      result = true;
                      Debug.Assert(result == true);

                      You have to remember being very wary of the compiler, it has a mind of its own.

                      xacc.ide
                      IronScheme - 1.0 RC 1 - out now!
                      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

                      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