Last active
August 29, 2015 14:08
-
-
Save AnthonyMastrean/472cb48e667be72cee53 to your computer and use it in GitHub Desktop.
Bloated Constructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ActiveProduct | |
{ | |
private readonly ActiveProductState State = ActiveProductState.Simulated; | |
private readonly SortedList<string, Environment> Environments = new SortedList<string, Environment>(); | |
private readonly ProgramSlots AvailablePrograms = new ProgramSlots(this) { HIStartIndex = 0 }; | |
private readonly ProgramSlots AccessoryPrograms = new ProgramSlots(this) { CanRemoveOverride = true, StartIndex = 4, IsAutoShifting = false }; | |
private readonly ProgramSlots VirtualPrograms = new ProgramSlots(this) { IsVirtual = true, CanRemoveOverride = true, SlotConfig = Limit.None }; | |
private readonly ProgramCalculator SlotCalculator = new ProgramCalculator(this, false); | |
private readonly ProgramCalculator VirtualCalculator = new ProgramCalculator(this, true); | |
private readonly DFSCalibration DFS = new DFSCalibration(this); | |
private readonly Accessories Accessories = new Accessories(); | |
private readonly PowerBands PowerBands = PowerBands.Unknown; | |
private readonly Product Product; | |
private readonly StringVersion CurrentDriver; | |
private readonly Side Side; | |
private readonly Device Device; | |
private readonly Options Options { get { _Product.AvailableOptions; } }; | |
public ActiveProduct(Product product, StringVersion driver, Side es, Device device) | |
{ | |
if (product == null) | |
throw new Exception("Can't create an active product from a null product"); | |
Product = product; | |
CurrentDriver = driver; | |
Side = es; | |
Device = device; | |
} | |
public void StartMonitoring() | |
{ | |
Device.ConnectionStatus += Device_ConnectionStatus; | |
Device.BatteryStatus += Device_BatteryStatus; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A look at the bloated constructor and some options... http://www.daedtech.com/beware-the-bloated-constructor
this
is in scope there?)try... catch
is unnecessary except for the logging in thefinally
block