[stats-dev] Formatting

Benjamin Gavin virtual_olympus at yahoo.com
Sat Sep 13 15:20:40 EDT 2003


  I for one am 100% against using TABs in general.  So, if we agree on 4
spaces and your editor of choice converts a TAB into 4 spaces then I don't
have a problem with it, but there's that annoys me more than dealing with
a bunch of code where there are tabs all over the place.  This is
especially true after a few people have touched the code and person x's
editor inserts TABs and person y's editor inserts spaces.  Then when
person x opens the file and their tab settings are slightly different
(i.e. 2/3 rather than 4/6 spaces) the formatting is an absolute nightmare.

  In either case, I'm willing to give up the pretty formatting on the SQL
statements, but it just doesn't seem like lining them up takes so much
time as to be an annoyance.  Of all the code for participants/teams
there's only something on the order of 10-12 SQL statements, I hardly
think maintaining those in a nicely formatted manner is going to break
anyone.  Of course, I'm probably the minority there. :p

Ben

--- "Jim C. Nasby" <decibel at distributed.net> wrote:
> On Thu, Sep 11, 2003 at 10:54:57AM -0700, Benjamin Gavin wrote:
> > Well a large bit of the 2-space indentation comes from me :)  I could
> care
> > less what format we use, but it needs to be easy to do in vi. ;)
> 
> OK, let's go with 4 then since it's easier to read in.
> 
> > As far as SQL formatting goes, I fail to see how either of the two
> > examples you gave are any harder than the other...  Personally I would
> > vote for the version that's easier to read (and because that's the
> > standard I tend to use), but again, I could really care less since
> they
> > are both equally difficult (or easy) to code.
>  
> The first example is *much* easier to code, because every line begins at
> a tabstop. To do the second format you have to line everything up by
> hand.
> 
> Since it might not be obvious, the formatting for the first is 2 tabs
> for extended select list, 1 tab for FROM/WHERE/GROUP BY/ORDER BY/etc.,
> and 2 tabs for extended WHERE clause.
> 
> As for using a tool, I'm fine with that so long as it doesn't produce
> code that's ugly or is hard to work with.
> 
> > Ben (TheJet)
> > 
> > --- "Jim C. Nasby" <decibel at distributed.net> wrote:
> > > Now that we have a shiny-new codebase, I'd like to standardize on
> some
> > > formatting. I'm not suggesting a big clean-up of the formatting at
> this
> > > point, but we should at least standardize going forward. Right now,
> the
> > > PHP seems to be a mix of 2 space and 4 space indentation. I think
> the 2
> > > space code might be a holdover from the old codebase, but I'm not
> sure.
> > > Also, there are sections of code that aren't indented to a proper
> > > boundary at all; these should be cleaned up relatively soon ihmo.
> > > 
> > > Generally, we don't seem to have a lot of indentation levels, so I'd
> > > personally prefer 4 space.
> > > 
> > > For query strings, I generally do this:
> > > 
> > > SELECT blah blah
> > >         blah
> > >     FROM table
> > >     WHERE
> > >         AND
> > > 
> > > and not this:
> > > 
> > > SELECT blah blah
> > >        blah
> > >   FROM table
> > >  WHERE blah
> > >    AND blah
> > > 
> > > The second form might be slightly easier to read, but I don't think
> it's
> > > worth the added hassle.
> > > -- 
> > > Jim C. Nasby, Database Consultant                  jim at nasby.net
> > > Member: Triangle Fraternity, Sports Car Club of America
> > > Give your computer some brain candy! www.distributed.net Team #1828
> > > 
> > > Windows: "Where do you want to go today?"
> > > Linux: "Where do you want to go tomorrow?"
> > > FreeBSD: "Are you guys coming, or what?"
> > > _______________________________________________
> > > stats-dev mailing list
> > > stats-dev at lists.distributed.net
> > > http://lists.distributed.net/mailman/listinfo/stats-dev
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> > _______________________________________________
> > stats-dev mailing list
> > stats-dev at lists.distributed.net
> > http://lists.distributed.net/mailman/listinfo/stats-dev
> > 
> 
> -- 
> Jim C. Nasby, Database Consultant                  jim at nasby.net
> Member: Triangle Fraternity, Sports Car Club of America
> Give your computer some brain candy! www.distributed.net Team #1828
> 
> Windows: "Where do you want to go today?"
> Linux: "Where do you want to go tomorrow?"
> FreeBSD: "Are you guys coming, or what?"
> _______________________________________________
> stats-dev mailing list
> stats-dev at lists.distributed.net
> http://lists.distributed.net/mailman/listinfo/stats-dev


=====
/******************************/
Benjamin Gavin
virtual.olympus software
ben at virtual-olympus.com
http://www.virtual-olympus.com/
/******************************/

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


More information about the stats-dev mailing list