Skip to content

Abstract Factory example is missing certain code to be displayed. #38

@ctrlaltdeleon

Description

@ctrlaltdeleon

After performing the Quick Start and going through the examples, the Abstract Factory article isn't completely transparent as part of the code is missing. Within the project itself is fine because Door is defined within app/components/Door/index.js.

This purpose of this issue is to be clear when teaching Abstract Factory to a user.

Suggested fix would be to go into app/containers/AbstractFactory/index.js and add:

  getDoorCode() {
    return`
    class Door {
      constructor() {
        this.getDescription = () => {};
      }
    }
    
    class IronDoor extends Door {
      constructor() {
        super();
        this.getDescription = () => 'I am an iron door';
      }
    }
    
    class WoodenDoor extends Door {
      constructor() {
        super();
        this.getDescription = () => 'I am a wooden door';
      }
    }
    `;
  }

& then render this onto the app respectively with the assigned needed text for context such as:

return (
      ...
        <p className="subtitle">
          The base for the door will look like this...
        </p>
        <DpHighlighter code={this.getDoorCode()} />
      ...
    );

I can work on this within a pull request if the issue is deemed necessary.

Also my first issue commit (ever), I hope to be helpful to the overall project and want to approach this correctly, so please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions