[thelist] Coning conventions, pet peeves

Nadeem Hosenbokus nadeem at nadeemh.com
Fri Apr 29 14:47:06 CDT 2016


I do that too! Except I put my commas the other way around:

function functionWithManyArguments(
  firstArg
  , anotherArg
  , thirdArg
  , yetAnother
)

Makes it easier to swap lines and keep track of commas.

Nadeem Hosenbokus
(230) 5766 9169
www.nadeemh.com
http://mu.linkedin.com/in/nadeemhosenbokus


-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of erik mattheis
Sent: 29 April 2016 22:07
To: thelist at lists.evolt.org
Subject: Re: [thelist] Coning conventions, pet peeves

I wouldn't mind inheriting CSS indented like that although I'm pretty sure I'd quickly ruin it and make the indentations meaningless and perhaps misleading -

ul li {
  font-family: sans
}
  ul li.alert,
  .error {
    color: red
  }

Two things I like to go against the grain on to make code more readable for myself -

var message = 'This makes it easier for me to write HTML in JS'; var mightDriveOthersCrazy = '<h1>'
  + message
  + '</h1>';

Also -

function functionWithManyArguments(
  firstArg,
  anotherArg,
  thirdArg,
  yetAnother
) {
  console.log('Any more than three arguments becomes hard to read for me unless I use line breaks between them'); }

and similarly,

$beginning_of_alphabet = [
 'a',
 'b',
 'c',
 'd',
 'e'
];



On Fri, Apr 29, 2016 at 12:46 PM, <simonmacdonald at uk2.net> wrote:

>
>
> "ul{ display: block; margin: 0 0 30px; border: solid 1px #cccccc; }
>
>      ul li{ display: block; border-bottom: solid 1px #cccccc; }
>
>          ul li:last-child{ border-bottom: none; }
>
>          ul li a{ display: block; padding 10px; color: #333333;
> text-decoration: none; }
>
>               ul li a:hover{ background-color: #cccccc; }"
>
>
>
> I use Less to compile my CSS,  so my less rules are nested under each 
> parent.  Personally,  I prefer to have my rules each on a separate line.
>
>
> ul{
>
>        display: block;
>
>         margin: 0 0 30px;
>
>         border: solid 1px #cccccc;
>
> }
>
>
> Cheers
>
> Simon
>
> Sent from my Nexus
>
>
>
>
>
>
> On Fri, Apr 29, 2016 at 4:24 AM -0700, "Nadeem Hosenbokus" < 
> nadeem at nadeemh.com> wrote:
>
>
>
>
>
> Isn't there something about Yoda Conditions catching NULL values 
> instead of transforming them into FALSE?
>
> Effectively the difference between '==' and '===' (in PHP). It's a 
> little pointless if there's a specific operator to do the same job but 
> maybe some languages don't have a specific operator?
>
> My general attitude when I come across something that looks silly is 
> to assume that the person who wrote it does actually know what they're 
> doing and did this thing for a specific reason that I have yet to discover.
>
> Whilst we're on the subject of code formatting, apparently a lot of 
> people hate 'code' like this:
>
> ul{ display: block; margin: 0 0 30px; border: solid 1px #cccccc; }
>      ul li{ display: block; border-bottom: solid 1px #cccccc; }
>          ul li:last-child{ border-bottom: none; }
>          ul li a{ display: block; padding 10px; color: #333333;
> text-decoration: none; }
>               ul li a:hover{ background-color: #cccccc; }
>
> I find that it makes understanding the hierarchy of my styles much 
> easier to understand (and I wouldn't change it) but I recently read 
> that this style of writing is abhorrent. Is it?
>
> Thanks,
>
> Nadeem Hosenbokus
> (230) 5766 9169
> www.nadeemh.com
> http://mu.linkedin.com/in/nadeemhosenbokus
>
>
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org [mailto:
> thelist-bounces at lists.evolt.org] On Behalf Of Volkan Özçelik
> Sent: 28 April 2016 23:20
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] Coning conventions, pet peeves
>
> > By putting the comparison the other way around - making sure that 
> > the
> thing to the left of the operator is not an lvalue - you make it 
> harder to make this mistake.
>
> Yup that’s the reason.
>
> Rest assured, Arabs don’t read code right to left :)
>
> You can see [1] for a detailed discussion on the subject matter.
>
> [1]: "Yoda Conditions" http://www.wikiwand.com/en/Yoda_conditions
>
> HTH,
>
> Volkan.
>
> On Thu, Apr 28, 2016 at 11:33 AM Jason Handby 
> <jason.handby at corestar.co.uk
> >
> wrote:
>
> > > By putting the comparison
> > > the other way around - making sure that the thing to the left of 
> > > the
> > operator
> > > is not an lvalue - you make it harder to make this mistake.
> >
> > ("lvalue" just means something that can legitimately go on the left 
> > of an assignment operator.)
> >
> > Jason
> >
> > --
> >
> > * * Please support the community that supports you.  * * 
> > http://evolt.org/help_support_evolt/
> >
> > For unsubscribe and other options, including the Tip Harvester and 
> > archives of thelist go to: http://lists.evolt.org Workers of the 
> > Web, evolt !
> >
> --
>
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester and 
> archives of thelist go to: http://lists.evolt.org Workers of the Web, 
> evolt !
>
> --
>
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester and 
> archives of thelist go to: http://lists.evolt.org Workers of the Web, 
> evolt !
> --
>
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester and 
> archives of thelist go to: http://lists.evolt.org Workers of the Web, 
> evolt !
>



--
Erik Mattheis

http://www.flickr.com/gelk
-- 

* * Please support the community that supports you.  * * http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 



More information about the thelist mailing list