21

Do not assume that the current codebase is perfect, or even remotely close to an example of acceptable style/structure.

Comments
  • 5
    This. It can be a bit discouraging to see all the bad practices and spaghetti code written by previous devs though.
  • 5
    @IAmNotARobot

    Definitely! I don't expect juniors to be solution architects, or great at refactoring. I do expect juniors to write code by looking at existing features and using those as an example — but it's dangerous to assume that all of it is great example material.

    So the number one advice I give them is to ASK where to look for sample code... Or at the very least use git to check whether the feature they're peeking at isn't 6 years old.
  • 1
    @bittersweet how do you find the date of a specific commitment in git?
  • 2
  • 1
    @asgs thanks. Didn't know that
  • 1
    @ZeldaFan69-2 I personally use git blame (well, the built-in Jetbrains IDE version of it) to annotate the lines with author & commit date.

    For VSCode there's "annotator" (https://marketplace.visualstudio.com/...) which also uses git blame in the background.

    But most often I also just ask in Slack "hey peeps, what do we think is a great way to structure & organize this set of middlewares? Throw it in directory A or B? Should use handle as a method name?" — even when I already have an opinion on it, I tend to ask.
  • 1
    In the other hand, if a junior (or anyone for that matter) can understand the code they use as a reference, chances are that it is pretty readable.
  • 1
    @electrineer True, but sometimes it's not just about readability -- it's also about structure, consistency & deprecation.

    For example, it often happens that a part of a website is still server-templated HTML (Twig, Blade, Jinja, etc), while the preferred "new" way of doing things might be to build an API endpoint which is used by some React/Vue/Angular component.

    No matter how nicely readable it is, you don't want a junior to keep adding to the legacy pages, instead of helping the transition in the right direction.
Add Comment