OT: This Swift thing

Chris Angelico rosuav at gmail.com
Wed Jun 4 11:26:15 EDT 2014


On Thu, Jun 5, 2014 at 1:00 AM, Michael Torrie <torriem at gmail.com> wrote:
> Do programmers not psuedo-code on paper or white boards anymore?

I pseudocode in a text editor, these days. Sometimes that pseudocode
gets reworked into code; more often it becomes comments that precede
the code (which may or may not get dropped once the code's working).

"Executable pseudo-code" is all very well as a concept, but there's an
awful lot that I can write down that doesn't run as Python. For
instance, Python stubbornly insists that assignment be written like
this:

x = expression

and flat out refuses to accept this:

4*x*x + 3*x + y + 50 = (x*y + z) * (x + z)

I mean honestly. I've translated all the mathematical notation into
programming style (asterisks for multiplication, etc). Why can't
Python take the values for y and z and give me back a value for x?

But seriously, this is the sort of thing that will most likely end up
as a comment, followed by the solved-for-x version (which will quite
possibly not be a single line of code, with something this complicated
- especially as there could be multiple solutions or no solutions).
And that transformation isn't really much easier in Python than any
other language with similar mathematical facilities (I used to do this
sort of thing in REXX back in the 90s). For the basic structure of the
code (which is where Python *does* look more like pseudo-code), I tend
to write actual code straight away; in a good editor, you can write
C/Java/Pike/etc code with auto indentation if you put in your braces,
so there's no advantage to leaving them off (as there would be on a
whiteboard).

Have we lost something by not working on whiteboards? I don't think
so. In fact, we've gained a lot, because I can pull up an editor,
share my screen with someone, and show my work directly as it happens.
A whiteboard allows that only if the two people are physically sharing
a room.

ChrisA



More information about the Python-list mailing list