Coding style -- we've never really discussed it

107 views
Skip to first unread message

Jeremy D. Miller

unread,
Jan 6, 2012, 6:19:02 PM1/6/12
to FubuMVC Develop
Folks,

We've never really had a conversation about coding style in the fubu projects.  The prevailing style is (the arbitrary C# style that I adopted years ago at ThoughtWorks):

* public members are Pascal cased
* anything non-public (private, internal, protected) is camel cased
* fields are prefaced with _'s -- except in unit tests.  I like the "theSomething" convention that I picked up from an old TW colleage 
* Use {} on all if/then statements unless it's all one line like "if (something) return;"
* Mostly use the "I" nomenclature for interfaces because everyone understands it

Do we care?  I know it's all arbitrary and consistency is all that's important.  

And just so you know, I'm feeling like this guy for even writing this post:  http://www.nbc.com/saturday-night-live/video/cooking-with-the-anal-rententive-chef/2867/



What's not negotiable, and I think we all do decent job of this anyway:

* Favor composition over inheritance when you can
* Small classes & methods with cohesive responsibilities (all that SOLID mumbo jumbo, and not because "of fear of CodeBetter guys," but because it makes things work out better in the long run)




Jeremy D. Miller
The Shade Tree Developer
jeremy...@yahoo.com

Chad Myers

unread,
Jan 6, 2012, 6:22:29 PM1/6/12
to fubumv...@googlegroups.com
+1. I twitch a little at the inconsistency of _ and no_ in tests, but it's all style and taste and there's no accounting for taste, so it might as well be that or anything.

-Chad

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.

Dru Sellers

unread,
Jan 6, 2012, 6:33:02 PM1/6/12
to fubumv...@googlegroups.com
I prefer leaving 'private' keyword off of private items as that is the default for fields and methods. 

-d

Ian Battersby

unread,
Jan 6, 2012, 6:45:20 PM1/6/12
to fubumv...@googlegroups.com
I prefer 100% explicitness and consistency, I'm afraid I even turn on StyleCop naming conventions (only) to enforce this - test assemblies too.

.. and yes that even means putting "internal" on a console app ;)

PS. Just my two-penniesworth, I already follow the existing convention of any OSS projects in pull requests.

PPS. I was once labelled "StyleNazi" by a colleague of notable ranting reputation :p

Adam Dymitruk

unread,
Jan 6, 2012, 8:15:38 PM1/6/12
to fubumv...@googlegroups.com
Why not adopt what a large code base that is C# has? Project mono
comes to mind...

--
Adam

http://adventuresinagile.blogspot.com/
http://twitter.com/adymitruk/
http://www.agilevancouver.ca/
http://altnetvan.grou.ps/

ahjohannessen

unread,
Jan 7, 2012, 9:19:14 AM1/7/12
to fubumv...@googlegroups.com
I like all of those and have tried to follow your style to my best.

One thing I like as well is when doing expressions like this:

blah.Each(p =>
{
    // more than one line
});

I prefer having the { vertically aligned with whatever started the expression instead of having it like this:

chuck.Each(p => 
                        {
                            // code
                        });


A minor OCD thing :D

Corey Kaylor

unread,
Jan 7, 2012, 9:21:41 AM1/7/12
to fubumv...@googlegroups.com
My preference is the opposite on that one.

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fubumvc-devel/-/Mxh0J0_19EcJ.

Ian Battersby

unread,
Jan 7, 2012, 9:24:51 AM1/7/12
to fubumv...@googlegroups.com
+1, LOL ;-)

Chad Myers

unread,
Jan 7, 2012, 10:01:35 AM1/7/12
to fubumv...@googlegroups.com

I don't care either way as long as it is consistent.

Is there a way to have solution-wide formatting settings with vs and/or R# so that this happens automatically and we don't have to think about it?

Josh Arnold

unread,
Jan 7, 2012, 11:31:35 AM1/7/12
to fubumv...@googlegroups.com
I'm with Corey on this one. Sorry, Alex :p

Sent from my iPad

ahjohannessen

unread,
Jan 7, 2012, 12:13:23 PM1/7/12
to fubumv...@googlegroups.com
:p Dru, JDM, heeelp :D

ahjohannessen

unread,
Jan 7, 2012, 12:27:23 PM1/7/12
to fubumv...@googlegroups.com
I bet Josh and Corey have huge monitors :p

Corey Kaylor

unread,
Jan 7, 2012, 12:49:37 PM1/7/12
to fubumv...@googlegroups.com
3 of them yes

On Sat, Jan 7, 2012 at 10:27 AM, ahjohannessen <ahjoha...@gmail.com> wrote:
I bet Josh and Corey have huge monitors :p

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/fubumvc-devel/-/VvRwEhsBMoAJ.

Ian Battersby

unread,
Jan 7, 2012, 1:55:21 PM1/7/12
to fubumv...@googlegroups.com
The only solution I know of that would work for me also (CR user) is StyleCop; happy to pass on the StyleCop config file we use for test assemblies as it disables all but naming conventions.

Joshua Arnold

unread,
Jan 7, 2012, 2:34:44 PM1/7/12
to fubumv...@googlegroups.com
I'm gonna flip a 180 on you and say that I agree with Alex. I read his msg on my phone and misunderstood him. I like the braces left aligned

Corey Kaylor

unread,
Jan 7, 2012, 2:45:11 PM1/7/12
to fubumv...@googlegroups.com
Ha, ditto. I was a bit confused on the monitors comment, but thought I would run with it anyways.

Adam Dymitruk

unread,
Jan 8, 2012, 3:29:41 PM1/8/12
to fubumv...@googlegroups.com
Braces alone on a line suck. Less context in patches, bad boundaries
for conflicts, etc.

We have resharper and other tools to tell us what our scope is and
indentation alone is just fine. This is one of the reasons that K&R is
used on a big project like mono.

We've been brainwashed by the crap standard that Microsoft gave us in
MSDN over the last 10+ years for C#.

In addition, I can't stand this:

public property Something
{
get
{
return _something;
}
set
{
_something = value;
}
}

really?? 12 lines to do what??

If it's doing nothing, give it the right amount space:

public property Something { get { return _something; } set {
_something = value; } }

one line.

I understand the position of "it's my preference" and all that. We
just have to dig a bit to see why "it's your preference".. maybe it's
just the amount of time I spent in C/C++.. I always thought of B&D as
wasteful and inefficient after using it for a few years.

</rant>

--

Rob Ashton

unread,
Jan 8, 2012, 3:37:52 PM1/8/12
to fubumv...@googlegroups.com
I don't think most of this stuff really matters - I think the biggest indicators should be "Can it be read and does it loosely conform to the general principles of the rest of the project" - stopping at what you use underscores to represent (or not) and casing for method and variables is probably the most sane thing you can do.

"And just so you know, I'm feeling like this guy for even writing this post:"

And so you should! I think if you ask a community what coding guidelines will be you'll find 1000000 opinions on 10000 different little nitpicks that different people have (even a small community like this), and you'll come up with a committee-designed document that scares new people away from contributing ;-)

Is anything broken right now? You guys having a hard time dealing with the standards in the code being submitted to Fubu? I haven't seen m(any) posts on the subject, so I don't know what you're trying to achieve by starting this discussion ;-)

(Sorry, I read the mailing list regularly even though I'm a complete Javascript obsessee these days - I wouldn't have replied if Ian hadn't mentioned me above ;-))

Regards,

Rob

Adam Dymitruk

unread,
Jan 8, 2012, 4:53:46 PM1/8/12
to fubumv...@googlegroups.com
Conflicts are directly affected by the number of lines in context.
Most deal with empty lines properly. So yes, it does matter to a
certain extent.

Mike O'Brien

unread,
Jan 8, 2012, 5:25:10 PM1/8/12
to fubumv...@googlegroups.com
I agree with Rob that style and conventions should just flow from whats already out there. Outside of that, any color will do for the bike shed.

Adam Dymitruk

unread,
Jan 9, 2012, 12:23:29 AM1/9/12
to fubumv...@googlegroups.com
Looks like Jeremy's question has been "Bike Shedded". We can now move
on to important topics.

Jeremy D. Miller

unread,
Jan 9, 2012, 8:42:01 AM1/9/12
to fubumv...@googlegroups.com
Hey, all I wanted to know was did anyone care.  All I saw was a whole bunch of "it's fine, I don't care"

Good enough for me.





From: Adam Dymitruk <ad...@dymitruk.com>
To: fubumv...@googlegroups.com
Sent: Sun, January 8, 2012 11:23:29 PM
Subject: Re: [fubumvc] Coding style -- we've never really discussed it
>>> >> >> fubumvc-devel+unsub...@googlegroups.com.

>>> >> >> For more options, visit this group at
>>> >> >> http://groups.google.com/group/fubumvc-devel?hl=en.
>>> >> >
>>> >> > --
>>> >> > You received this message because you are subscribed to the Google
>>> >> > Groups "FubuMVC Development Group" group.
>>> >> > To post to this group, send email to fubumv...@googlegroups.com.
>>> >> > To unsubscribe from this group, send email to
>>> >> > fubumvc-devel+unsub...@googlegroups.com.

>>> >> > For more options, visit this group at
>>> >> > http://groups.google.com/group/fubumvc-devel?hl=en.
>>> >> >
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "FubuMVC Development Group" group.
>>> >> To post to this group, send email to fubumv...@googlegroups.com.
>>> >> To unsubscribe from this group, send email to
>>> >> fubumvc-devel+unsub...@googlegroups.com.

>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/fubumvc-devel?hl=en.
>>> >
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "FubuMVC Development Group" group.
>>> > To post to this group, send email to fubumv...@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > fubumvc-devel+unsub...@googlegroups.com.

>>> > For more options, visit this group at
>>> > http://groups.google.com/group/fubumvc-devel?hl=en.
>>>
>>>
>>>
>>> --
>>> Adam
>>>
>>> http://adventuresinagile.blogspot.com/
>>> http://twitter.com/adymitruk/
>>> http://www.agilevancouver.ca/
>>> http://altnetvan.grou.ps/
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "FubuMVC Development Group" group.
>>> To post to this group, send email to fubumv...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> fubumvc-devel+unsub...@googlegroups.com.

>>> For more options, visit this group at
>>> http://groups.google.com/group/fubumvc-devel?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "FubuMVC Development Group" group.
>> To post to this group, send email to fubumv...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> fubumvc-devel+unsub...@googlegroups.com.

>> For more options, visit this group at
>> http://groups.google.com/group/fubumvc-devel?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "FubuMVC Development Group" group.
> To post to this group, send email to fubumv...@googlegroups.com.
> To unsubscribe from this group, send email to
> fubumvc-devel+unsub...@googlegroups.com.

> For more options, visit this group at
> http://groups.google.com/group/fubumvc-devel?hl=en.



--
Adam

http://adventuresinagile.blogspot.com/
http://twitter.com/adymitruk/
http://www.agilevancouver.ca/
http://altnetvan.grou.ps/

--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-devel+unsub...@googlegroups.com.

Adam Dymitruk

unread,
Jan 9, 2012, 2:02:38 PM1/9/12
to fubumv...@googlegroups.com
I care. But the majority doesn't.

>>>> >> >> fubumvc-deve...@googlegroups.com.


>>>> >> >> For more options, visit this group at
>>>> >> >> http://groups.google.com/group/fubumvc-devel?hl=en.
>>>> >> >
>>>> >> > --
>>>> >> > You received this message because you are subscribed to the Google
>>>> >> > Groups "FubuMVC Development Group" group.
>>>> >> > To post to this group, send email to
>>>> >> > fubumv...@googlegroups.com.
>>>> >> > To unsubscribe from this group, send email to

>>>> >> > fubumvc-deve...@googlegroups.com.


>>>> >> > For more options, visit this group at
>>>> >> > http://groups.google.com/group/fubumvc-devel?hl=en.
>>>> >> >
>>>> >>
>>>> >> --
>>>> >> You received this message because you are subscribed to the Google
>>>> >> Groups
>>>> >> "FubuMVC Development Group" group.
>>>> >> To post to this group, send email to fubumv...@googlegroups.com.
>>>> >> To unsubscribe from this group, send email to

>>>> >> fubumvc-deve...@googlegroups.com.


>>>> >> For more options, visit this group at
>>>> >> http://groups.google.com/group/fubumvc-devel?hl=en.
>>>> >
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the Google
>>>> > Groups
>>>> > "FubuMVC Development Group" group.
>>>> > To post to this group, send email to fubumv...@googlegroups.com.
>>>> > To unsubscribe from this group, send email to

>>>> > fubumvc-deve...@googlegroups.com.


>>>> > For more options, visit this group at
>>>> > http://groups.google.com/group/fubumvc-devel?hl=en.
>>>>
>>>>
>>>>
>>>> --
>>>> Adam
>>>>
>>>> http://adventuresinagile.blogspot.com/
>>>> http://twitter.com/adymitruk/
>>>> http://www.agilevancouver.ca/
>>>> http://altnetvan.grou.ps/
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> "FubuMVC Development Group" group.
>>>> To post to this group, send email to fubumv...@googlegroups.com.
>>>> To unsubscribe from this group, send email to

>>>> fubumvc-deve...@googlegroups.com.


>>>> For more options, visit this group at
>>>> http://groups.google.com/group/fubumvc-devel?hl=en.
>>>>
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "FubuMVC Development Group" group.
>>> To post to this group, send email to fubumv...@googlegroups.com.
>>> To unsubscribe from this group, send email to

>>> fubumvc-deve...@googlegroups.com.


>>> For more options, visit this group at
>>> http://groups.google.com/group/fubumvc-devel?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "FubuMVC Development Group" group.
>> To post to this group, send email to fubumv...@googlegroups.com.
>> To unsubscribe from this group, send email to

>> fubumvc-deve...@googlegroups.com.


>> For more options, visit this group at
>> http://groups.google.com/group/fubumvc-devel?hl=en.
>
>
>
> --
> Adam
>
> http://adventuresinagile.blogspot.com/
> http://twitter.com/adymitruk/
> http://www.agilevancouver.ca/
> http://altnetvan.grou.ps/
>
> --
> You received this message because you are subscribed to the Google Groups
> "FubuMVC Development Group" group.
> To post to this group, send email to fubumv...@googlegroups.com.
> To unsubscribe from this group, send email to

> fubumvc-deve...@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/fubumvc-devel?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "FubuMVC Development Group" group.
> To post to this group, send email to fubumv...@googlegroups.com.
> To unsubscribe from this group, send email to

> fubumvc-deve...@googlegroups.com.

Jaime Jhon

unread,
Jan 9, 2012, 2:06:49 PM1/9/12
to fubumv...@googlegroups.com
How about method group in lambda arguments....



Thoughts?
Reply all
Reply to author
Forward
0 new messages