0

This question pertains to code organization. I am the author of an Angular package called ng-simple-slideshow. By far the longest file is the component.ts file of the slideshow. It's so long that it's becoming hard to read.

What would be the angular way of separating this code for organization and readability?

dockleryxk
  • 407
  • 2
  • 11

1 Answers1

1

When I design classes with angular 2+, I use concepts from Object Oriented Programming languages, such as Java. Inheritance, Encapsulation, Polymorphism, and Abstraction (The 4 PILLARS of java).

I try to design my classes to focus on a single purpose.

Using Inheritance and Composite based designs to provide code: reusability, readability, and loose coupling between classes.

Project tree structure, naming your classes / files are important too. If done right, it can provide a high-level view of what is already available in your codebase, and make it easier for others to use it.

Potato
  • 628
  • 5
  • 8
  • Thanks for this answer. The thing is, for this particular use there is no need for this class to be used again. It's a simple package and this is the only component. – dockleryxk Apr 16 '18 at 18:39