A simple question hopefully, go easy i'm a beginner...
When using jsoup for multiple calls to different websites is it better to group the different websites under different Methods?
website1();
website2();
website3();
or just have them run one after the other under 1 Method..
websites();
Thank you.
Extracting method is always better :) Code is more readable.
login(username, password);
selectProfile();
selectChangePassword();
setNewPassword(password);
logout();
This is much more easier to read :)
Depends on how you want to organize your data. The more methods the merrier for decomposition and debugging (see printStackTrace()). There are a variety of reasons why decomposition is so useful. Method calls have negligible effects on the speed of your program. Have you considered the following?
void websites(){ //I am assuming it returns void.
website1();
website2();
website3();
website4();
//etc...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.