The Three Phases of OOP Matter

Gas

public static class Logger  {

    public static void Log(string message, LogTypeEnum type) {
        // ...
    }

}

 

Liquid

public class Logger  {

    public void LogError(Exception ex) {
        // ...
    }

}

 

Solid

public class Logger : ILog, IAudit  {

    public Logger(IExceptionFormatter exceptionFormatter,
                  IStackTraceFormatter stackTraceFormatter,
                  IClock clock,
                  ITextWriter writer) {
        // ...
    }

    public void LogError(Exception ex) {
        // ...
    }
}

Print | posted @ Wednesday, August 24, 2011 9:12 AM

Comments on this entry:

Gravatar # re: The Three Phases of OOP Matter
by Dantel at 8/24/2011 10:03 AM

Hi,

I am stupid, what is your point with this topic?
  
Gravatar # re: The Three Phases of OOP Matter
by scott at 8/24/2011 10:06 AM

It's an abstract post and open to interpretation.
  
Gravatar # re: The Three Phases of OOP Matter
by Harry at 8/24/2011 10:14 AM

Since it is open to interpretation, I would say Ruby looks like liquid but have all the benefits of solid ...
  
Gravatar # re: The Three Phases of OOP Matter
by scott at 8/24/2011 10:17 AM

@Harry: Good one! :)
  
Gravatar # re: The Three Phases of OOP Matter
by Joe at 8/24/2011 2:13 PM

Now show all the code you would need to invoke the Log/LogError method.
  
Gravatar # re: The Three Phases of OOP Matter
by JMR at 8/24/2011 6:11 PM

@Joe +1
  
Gravatar # re: The Three Phases of OOP Matter
by Matt at 8/25/2011 2:12 AM

I new to this, curently following the excellent Scott Allen videos from Pluralsight. But i did once do a lot of scipting in Perl.

My interpretation? Complete software over engineering
  
Gravatar # re: The Three Phases of OOP Matter
by Rainier at 8/25/2011 2:17 AM

Compromise: Liquid, but make the LogError method virtual.
  
Gravatar # re: The Three Phases of OOP Matter
by Scott Koon at 8/25/2011 12:37 PM

Plasma:

public class Logger<T> : ILog, IAudit
{

public Logger(IExceptionFormatter exceptionFormatter,
IStackTraceFormatter stackTraceFormatter,
IClock clock,
ITextWriter writer)
{
// ...
}

public void LogError(Exception ex)
{
// ...
}

public void LoggError(Expression<Action<T>> action)
{
// ...
}
}
  
Gravatar # re: The Three Phases of OOP Matter
by James Curran at 8/25/2011 3:52 PM

Real liquid....

public class Logger
{
LogTypeEnum type = LogTypeEnum.Error;
string message;
Exception ex;

public Logger Error { get { type = LogTypeEnum.Error; return this; } }
public Logger Warning { get { type = LogTypeEnum.Warning; return this; } }
public Logger Because(Exception exc) { ex = exc; return this; } }
public void Log(string message) {.....}
}
  
Comments have been closed on this topic.
Scott Allen
Posts - 869
Comments - 4493
Stories - 14