Retired

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 function5 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.

Regular Expressions
Fundamentals

More By Author:

Check out these other kata created by owens2024

Stats:

CreatedOct 7, 2016
Warriors Trained50
Total Skips0
Total Code Submissions285
Total Times Completed10
JavaScript Completions10
Total Stars4
% of votes with a positive feedback rating33% of 6
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes3
Total Rank Assessments5
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • owens2024 Avatar
Ad