|
| 1 | +/* |
| 2 | + * The instruction specified: |
| 3 | + * There is no right or wrong solution as long as code works, but we give bonus points |
| 4 | + * for a plain-text explanation on why particular design decisions were made and what |
| 5 | + * are the tradeoffs. Put it right into the code in a form of a comment at the |
| 6 | + * beginning of the main file. |
| 7 | + * |
| 8 | + * Design Decision 1: there is no need for a main file. This file, mainfile, |
| 9 | + * was include per-instructions above out of respect for the product manager. |
| 10 | + * |
| 11 | + * Design Decision 2: Units tests were used as "a console application with a test |
| 12 | + * method or two" is not the way projects are tested. This is 2000 era development so |
| 13 | + * Unit Test are simply more natural. |
| 14 | + * |
| 15 | + * Design Decision 3: I do not write software as a single file. Applications regardless |
| 16 | + * of size are developed using solutions/projets/assemblies and unit tests. I will |
| 17 | + * provided both a single file and a full implementation that can be gloned via |
| 18 | + * GitHub.com |
| 19 | + * |
| 20 | + * Design Decision 4: all design decisions are discussed in the context of where |
| 21 | + * apply directly since there is no true MainFile. Since this is a bonus question |
| 22 | + * explanations will be repeated: |
| 23 | + * 1) Chip is the abstract base class of call chips and Operation method is used |
| 24 | + * by a Robot to invoke a chip's action |
| 25 | + * public abstract T[] Operation<T>(T[] data); |
| 26 | + * 2) There is no way to make a generic type T numeric. An Extension method |
| 27 | + * was created for the object type ObjectExtensions.IsNumericType which |
| 28 | + * determines if a give type in an array of data is numeric (aka is value one |
| 29 | + * of byte, int, double, decimal, etc.) |
| 30 | + * 3) With generics we could have a case when an array is say IComparable and contains |
| 31 | + * mixed numeric types. This cannot be supported easily so it is q requirement that |
| 32 | + * all data in array is composted of the same numeric type (see extension method |
| 33 | + * ArrayExtensions.IsHomogeneousNumericType). |
| 34 | + * 4) There is an inconsistency in the designing. ChipOfSorts returns an array and |
| 35 | + * TotalChip returns scalar. To simplify this the scalar, return an array of length |
| 36 | + * 1 with the 0th value element set to the scalar result. |
| 37 | + * 5) The names provided are not consistent: TotalChip and ChipOfSorts so we put our |
| 38 | + * faith in the PM and left the names the same. |
| 39 | + */ |
0 commit comments