Ask HN: How do you teach/enforce programming best practices?
Since finding a work environment where you work solely with top-level talent is exceedingly rare (especially outside of tech-hub areas), it's important to figure out how to maximize the talent that you have available.
What techniques/rules have you implemented that help teach devs the importance of things like: SOLID Principles, Law of Demeter, Principle of Lease Astonishment, etc.?
I work in a fairly standard corporate environment. Initially we tried to just enforce these things solely through code reviews, but it seems like they just mechanically make the suggested changes without really learning why it matters. Even most junior devs seem to have an academic grasp of things like the Single Responsibility Principle, but at some point during implementation that falls apart.
In my experience this has been a common theme across environments (both large and small) that I have dealt with and I'm very curious to hear how others are handling it.
6 comments
[ 2.9 ms ] story [ 25.9 ms ] threadI think being able to see the full end-to-end diff for a task/story (as opposed to digging through a series of changesets in TFS) will make the benefits of any suggested refactorings much more obvious.
It seems like that could be helpful. My main concern is that a lot of junior devs need some specific direction (as opposed to just telling them to go read some code) so we might need to setup some specific expectations for the results of the code review (maybe have them help write documentation?).
If review was just something that was done sometimes [and those sometimes being either slack periods or seen as part of correcting a situation in need of remediation] then it would not have made sense. It was only due to the fact that the junior staff member's sign-off was required "to ship," that the process was meaningful.
One of the side-effects was that some of my wild and crazy ideas that arose from not knowing any better were identified as seriously off target. Another side effect was that some of those wild and crazy ideas got adopted as standard methods because they worked and improved workflow.
If it isn't clear, I don't think code review assignments as punishment or busy work are worth pursuing.
I've been plenty of places where the edicts are passed down to the... "little people". They/we can end up jumping exhaustedly through endless rounds of process.
Then, the shit hits the fan, or a senior manager simply can't be bothered, and process is suddenly out the window.
Imagine the impression that leaves on everyone who's been running the process maze.
Demonstrate that it matters and serves a purpose. And keep it sane.
All the rest is just talk.