At Barknee's place of work, it is pretty common place to have a "code walkthrough" when a project is complete. The idea is that other developers will have a general idea how system works in case they ever need to support it.

A recent walkthrough was given by a senior-level developer who wanted to make sure that everyone understood not only the basics of the system, but the fundamentals of some of the programming and architecture techniques used. After all, not everyone is an expert at the more complex concepts in computer science such as inheritance. The developer used the following code to demonstrate the fundamentals of inheritance and how it was used within their application ...

public bool ProcessComponent()
{        
     return this.Parent.Parent.Parent.Parent.ProcessComponent();
}

public bool InitializeDisplay()
{
  if (this.IsActive)
  {
    this.Initialize();

    if ( (this.Parent != null)  && (this.Parent.IsActive) )
    {
      this.Parent.Initialize();

      if ( (this.Parent.Parent != null)  && (this.Parent.Parent.IsActive) )
      {
        this.Parent.Parent.Initialize();

        //ED: Snip a few layers ...

        if ( (this.Parent.Parent.Parent.Parent.Parent.Parent != null)  &&
             (this.Parent.Parent.Parent.Parent.Parent.Parent.IsActive) )
        {
          this.Parent.Parent.Parent.Parent.Parent.Parent.Initialize();
        }
      }
    }
  }

}

 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!