A soft question, when I was in high school and in University I took scientific writing classes and people told me I should use passive voice as much as possible to sound objective, but when I entered grad school people told me I should not use passive voice unless I work in Chemistry. So Which one should I follow?
The bottom line advice is: Use whichever voice best aids understanding.
Many people over-use the passive voice, thinking that it makes them sound more scientific. In practice, it's more common for the passive voice to make sentences harder to follow.
Therefore, as a rough guideline, it's helpful to use the following principle: use the active voice whereever possible. If you find yourself writing in passive voice, check whether your sentence would be clearer, simpler, or easier to understand if written in the active voice.
I recommend you read style guides on clear writing. You'll find they tend to warn against over-use of passive voice: active voice often makes sentences simpler, more direct, more forceful, more vivid, and thus both more concise and more memorable. Strunk & White have some good examples of this guideline; see, e.g., Rule 11 and Rule 12.
There are some special cases where there are conventions or norms within the field that are worth following. See, e.g.,
There is some discussion of passive voice in CS papers in this comprehensive but no-so-well publicized "insider" reference (which apparently hasn't been officially published even by the authors except recorded electronically as class notes) by a leading authority in the field Knuth & teaching cohorts. Generally both passive and nonpassive ("active" or "imperative") forms of writing are used in CS with some major examples of each. They discuss use of style analysis programs which also automatically score the passive versus imperative sentence constructions, and can be used for guidance, different uses in the abstract versus the body, and so on. Overall, it comes down to style preferences and guidelines. Overuse of either form is generally to be avoided.
Mathematical writing by Donald E. Knuth, Tracy Larrabee, and Paul M. Roberts.
See page 110, and also search for "passive" and "imperative" keywords in the document.
Paul now moved on to the final area of discussion: Style. Rule #6 in § 1 suggests that we use 'we' to avoid passive voice. This use of 'we' is equivalent to "the reader and 1" . Paul says that even better is to avoid both passive voice and the use of 'we' through judicial use of imperative and indicative moods along with an outlying kind of non-sentential phrase.