https://forum.xda-developers.com/showthread.php?t=1738841
OO Principles: Strive for loosely coupled designs between objects that interact.
OO Patterns: Observer – defines a one to many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Subjects/Observables update Observers using a common interface.
public interface ISubject
{
void RegisterObserver(IObserver observer);
void RemoveObserver(IObserver observer);
void NotifyObservers();
}
public class WeatherData : ISubject
{
private List<IObserver> _observers = new List<IObserver>();
private float _temperature;
private float _humidity;
private float _pressure;
public void RegisterObserver(IObserver observer)
{
_observers.Add(observer);
}
public void RemoveObserver(IObserver observer)
{
_observers.Remove(observer);
}
public void NotifyObservers()
{
foreach (IObserver observer in _observers)
{
observer.Update(_temperature, _humidity, _pressure);
}
}
public void MeasurementsChanged()
{
NotifyObservers();
}
public void SetMeasurements(float temperature, float humidity, float pressure)
{
this._temperature = temperature;
this._humidity = humidity;
this._pressure = pressure;
MeasurementsChanged();
}
}
public interface IObserver
{
void Update(float temperature, float humidity, float pressure);
}
public interface IDisplayElement
{
void Display();
}
public class CurrentConditionsDisplay : IObserver, IDisplayElement
{
private float _temperature;
private float _humidity;
private ISubject _weatherData;
public CurrentConditionsDisplay(ISubject weatherData)
{
this._weatherData = weatherData;
weatherData.RegisterObserver(this);
}
public void Update(float temperature, float humidity, float pressure)
{
this._temperature = temperature;
this._humidity = humidity;
Display();
}
public void Display()
{
Console.WriteLine(“Current conditions: ” + _temperature
+ “F degrees and ” + _humidity + “% humidity”);
}
}
OO Basics: Abstraction, Encapsulation, Polymorphism, Inheritance
OO Principles: Encapsulate what varies, Favour composition over inheritance, Program to interfaces, not implementations.
OO Patterns: Strategy – defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
public abstract class Duck
{
public IFlyBehavior FlyBehavior { get; set; }
public IQuackBehavior QuackBehavior { get; set; }
public abstract void Display();
public void PerformFly()
{
FlyBehavior.Fly();
}
public void PerformQuack()
{
QuackBehavior.Quack();
}
public void Swim()
{
Console.WriteLine(“All ducks float, even decoys!”);
}
}
public class MallardDuck : Duck
{
public MallardDuck()
{
QuackBehavior = new LoudQuack();
FlyBehavior = new FlyWithWings();
}
override public void Display()
{
Console.WriteLine(“I’m a real Mallard duck”);
}
}
public interface IFlyBehavior
{
void Fly();
}
public class FlyWithWings : IFlyBehavior
{
public void Fly()
{
Console.WriteLine(“I’m flying!!”);
}
}
public interface IQuackBehavior
{
void Quack();
}
// Name it LoadQuack to avoid conflict with method name
public class LoudQuack : IQuackBehavior
{
public void Quack()
{
Console.WriteLine(“LoudQuack”);
}
}
Seas0nPass provides an UNTETHERED jailbreak of the 2nd gen Apple TV running the latest 5.0.2 (iOS 5.1.1 – 9B830) software that was released on June 6th, 2012.
http://files.firecore.com/SP/Seas0nPass.zip
Launch Seas0nPass and choose Create IPSW. When complete, connect your Apple TV to your Mac/PC using a micro-USB cable (leave power cable disconnected). Once the light on the front of the Apple TV begins to flash rapidly, point the remote at the Apple TV and hold both the MENU and PLAY/PAUSE buttons for 7 seven seconds.
http://support.firecore.com/entries/387605
foo