Are there any conventions as to whether a method called by another method should generally be above or below it? E.g. say caller()
was refactored into two methods - where would be the more standard place out of aboveCaller()
or belowCaller()
?
private void aboveCaller() { /*...here?...*/ }
public void caller() {
aboveCaller();
belowCaller();
}
private void belowCaller() { /*...or here?...*/ }
Although this is in Java, it is a general programming question and not really aimed at a specific language. (Apologies if it has been asked before - tried searching on here but didn't come up with anything).
Where possible, hug the load as close as possible to your body. This may be better than gripping it tightly with just your hands. Slight bending of your back, hips and knees at the start of the lift is preferable to either fully flexing your back (stooping) or fully flexing your hips and knees (full/deep squatting).
The most effective control measure involves eliminating the hazard and its associated risk. The best way to eliminate a hazard is to not introduce the hazard in the first place. For example, you can eliminate the risk of a fall from height by doing the work at ground level.
Administrative controls are work methods or procedures that are designed to minimise exposure to a hazard.
Personal Protective Equipment This is the least effective, and least desirable, method of protecting workers, and is considered as the last line of defense against hazards. If the PPE is damaged or fails, the worker will be exposed to the hazard.
Following the top-down design, I first write the methods calls, then implement them, so they'll be under.
Others prefer them to be above the caller since it's clearer (You first encounter the implementation, then see the call).
One thing for sure, follow your convention.
I don't think there is a convention. However, I usually put belowCaller below. It's a supporting function of the main function and I don't want to look at it until I come across it in the main function's content. That being said, I put all public functions first, followed by all private functions. I put class variables at the top. Also, javadoc for each non obvious function will help a lot in understanding the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With