Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23980

Re: Program logic weirdness?

From Tim Streater <timstreater@greenbee.net>
Newsgroups comp.lang.javascript
Subject Re: Program logic weirdness?
Date 2014-04-27 18:30 +0100
Message-ID <270420141830040121%timstreater@greenbee.net> (permalink)
References (3 earlier) <f4a2b34c-d7b7-4974-a6f6-1582ce0045ff@googlegroups.com> <0.6fc64329016b6998cc1a.20140426223412BST.87a9b76ai3.fsf@bsb.me.uk> <2f7c3181-f823-4cbf-9f86-c3d43e96f5cf@googlegroups.com> <270420141320426439%timstreater@greenbee.net> <d38432b8-8e55-4cb1-8fa3-5281d18c89e6@googlegroups.com>

Show all headers | View raw


In article <d38432b8-8e55-4cb1-8fa3-5281d18c89e6@googlegroups.com>,
<jonas.thornvall@gmail.com> wrote:

> In this case it is not dependent upon the loop counter, but it really isn't
> the issue.
> 
> The issue is.
> 
> You are printing one million of pages, paper or screen doesn't matter.
> Depending on the date some stuff will be printed,  each holiday and weekend
> there is things that will be printed. But on ordinary weekdays these will
> not.
> 
> The thing is the newspaper it printed everyday in 200 000 copies, you do not
> want to check for each newspaper in loop what date it is would you?

In which case I'd check the day of the week first and have a separate
section of code for the *major* conditions. Sounds like you might have
several different such sections, maybe 7 or 8.

> In my case i have an array multidimensional array (object?) with properties
> that are set before i print in loop but some properties will only be printed,
> if they are bigger then a certain size. Because it does not make sense print
> things that aren't readable... But you you can see the colors specks...

Then you build your image to be printed (different depending on the
date) just once, and you print the same image 200,000 times. You might
have a different function (that you call once) to build the image. It's
not actually necessary to have these functions but it makes the code
more modular and easier to understand. I could imagine that each of
these functions might be quite big, but there will be separate sections
of code that can also be put into functions that will reduce the
overall size.

If you have a clear idea in your head of the process then you can
design the structure more easily and break the problem down into
smaller parts.

-- 
"People don't buy Microsoft for quality, they buy it for compatibility
with what Bob in accounting bought last year. Trace it back - they buy
Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 22:53 -0700
  Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 22:57 -0700
    Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-26 12:35 +0100
      Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 07:59 -0700
        Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:11 -0700
        Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-26 22:34 +0100
          Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 00:44 -0700
            Re: Program logic weirdness? Tim Streater <timstreater@greenbee.net> - 2014-04-27 13:20 +0100
              Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 06:09 -0700
                Re: Program logic weirdness? Tim Streater <timstreater@greenbee.net> - 2014-04-27 18:30 +0100
                Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 12:13 -0700
                Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-28 02:33 -0700
              Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 06:25 -0700
              Re: Program logic weirdness? Denis McMahon <denismfmcmahon@gmail.com> - 2014-04-27 14:55 +0000
            Re: Program logic weirdness? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-04-27 15:41 +0100
              Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-27 13:57 -0700
  Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 23:18 -0700
  Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-25 23:23 -0700
  Re: Program logic weirdness? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-04-26 15:06 +0200
    Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:00 -0700
    Re: Program logic weirdness? jonas.thornvall@gmail.com - 2014-04-26 08:06 -0700

csiph-web