Whitespace

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Whitespace

Robert Holmes
So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar[0]?
Where exactly should your block delimiters go and should they be indented?
Here's a chap who suggests bypassing whitespace debates by building the
coding style into the language: if you don't follow the style you generate a
compiler error. Might seem crazy, but I actually find it quite compelling,
particularly for projects where I'm collaborating on common code.

http://www.artima.com/weblogs/viewpost.jsp?thread=74230

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/45c7bdb4/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Stephen Guerin
my $.02 is that I have a mild preference for a third option:
        foo[0] + bar[0]

> Where exactly should your block delimiters go
> and should they be indented?

Block delimiters...why be redundant? The fact that your blocks are indented
should be enough information.  ;-)


> -----Original Message-----
> From: Robert Holmes [mailto:robert at holmesacosta.com]
> Sent: Monday, September 11, 2006 10:17 AM
> To: FRIAM
> Subject: [FRIAM] Whitespace
>
> So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or
> foo[0]+bar[0]? Where exactly should your block delimiters go
> and should they be indented? Here's a chap who suggests
> bypassing whitespace debates by building the coding style
> into the language: if you don't follow the style you generate
> a compiler error. Might seem crazy, but I actually find it
> quite compelling, particularly for projects where I'm
> collaborating on common code.
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=74230
>
> Robert
>
>



Reply | Threaded
Open this post in threaded view
|

Whitespace

Owen Densmore
Administrator
In reply to this post by Robert Holmes
Wow, I LOVE this!  I know Ken from Sun days and he's one of those  
refreshing thinkers.

We (our multimedia team at Sun) attempted a nifty stunt briefly for a  
large C++ project:  At SCCS/CVS/SVN "check-in" run the code through a  
pretty printer using a common format.  It also allowed folks to  
format in their own style, but the "official" version had a base format.

BTW: This was one of my main concerns with python: it cannot be  
pretty-printed, at least at the block level.  There is no "format"  
key in the IDEs.  Shutter!  Interestingly enough, btw, some folks  
feel that python *does* just what Ken suggests...it produces errors  
if you badly indent!!

     -- Owen

Owen Densmore   http://backspaces.net


On Sep 11, 2006, at 10:16 AM, Robert Holmes wrote:

> So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar
> [0]? Where exactly should your block delimiters go and should they  
> be indented? Here's a chap who suggests bypassing whitespace  
> debates by building the coding style into the language: if you  
> don't follow the style you generate a compiler error. Might seem  
> crazy, but I actually find it quite compelling, particularly for  
> projects where I'm collaborating on common code.
>
> http://www.artima.com/weblogs/viewpost.jsp?thread=74230
>
> Robert
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org



Reply | Threaded
Open this post in threaded view
|

Whitespace

Roger Critchlow-2
My $0.02 is that it should be irrelevant, the language should be stored as
an Abstract Syntax Tree and pretty printed into whatever whitespace
decorated format the current programmer finds most interpretible, perhaps
borrowing some formatting quirks from the principal author of the code as an
identifying tag.

Legislating programming language whitespace is certainly better than wasting
years arguing about it, but there's really no reason to be arguing about it
at all.  The only reason it comes up is because source code revision systems
are too stupid to store and compare the source code revisions, they store
and compare text file revisions and report differences in white space, and
many other nilpotent changes, as if they were source code changes.

-- rec --

On 9/11/06, Owen Densmore <owen at backspaces.net> wrote:

>
> Wow, I LOVE this!  I know Ken from Sun days and he's one of those
> refreshing thinkers.
>
> We (our multimedia team at Sun) attempted a nifty stunt briefly for a
> large C++ project:  At SCCS/CVS/SVN "check-in" run the code through a
> pretty printer using a common format.  It also allowed folks to
> format in their own style, but the "official" version had a base format.
>
> BTW: This was one of my main concerns with python: it cannot be
> pretty-printed, at least at the block level.  There is no "format"
> key in the IDEs.  Shutter!  Interestingly enough, btw, some folks
> feel that python *does* just what Ken suggests...it produces errors
> if you badly indent!!
>
>      -- Owen
>
> Owen Densmore   http://backspaces.net
>
>
> On Sep 11, 2006, at 10:16 AM, Robert Holmes wrote:
>
> > So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar
> > [0]? Where exactly should your block delimiters go and should they
> > be indented? Here's a chap who suggests bypassing whitespace
> > debates by building the coding style into the language: if you
> > don't follow the style you generate a compiler error. Might seem
> > crazy, but I actually find it quite compelling, particularly for
> > projects where I'm collaborating on common code.
> >
> > http://www.artima.com/weblogs/viewpost.jsp?thread=74230
> >
> > Robert
> > ============================================================
> > FRIAM Applied Complexity Group listserv
> > Meets Fridays 9a-11:30 at cafe at St. John's College
> > lectures, archives, unsubscribe, maps at http://www.friam.org
>
>
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/a64f6338/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Marcus G. Daniels-3
Quoting Roger Critchlow <rec at elf.org>:

> My $0.02 is that it should be irrelevant, the language should be stored as
> an Abstract Syntax Tree

New love from Microsoft:

  http://wf.netfx3.com

I found this the fastest way to understand the intent, apart from the goofy
buzzwords they use on the top level pages:

  http://wf.netfx3.com/files/folders/screencasts/default.aspx

Also relevant:

http://msdn.microsoft.com/msdnmag/issues/04/08/GeneticAlgorithms


Reply | Threaded
Open this post in threaded view
|

Whitespace

Douglas Roberts-2
Man, just when you think this world can't get any uglier...

On 9/11/06, mgd at santafe.edu <mgd at santafe.edu> wrote:

>
> New love from Microsoft:
>
>   http://wf.netfx3.com
>
>
>

--
Doug Roberts, RTI International
droberts at rti.org
doug at parrot-farm.net
505-455-7333 - Office
505-670-8195 - Cell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/78c9a787/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Marcus G. Daniels-3
Quoting Douglas Roberts <doug at parrot-farm.net>:

> >   http://wf.netfx3.com

> Man, just when you think this world can't get any uglier...

Huh, so it's ugly to provide:

1) Runtime code generation using abstract syntax trees, including cross language
translation

2) Visual programming

3) Automatic parallelism

4) Automatic persistence

??

If it helps, here's a politically correct version:

http://www.mono-project.com/Workflow

It sounds to me like a great platform for simulation and modelling.

Meanwhile, the facist-Python-formatted code can run here:

http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython

:-)




Reply | Threaded
Open this post in threaded view
|

Whitespace

Parks, Raymond
mgd at santafe.edu wrote:
...

> Huh, so it's ugly to provide:
>
> 1) Runtime code generation using abstract syntax trees, including cross
> language
> translation
>
> 2) Visual programming
>
> 3) Automatic parallelism
>
> 4) Automatic persistence
>
> ??

   ?? is exactly what I felt when I went to the netfx3.com website.
First, why do the web-pages not display properly in Firefox under Mac
OS-X?  Secondly, why is it so hard to find out that Microsoft has
re-invented flow charts?  Thirdly, where's the beef?  I found a
screenshot showing how one can make a flow chart that will use WinFX,
but nothing that talked about abstract syntax trees, cross-language
translation, automatic parallelism (does that mean  code that runs on
parallel processors or clusters or just lots of instances of the same
code?), nor automatic persistence.  I'll take your word that they're all
there, someplace, but why does Microsoft make it so hard to find it?
Are they supporting an industry of instructors to teach about
programming the Microsoft way just like they have traditionally
supported an industry of 3rd party vendors who supply the feature the OS
should have but doesn't?

   As a security guy, I find it fascinating that Microsoft is
introducing another ubiquitous set of libraries.  Not only does it
support their goal of making everything part of the OS to bolster that
anti-trust defense, but it adds yet another thing that has to be secure
to prevent intrusions.  Given their track record, I doubt these new
libraries will have any less vulnerabilities than the existing
libraries.  I realize that I will never again be able to analyze every
machine instruction in a code to be sure it cannot be exploited.  But I
don't see the point in adding more and more shims that are out of the
control of the system owner between the user and the computer.

> If it helps, here's a politically correct version:

   It didn't.  The mono version of Windows Workflow Foundations is just
as obscure as the Microsoft version.

> It sounds to me like a great platform for simulation and modelling.

   I doubt it.  WinFX is intended to run at human speed, so the
developers will have no incentive to make it efficient.  My prediction -
WinFX libraries will be bloated and slow but no-one will notice unless
they do something like simulation, where the virtual clock needs to run
faster than the wall-clock.

> Meanwhile, the facist-Python-formatted code can run here:

   Now here's something I can agree on - Python is to programming
languages like French bureaucracy is to government.

--
Ray Parks                   rcparks at sandia.gov
IDART Project Lead          Voice:505-844-4024
IORTA Department            Mobile:505-238-9359
http://www.sandia.gov/scada Fax:505-844-9641
http://www.sandia.gov/idart Pager:800-690-5288



Reply | Threaded
Open this post in threaded view
|

Whitespace

Parks, Raymond
In reply to this post by Robert Holmes
Robert Holmes wrote:
> So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar[0]?
> Where exactly should your block delimiters go and should they be
> indented? Here's a chap who suggests bypassing whitespace debates by
> building the coding style into the language: if you don't follow the
> style you generate a compiler error. Might seem crazy, but I actually
> find it quite compelling, particularly for projects where I'm
> collaborating on common code.

   Right on.  Everything should fit in 80 columns with the line number
in the first 8 spaces.  All variables should be typed by their first
letter.  Program flow should be direct, by jumping to a line number, or
calculated.

   Even better, eliminate the whole need for whitespace and simply write
the value that needs to be in each bit next to the last bit.  You don't
need whitespace to toggle code into memory.

:-)

--
Ray Parks                   rcparks at sandia.gov
IDART Project Lead          Voice:505-844-4024
IORTA Department            Mobile:505-238-9359
http://www.sandia.gov/scada Fax:505-844-9641
http://www.sandia.gov/idart Pager:800-690-5288



Reply | Threaded
Open this post in threaded view
|

Whitespace

Douglas Roberts-2
An equally reasonable alternative suggestion: write every app as an APL
one-liner (no indentation nor whitespace needed).

;-]

On 9/11/06, Raymond Parks <rcparks at sandia.gov> wrote:

>
> Robert Holmes wrote:
> > So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar[0]?
> > Where exactly should your block delimiters go and should they be
> > indented? Here's a chap who suggests bypassing whitespace debates by
> > building the coding style into the language: if you don't follow the
> > style you generate a compiler error. Might seem crazy, but I actually
> > find it quite compelling, particularly for projects where I'm
> > collaborating on common code.
>
>    Right on.  Everything should fit in 80 columns with the line number
> in the first 8 spaces.  All variables should be typed by their first
> letter.  Program flow should be direct, by jumping to a line number, or
> calculated.
>
>    Even better, eliminate the whole need for whitespace and simply write
> the value that needs to be in each bit next to the last bit.  You don't
> need whitespace to toggle code into memory.
>
> :-)
>
> --
> Ray Parks                   rcparks at sandia.gov
> IDART Project Lead          Voice:505-844-4024
> IORTA Department            Mobile:505-238-9359
> http://www.sandia.gov/scada Fax:505-844-9641
> http://www.sandia.gov/idart Pager:800-690-5288
>
>
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org
>



--
Doug Roberts, RTI International
droberts at rti.org
doug at parrot-farm.net
505-455-7333 - Office
505-670-8195 - Cell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/c1cf19cd/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Marcus G. Daniels-3
In reply to this post by Parks, Raymond
Quoting Raymond Parks <rcparks at sandia.gov>:

> > It sounds to me like a great platform for simulation and modelling.
>
>    I doubt it.  WinFX is intended to run at human speed, so the
> developers will have no incentive to make it efficient.

I could see that CodeDOM could be costly for generating runnable procedures, but
the code it generates should execute at the same speed as if you ran the C# or
C++ compiler from the command line for running on the CLR.  In certain
applications, CLR or JVM costs could be too costly but there are already plenty
of people tolerating JIT or even interpreter costs in their simulations.   And
of course it is also possible to generate native CPU instructions with Microsoft
(or Mono) compilers as well.

Here's a screencast that discusses parallelism (need to get a minute or so in
before he actually starts showing code):

http://wf.netfx3.com/files/folders/screencasts/entry4978.aspx




Reply | Threaded
Open this post in threaded view
|

Whitespace

Parks, Raymond
In reply to this post by Douglas Roberts-2
Douglas Roberts wrote:
> An equally reasonable alternative suggestion: write every app as an APL
> one-liner (no indentation nor whitespace needed).

   And it can be write-only (no reading and modifying).  Which, of
course, is why we keep trying things like WinFX - so that there's some
chance that you can pick up the code I generated two years ago and
change it.  I'm just a cynic, but sometimes I think we spend more time
and effort writing code to be reusable and modifiable than if we just
rewrote it every time we needed to change it.

--
Ray Parks                   rcparks at sandia.gov
IDART Project Lead          Voice:505-844-4024
IORTA Department            Mobile:505-238-9359
http://www.sandia.gov/scada Fax:505-844-9641
http://www.sandia.gov/idart Pager:800-690-5288



Reply | Threaded
Open this post in threaded view
|

Whitespace

Robert Holmes
... because that way we can generate a fresh set of bugs and keep ourselves
employed in perpetuity fixing them.

R

On 9/11/06, Raymond Parks <rcparks at sandia.gov> wrote:

>
> Douglas Roberts wrote:
> > An equally reasonable alternative suggestion: write every app as an APL
> > one-liner (no indentation nor whitespace needed).
>
>    And it can be write-only (no reading and modifying).  Which, of
> course, is why we keep trying things like WinFX - so that there's some
> chance that you can pick up the code I generated two years ago and
> change it.  I'm just a cynic, but sometimes I think we spend more time
> and effort writing code to be reusable and modifiable than if we just
> rewrote it every time we needed to change it.
>
> --
> Ray Parks                   rcparks at sandia.gov
> IDART Project Lead          Voice:505-844-4024
> IORTA Department            Mobile:505-238-9359
> http://www.sandia.gov/scada Fax:505-844-9641
> http://www.sandia.gov/idart Pager:800-690-5288
>
>
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/a56abb34/attachment-0001.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Douglas Roberts-2
In reply to this post by Parks, Raymond
I sometimes get sideways with people during the design phase of a project.
I'm a big believer in rapid prototyping as partial design tool, but I often
find that many people are of the "Waterfall" SW design philosophy, and can't
adjust to the concept of writing some code, and then throwing it away once
the refined design becomes more obvious.

Of course, there is always the threat that sombody will fall in love with
either the prototype or (worse) the prototyping environment and then proceed
to misuse the prototyping tool, typically by pushing it beyond it's
capabilities.  Living inside an IDE often feels like that.

--
Doug Roberts, RTI International
droberts at rti.org
doug at parrot-farm.net
505-455-7333 - Office
505-670-8195 - Cell

On 9/11/06, Raymond Parks <rcparks at sandia.gov> wrote:

>
> Douglas Roberts wrote:
> > An equally reasonable alternative suggestion: write every app as an APL
> > one-liner (no indentation nor whitespace needed).
>
>    And it can be write-only (no reading and modifying).  Which, of
> course, is why we keep trying things like WinFX - so that there's some
> chance that you can pick up the code I generated two years ago and
> change it.  I'm just a cynic, but sometimes I think we spend more time
> and effort writing code to be reusable and modifiable than if we just
> rewrote it every time we needed to change it.
>
> --
> Ray Parks                   rcparks at sandia.gov
> IDART Project Lead          Voice:505-844-4024
> IORTA Department            Mobile:505-238-9359
> http://www.sandia.gov/scada Fax:505-844-9641
> http://www.sandia.gov/idart Pager:800-690-5288
>
>
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/b1e91cf3/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Marcus G. Daniels-3
In reply to this post by Parks, Raymond
Quoting Raymond Parks <rcparks at sandia.gov>:

> I'm just a cynic, but sometimes I think we spend more time
> and effort writing code to be reusable and modifiable than if we just
> rewrote it every time we needed to change it.

For example, it isn't feasible to rewrite a multithreaded web browser layout
engine every time there is some turnover in a company.  Or rewrite a compiler.
In many applications there often isn't a smart gal to ask that can say "clearly
the answer is X, just (re)do that!"   A design can co-evolve with the code and
both can be necessarily complex and/or delicate.

But I do agree that there are banal things in this world that need to get done,
and putting people in positions of authority over them tends to result in
obscure `frameworks', `methodologies', and other forms of pointless confusion
and obsfucation.

Marcus


Reply | Threaded
Open this post in threaded view
|

Whitespace

Bill Eldridge
In reply to this post by Parks, Raymond
Raymond Parks wrote:

> Douglas Roberts wrote:
>  
>> An equally reasonable alternative suggestion: write every app as an APL
>> one-liner (no indentation nor whitespace needed).
>>    
>
>    And it can be write-only (no reading and modifying).  Which, of
> course, is why we keep trying things like WinFX - so that there's some
> chance that you can pick up the code I generated two years ago and
> change it.
>  
http://webpages.charter.net/edreamleo/front.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/friam_redfish.com/attachments/20060911/0ba848cc/attachment.html

Reply | Threaded
Open this post in threaded view
|

Whitespace

Giles Bowkett
In reply to this post by Owen Densmore
For what it's worth, I'm of the opinion a project should have a
clearly articulated style guide which code must conform to before
being checked in.

I like the idea of automating it, but I'm tempted to think imposing
the mental discipline and cultural norm on the team might be a better
approach. That way you're not stuck back at square one if you need to
collaborate on a particular piece of code (I like pair programming for
some things).

On 9/11/06, Owen Densmore <owen at backspaces.net> wrote:

> Wow, I LOVE this!  I know Ken from Sun days and he's one of those
> refreshing thinkers.
>
> We (our multimedia team at Sun) attempted a nifty stunt briefly for a
> large C++ project:  At SCCS/CVS/SVN "check-in" run the code through a
> pretty printer using a common format.  It also allowed folks to
> format in their own style, but the "official" version had a base format.
>
> BTW: This was one of my main concerns with python: it cannot be
> pretty-printed, at least at the block level.  There is no "format"
> key in the IDEs.  Shutter!  Interestingly enough, btw, some folks
> feel that python *does* just what Ken suggests...it produces errors
> if you badly indent!!
>
>      -- Owen
>
> Owen Densmore   http://backspaces.net
>
>
> On Sep 11, 2006, at 10:16 AM, Robert Holmes wrote:
>
> > So which is "better" coding style, foo[ 0 ] + bar[ 0 ] or foo[0]+bar
> > [0]? Where exactly should your block delimiters go and should they
> > be indented? Here's a chap who suggests bypassing whitespace
> > debates by building the coding style into the language: if you
> > don't follow the style you generate a compiler error. Might seem
> > crazy, but I actually find it quite compelling, particularly for
> > projects where I'm collaborating on common code.
> >
> > http://www.artima.com/weblogs/viewpost.jsp?thread=74230
> >
> > Robert
> > ============================================================
> > FRIAM Applied Complexity Group listserv
> > Meets Fridays 9a-11:30 at cafe at St. John's College
> > lectures, archives, unsubscribe, maps at http://www.friam.org
>
>
> ============================================================
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> lectures, archives, unsubscribe, maps at http://www.friam.org
>


--
Giles Bowkett
http://www.gilesgoatboy.org