Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualKhatharr

Posted 03 January 2013 - 11:40 PM

Take a C program "PROG" where every heap allocated variable is globally defined. This kind of application is the way programming was done in the old days, before object orientation and ADT was invented (please allow me the simplification). This PROG will be hard to maintain and inflexible when it grows. If the complete source code fits into one screen, it should still be fine. However, as many found out, when PROG grows there is point when maintenance gets unreasonable. It simply takes too much effort to do changes, with severe side effects making it hard to guarantee correctness.

Very true. It's important to know why things can be problematic rather than just that they can be problematic. This frees people to make more enlightened decisions about design because they learn the underlying problem (and how to fix it) rather than just the rule.

#1Khatharr

Posted 03 January 2013 - 11:38 PM

<blockquote class="ipsBlockquote" data-author="larspensjo" data-cid="5017031"><p>If this big PROG is packaged into one single huge class in C++, it will fulfill the requirement of not using globals. But the basic problem still remains, which is a problem of scale. Parameters in a class can be just as problematic as global parameters, if the class is too big (bloated, fat class, ...).</p></blockquote><br />Very true. It's important to know <em>why</em> things can be problematic rather than just that they <em>can be</em> problematic. This frees people to make more enlightened decisions about design because they learn the underlying problem (and how to fix it) rather than just the rule.

PARTNERS