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. Some more pain (the non-local local)

Some more pain (the non-local local)

Scheduled Pinned Locked Moved The Weird and The Wonderful
phpvisual-studiocomregexquestion
4 Posts 3 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

    This anti-pattern is scattered all over the place.

    bool bStandardMandatory = false;
    bool CheckStandardMandatory()
    {
    if (cbReportDefinitions.SelectedItem != null)
    {
    var rep = cbReportDefinitions.SelectedItem;
    bStandardMandatory = _presenter.Controller.CheckMandatory(rep, "Standard");
    return bStandardMandatory;
    }
    return false;
    }

    The only other place that touches bStandardMandatory :

    bStandardMandatory = CheckStandardMandatory();

    :doh: Please tell me who teaches this stuff to people? Can I cry now? :((

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

    B B 2 Replies Last reply
    0
    • L leppie

      This anti-pattern is scattered all over the place.

      bool bStandardMandatory = false;
      bool CheckStandardMandatory()
      {
      if (cbReportDefinitions.SelectedItem != null)
      {
      var rep = cbReportDefinitions.SelectedItem;
      bStandardMandatory = _presenter.Controller.CheckMandatory(rep, "Standard");
      return bStandardMandatory;
      }
      return false;
      }

      The only other place that touches bStandardMandatory :

      bStandardMandatory = CheckStandardMandatory();

      :doh: Please tell me who teaches this stuff to people? Can I cry now? :((

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

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      What about the implementation in _presenter.Controller? Is it:

      bool bMandatory = false;
      bool CheckMandatory()
      {
      if (someCondition)
      {
      ...;
      bMandatory = _someMember.CheckMandatory(..., "Standard");
      return bMandatory;
      }
      return false;
      }

      with only one other place that touches bMandatory:

      bMandatory = CheckMandatory();

      L 1 Reply Last reply
      0
      • B Bernhard Hiller

        What about the implementation in _presenter.Controller? Is it:

        bool bMandatory = false;
        bool CheckMandatory()
        {
        if (someCondition)
        {
        ...;
        bMandatory = _someMember.CheckMandatory(..., "Standard");
        return bMandatory;
        }
        return false;
        }

        with only one other place that touches bMandatory:

        bMandatory = CheckMandatory();

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

        Bernhard Hiller wrote:

        What about the implementation in _presenter.Controller?

        Quite possible, but now I am too scared to look! :^) Edit: Not quite as bad (but 99% there)!

        bool bStandardMandatory = false;

        internal bool CheckMandatory(object rep, string entityname)
        {
        return bStandardMandatory = ReportConfigurationService.CheckMandatory(DataContext.DataContext, rep, entityname);
        }

        With nothing else touching bStandardMandatory... :omg: I guess now you want to know what that one's implementation looks like? :) Edit 2: I had to ask... well here it is.

        public bool CheckMandatory(dboDataContext datacontext, object rpt, string entityname)
        {
        return ReportInterface.CheckMandatory(datacontext, rpt, entityname);
        }

        At least no useless non-local local here. I wonder how it goes on... Edit 3: Finally we have some code at that destination!

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

        modified on Monday, October 18, 2010 2:56 AM

        1 Reply Last reply
        0
        • L leppie

          This anti-pattern is scattered all over the place.

          bool bStandardMandatory = false;
          bool CheckStandardMandatory()
          {
          if (cbReportDefinitions.SelectedItem != null)
          {
          var rep = cbReportDefinitions.SelectedItem;
          bStandardMandatory = _presenter.Controller.CheckMandatory(rep, "Standard");
          return bStandardMandatory;
          }
          return false;
          }

          The only other place that touches bStandardMandatory :

          bStandardMandatory = CheckStandardMandatory();

          :doh: Please tell me who teaches this stuff to people? Can I cry now? :((

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

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

          I don't know who their teacher was, but I have worked with several folk who must have and the same teacher! :laugh:

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

          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