Loading ...
Sorry, an error occurred while loading the content.

Re: KISS

Expand Messages
  • Anthony Williams
    ... int score[4]={0}; Will do the trick in C++. Anthony -- Anthony Williams Software Developer
    Message 1 of 17 , Jul 4, 2005
    • 0 Attachment
      Keith Ray <keithray@...> writes:

      > In C, C++, Java:
      >
      > int score[4] = { 0,0,0,0 };

      int score[4]={0};

      Will do the trick in C++.

      Anthony
      --
      Anthony Williams
      Software Developer
    • Kevin Wheatley
      ... well the problem I have with this is that if you switched to floating point scores this might still work, but leaves you with a problem if you find your
      Message 2 of 17 , Jul 4, 2005
      • 0 Attachment
        Ian Collins wrote:
        > Or the simplest form:
        >
        > memset( score, 0, sizeof(score) );
        >
        > Would that score high for simplicity, or low for obscurity?
        >
        > To an experienced programmer, it is clear, efficient and concise, to a
        > novice more than a little cryptic. The joys of C.

        well the problem I have with this is that if you switched to floating
        point scores this might still work, but leaves you with a problem if
        you find your self with non IEEE floats on any particular platform.
        Your making an assumption about the underlying representation in
        memory of the types. Whilst its correct most of the time its poor in
        terms of robustness.

        This would be pretty poor C++ code especially with templates (generics
        in Java) making that switch to float real easy.

        Kevin
        --
        | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this |
        | Senior Technology | My employer for certain |
        | And Network Systems Architect | Not even myself |
      • Steven J. Owens
        ... As a quick aside, I prefer clarity to simplicity. Clarity is something that is easier to point at than simplicty. Even if you can still disagree on
        Message 3 of 17 , Sep 8, 2005
        • 0 Attachment
          > Wednesday, June 29, 2005, 12:59:47 AM, Clark, David wrote:
          > > I teach an introductory programming subject to students [...]
          > > So what to use for the simplicity measure?

          As a quick aside, I prefer "clarity" to "simplicity." Clarity is
          something that is easier to point at than simplicty. Even if you can
          still disagree on whether something is clearer or not, you can at
          least discuss more usefully why or how it's clearer or not.

          My rationale is that the more clearly the programmer's intent is
          expressed in the code, the better the compiler can optimize. And
          generally the compiler's optimizations will be better than any that I
          have time/energy/smarts to add... until I measure and find that it's
          not good enough, in which case I'll do a more rigorous performance
          analysis. Add in here the usual arguments against early optimization
          and the usual advice on the right way to do optimization :-).

          On Wed, Jun 29, 2005 at 06:30:50AM -0500, Doug Swartz wrote:
          > [...]
          > Simplicity is truly in the eyes of the beholder. The only
          > reason simplicity is important, is because, unlike code written
          > for college courses, code written for industry is usually read
          > many more times than it is written. Thus it is dependent on
          > the experience, skill, and biases of the reader.
          >
          > You could look at using some of the automated complexity
          > calculation algorithms: cyclomatic, essential, .... I'm not a
          > fan of these, but they're, perhaps, better than nothing.
          >
          > Another approach is Steven's suggestion to have the students
          > rate each other's work for simplicity. It is subjective, but
          > it's a good approach because, as noted above, the goal of
          > simplicity is "in the eye of the beholder". I

          Does it have to be rated on each project? Maybe follow up each
          project with a review of a solution turned in for the previous class,
          and an examination of how the code could have been simplified and
          refactored. If you want to be brave, you could use a solution from a
          current student, but I'd be wary of the emotions & politics that could
          introduce :-).

          Or you could make it an extra credit assignment - given this
          solution to the project you last completed, what change would be the
          best way to improve the clarity of the code. Best suggestion gets
          five extra points.

          --
          Steven J. Owens
          puff@...

          "I'm going to make broad, sweeping generalizations and strong,
          declarative statements, because otherwise I'll be here all night and
          this document will be four times longer and much less fun to read.
          Take it all with a grain of salt." - http://darksleep.com/notablog
        Your message has been successfully submitted and would be delivered to recipients shortly.