The Care and Feeding of Junior Developers
Studies have shown time and again that employees that take ownership of their work are more motivated and happier with their job. Give them ownership of the code they write and with that will come greater motivation to succeed. This in turn produces a higher quality product. That may mean they add a library they are familiar with or they use a development pattern that makes sense to them. Once a junior makes a connection between their work and the product, a senior developer will only need to guide them in the right direction, instead of holding their hand all along the way.
Do everything you need to do to put them in a position to succeed. There is no worse feeling for a junior then to be highly motivated and yet totally incapable at the same time. Give them the tools and knowledge throughout the development process lifecycle. This means answering any and all questions, even simple ones, and providing tools and training to help them increase their knowledge base.
Even though they should always have a safety net, a junior developer should be allowed to fail. They won't, and to a point can't, always have some one to fall back on. Failing allows for the junior to learn and grow from their mistakes. These failures should not be with mission critical features, but should still be important. After a failure occurs, the junior developer and their mentor should have a post mortem to figure out what went wrong, and help them minimize the chance of them making the same failure again. An important distinction to make it is that their tasking should never be designed to fail, but they are only allowed to fail. Failing builds the so called "battle scars" of a season developer.
Code reviews are a great way for developers to grow and learn to make their code more performant and readable. These types of reviews should not emphasize cleverness but rather help juniors to refine their skill set through learning about techniques, patterns, and terminology they were previously unaware of.
One of the biggest weaknesses of a junior is having a grasp of software architecture. The scope and breadth of a production application is not something they are familiar with at this point in their career. Pairing up with a senior allows them to explore the depth of production application software, ask questions related to architecture, and generally gain conformability from interacting with the codebase alongside a seasoned veteran. The experience will open their eyes and inspire them to dream of building more complex systems.
Development is as much about people as it is about code. There should be no scoffing, rhetorical questions, showmanship, or haughtiness when it comes to interacting with juniors. This discourages juniors from asking questions and seeking help from those more experienced. If a junior cannot ask a question, they are not growing, and if they are not growing, the company is failing them and itself. In due time, you will lose juniors to a better environment where their opinions, questions, and attitude is more appreciated.