Implement new API function to reduce duplicationBRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: SeanTags: implement, code, C, API

This is a follow-on to a new API design task.

This task involves implementing a new function that will measurably help reduce code duplication. You'll need to have already identified a piece of duplicated code that needs to be refactored and/or modified.

This task involves implementing the function per the header doxygen comment specification.  Make sure your implementation is clean, fits well with our existing conventions, and is an efficient implementation that will help reduce code.  Be meticulous.

Submit a patch file with your implementation.

 

Uploaded Work
File name/URLFile sizeDate submitted
tmp_bn_poly_area-1176587867.patch4.0 KBDecember 31 2013 10:59 UTC
bn_poly_area.patch7.9 KBDecember 31 2013 15:25 UTC
Comments
Johannes Schulteon December 30 2013 19:54 UTCTask Claimed

I would like to work on this task.

Gauravjeet Singh on December 31 2013 02:04 UTCTask Assigned

This task has been assigned to Johannes Schulte. You have 72 hours to complete this task, good luck!

Johannes Schulteon December 31 2013 10:59 UTCReady for review

The work on this task is ready to be reviewed.

Daniel Rossberg on December 31 2013 12:59 UTCHow will this function help to reduce code?

The function itself looks reasonable.  However, I'm missing at least two usages of bn_polygon_area() in your patch so that this function indeed reduces code.

Daniel Rossberg on December 31 2013 12:59 UTCTask Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Johannes Schulteon December 31 2013 13:28 UTC

Is this also part of this task, or should it be done in one of the code duplication tasks?

Johannes Schulteon December 31 2013 15:25 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 31 2013 16:46 UTCcomment duplication

Implementing the reduction isn't part of this task but you do have to identify the code that is deplicated (i.e., submit what code that is somewhere (not in the patch, a text file or comment)).  You don't really have to worry about a task count, so it's more helpful that this is included together with this patch (it's not a 100+ line reduction anyways unless you know of more places to use it).  All tasks will get weighted by complexity and completeness (among other factors) so it doesn't really help you to break this up into multiple tasks unless you're worried about not making the top five. 


The patch looks pretty good except for a few issues:



  • The comment that you duplicate with the implementation should be deleted.  Information should ideally only live in one place, otherwise they eventually get out of sync when someone comes along later to make a change and doesn't realize it's in two places.  The purpose of a comment with the implementation would be to point out any non-obvious implementation detail.

  • The polygon.c file is missing a footer.  You can run the sh/footer.sh script on the file to automatically fix it.

  • The copyright year range is wrong.  The file just started, so it should just be 2013 (just barely!).


Fantastic work here.

 

Sean on December 31 2013 16:46 UTCassuming

Assuming you can fix the remaining issues on commit.


 

Sean on December 31 2013 16:49 UTCTask Closed

Congratulations, this task has been completed successfully.

Johannes Schulteon January 1 2014 22:51 UTC

committed in r59239