News for hackers. Stuff that matters.
Re:Why is estimating so hard? by Wilduck on Monday April 23, 2012 @07:05PM (#3881460)
No implementations yet? This took me about 12 minutes and 10 lines of python code:

  def break_13(text):
       words = text.split()
       lines = [[]]
       for word in words:
           last_line = sum(len(word) for word in lines[-1])
           if (last_line + len(word) + len(lines[-1])) > 13:
               lines.append([word])
           else:
               lines[-1].append(word)
       return '\n'.join(' '.join(line) for line in lines)
I like the larger point of this article, which basically states that the way humans do tasks is different than how we should instruct computers to do tasks. However, to me this point is undermined by the description of writing a procedure near the end:

> If you are good at abstracting, you’ll likely come up with three different scenarios for breaking a line. 1. you break it at the 10th character of a word if that word is longer than 10 characters. 2. You break it at the 11th character if that character is a space. 3. You look backwards from the 10th character looking for a space and if there is one, you break it there.

I think it is less valuable to break down your procedure into smaller pieces before given an estimate, and more valuable to have a good knowledge of what sorts of problems are hard and why they're hard. That way, you don't have to resort to glib phrases like "Write down a procedure to tie your shoes".

Re:Why is estimating so hard? by thangalin on Monday April 23, 2012 @10:10PM (#3882085)
This solution does not meet the maximum 8" length requirement. The code produced the following PDF:

http://www.mediafire.com/view/?47t49w2h4pxa6d1

Even if you shrank the font, decreased the margins, and removed the 1" marker, the text would still exceed the maximum length of 8 inches.

Web page for printing: http://pastebin.com/DLR5cGss

Re:Why is estimating so hard? by gvb on Monday April 23, 2012 @07:09PM (#3881475)
I did it in seconds, but I cheated.

fmt --width=13 <gettysburg.txt

Re:Why is estimating so hard? by thangalin on Monday April 23, 2012 @07:33PM (#3881590)
Your solution is quick, but it will not work.

lynx --dump http://morphadorner.northwestern.edu/morphadorner/techtalk/s... | fmt --width=13

This fails due to sub-optimal formatting:

    But, in
    a larger
    sense,
Remember the physical constraint of 1.5" x 8". The fmt output exceeds the bookmark's physical length. Those three lines can be written as two:

    But, in a
    larger sense,
fmt produces a much lengthier script than would fit on the physical bookmark.
Re:Why is estimating so hard? by gvb on Monday April 23, 2012 @07:55PM (#3881658)
You're right, I had a bug in my code.

   fmt --width=14 <gettysburg.txt
The copy of the Gettysburg address I grabbed off Wikipedia has "mdashes" in it (unicode characters). That messes up my wrapping too because fmt counts them as two bytes even though they are one character.

   diff y z
   101,104c101,103
   < us—that
   < from these
   < honored dead
   < we take
   ---
   > us-that from
   > these honored
   > dead we take
(the others were not material).
Re:Why is estimating so hard? by thangalin on Monday April 23, 2012 @09:24PM (#3881954)
Ensuring quality of data counts as time required to complete the project. Also, fmt does not produce an optimally short solution for an 8" long bookmark. For example, using your fmt statement on http://pastebin.com/RxWd11bU produces:

    on a great
    battle-field
    of that 
    war. We
    have come to
    dedicate a
    portion of
Versus hand-written:

    on a great
    battle-field
    of that war. 
    We have come 
    to dedicate a
    portion of
You'll have to do better than 128 lines, I think, to fit the length requirement. And this was really the author's point. Had you estimated a solution that'd take a few seconds to code using fmt, your estimate would be blown away by reality. Not only would have gone down a rabbit hole (which actually happens quite a lot in software development), but you'd still not have a working solution.
Re:Why is estimating so hard? by redthrowaway on Monday April 23, 2012 @07:20PM (#3881523)
You cheated, yes, but yours is also the only sane solution, and the only one you would consider using in the real world where time spent developing has an opportunity cost.
Re:Why is estimating so hard? by thangalin on Monday April 23, 2012 @10:20PM (#3882115)
It is not a viable solution; it will not print within 8" because it produces a result that is too long.