Home  >  Article  >  Backend Development  >  How to write classes more efficiently?

How to write classes more efficiently?

WBOY
WBOYOriginal
2016-12-05 13:44:16989browse

Which implementation method of the following two classes is better? Or are there other better solutions? Discuss discuss.

1. Start with each specific function and write all the functions of the class in one method. After the test passes, the entire function is divided into various methods of the class and tested again.

2. First write the overall structure of the class, and then fill in each function.

Reply content:

Which implementation method of the following two classes is better? Or are there other better solutions? Discuss discuss.

1. Start with each specific function and write all the functions of the class in one method. After the test passes, the entire function is divided into various methods of the class and tested again.

2. First write the overall structure of the class, and then fill in each function.

Object-oriented custom class

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn