Factory method and Composite Patterns added

I've added the factory method and composite pattern in this PR