Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

New answers tagged

4

Fields and properties are different things. You are mixing them up: the naming in the attribute code suggests that you want to operate on fields, but the use site is supplying property names. The naming of field1 and field2 should be changed to propertyName1 and propertyName2 respectively. Don't forget your BindingFlags! Right now your code will look up any ...


3

Your code looks almost neat and clean, but there are still some areas where you could improve it. Althought braces may be optional for single line if statements your code will get less error-prone by using them. Some more vertical spacing (new lines) would improve the readability of the code. The class EitherRequiredAttribute could be named better. I ...


1

Dependency Management The Scanner is a dependency in each of the 3 methods and may be difficult to unit test around. Magic Numbers Explicit numbers used should be wrapped in a constant to better explain its purpose. 0.45359237 is an example of this. It is difficult to understand what some of these numbers are used for unless you are deep in the ...


4

BmiCalculatorWorking This name is confusing. All code should eventually be 'working'. Don't use static for all variables. I can only guess you did this to avoid the warning about calling non-static variables from a static method. Instead, you can instantiate a BmiCalculatorWorking, and call the methods on the object. You should never use while(true), ...


1

Changed to, on the model COGS_FIELDS_PRESENCE = [ [content_type: 'brief', cogs_field: 'cogs_brief_write_lead', cogs_field_dollar: 'cogs_brief_write_lead_dollar'], [content_type: 'brief', cogs_field: 'cogs_brief_write_copy', cogs_field_dollar: 'cogs_brief_write_copy_dollar'], . . . + 20 entries ] def cogs_fields_presence ...


2

In additions to konijn's remarks I would add some other that I would normally add reviewing this code. Explicit type declarations In the following code there is no need to declare type: public debug: boolean = false; The TypeScritpt compiler will understand the type from the assigned value. Methods with side effects You have a method checkForChanges(...


3

A short review; Changing CSS for input seems too broad, just apply CSS changes to a class tied to your control throw new TypeError('Unknown geographic position type.'); seems odd, why throw this if the calling function does not catch it anyway? You need a think on how this control handles exceptions. Similarly, in degreesToDMS you return null , but the ...


Top 50 recent answers are included