Bob - The Automated Manager (retired)
Description:
In an effort to cut cost Acme Inc. has decided to automate software development management. So how can Acme ensure that development doesn't run amok? That is where you come in. Your job is to write a function to judge other functions.
Writing small efficient functions is a hallmark of good programming.
Build a simple function complexity analyzer that returns a complexity score based on the following:
Each statement or line of the function (blank lines or lines that only comments do not count) | 1 point |
if statement | 2 points |
Calling a property of an object (such as myString.length) | 3 points |
Calling a method of an object (such as myString.slice(1,5)) | 4 points |
Function inside the function | 5 points |
For example:
function() { var a = 5; var b = 2; return Math.pow(a, b); }
This functions complexity score would be:
5 Lines = 5 points
1 Method call (Math.pow) = 4 points
9 Total Points
No one wants developers to try and make their code less complex by putting all on one line,
so make sure lines like var a = 2; var b = 3;
are counted as two lines.
Note this Kata does imply that the scoring rubric above is actual measure of complexity or efficiency of any particular function or programming practice.
Similar Kata:
Stats:
Created | Oct 7, 2016 |
Warriors Trained | 50 |
Total Skips | 0 |
Total Code Submissions | 285 |
Total Times Completed | 10 |
JavaScript Completions | 10 |
Total Stars | 4 |
% of votes with a positive feedback rating | 33% of 6 |
Total "Very Satisfied" Votes | 1 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 5 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |