[Insight-developers] Request for Comment: ITK Style rule that typedefs need to be aligned

Cory Quammen cquammen at cs.unc.edu
Fri Feb 1 16:26:36 EST 2013


I second Matt's opinion. Alignment of the typedefs makes it much
easier to find a particular typedef visually.

Cory

On Fri, Feb 1, 2013 at 4:06 PM, Matt McCormick
<matt.mccormick at kitware.com> wrote:
> Hi Hans,
>
> I am of the opinion that the alignment makes the code easier to read.
> The emphasis may or may not be correct, but my eyes can pass over an
> aligned section much quicker and understand than one that is not.
>
> Thanks,
> Matt
>
> On Fri, Feb 1, 2013 at 5:36 PM, Johnson, Hans J <hans-johnson at uiowa.edu> wrote:
>> Hello ITK community,
>>
>> I'd like to take a poll about your feelings regarding an ITK style decision
>> that has been in place for a very long time.
>>
>> The ITK style guide states that all typedefs that are on adjacent lines MUST
>> be justified the same.  While I think that this is often a good practice,
>> this rule also obfuscates the code sometimes, and it makes unnecessary
>> changes in code that is unrelated to the line of code in question (for
>> example, if an internal type name is renamed to better represent the code,
>> the 10 typedefs around that one also need to change).
>>
>> As a side note, the "Clean Code" book advices against such alignement as it
>> emphasizes a relationship between the elements in a column. It should
>> instead emphasize the relationship between the elements in a row (when you
>> look at those lines, it's usually to know what is the type of the variable
>> -> horizontal relationship).
>> This also has 2 practical limitations:
>> - when the variable type or name are long too long that it reach the number
>> of characters per line.
>> - adding a new type with a name longer than the existing forces all the
>> other rows to be changed, which adds noise into the history.
>>
>> NOTE:  Making this change in style policy will NOT require any code to be
>> changed.  It does allow more flexibility in the future.
>>
>> ============================
>> Please respond to this message so that a historical record of this proposals
>> pro's/con's can be recorded on the mailing list.
>>
>> Thanks,
>> Hans
>>
>>
>>
>> =================================================================
>> Hans J. Johnson, Ph.D.
>> Assistant Professor, Department of Psychiatry
>>
>> Mailing Address:
>> W274 GH                             Email: hans-johnson at uiowa.edu
>> 200 Hawkins Drive                   Phone: (319) 353 8587
>> The University of Iowa
>> Iowa City, IA 52242
>>
>>
>> ________________________________
>> Notice: This UI Health Care e-mail (including attachments) is covered by the
>> Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential
>> and may be legally privileged.  If you are not the intended recipient, you
>> are hereby notified that any retention, dissemination, distribution, or
>> copying of this communication is strictly prohibited.  Please reply to the
>> sender that you have received the message in error, then delete it.  Thank
>> you.
>> ________________________________
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill


More information about the Insight-developers mailing list