How do you teach junior programmers to use MVC? This is assuming they never had any experience.
-
How did the non-junior programmers learn it when they never had experience?
Steven Oxley : This doesn't address the actual question, but how the question was phrased. I agree with you, however, I don't think that many junior programmers know the benefits of using a framework.TheTXI : Sure it does. Are we supposed to sit here and imagine that the non-junior programmers were born with the knowledge of MVC already in their heads? If not, then it shouldn't be that much of a stretch to say what worked for them should work for your juniors.Jon Cage : -1 -> Just because we didn't have the benefit of knowing what we know now doesn't mean we should stifle other people's learning. Also, I find one of the best ways to cement your understanding of something is to teach others, so if you have the chance to help others learn I think that's something valuable for all concerned.TheTXI : Jon: What the heck are you talking about? I never said or even implied to stifle someone's learning. All I am saying is that if you and your non junior devs learned something X way, it probably wouldn't hurt the juniors to learn it the same way. I'm not saying that you don't supplement that with your own knowledge you've learned along the way, but there are way too many people here who are looking like they want to treat their juniors like they don't know what the hell they are doing or how to learn it. Drop the kid gloves and treat them as you want to be treated.belgariontheking : Who's trying to stifle other people's learning. All TheTXI is trying to say is "teach them how you learned."TheTXI : btk: That's the gist of it. If it worked for you, it should work for them. Plus, they'll have the added benefit of someone who went down the same path before to offer guidance along the way. This shouldn't be a hard concept and can be (and has been) applied in numerous other situations in and out of the programming world.Jon Cage : Apologies - I misread what you were trying to say as "we learnt on the job so let them figure it out the hard way too". I've encountered similar attitudes myself in the dim and distant past where some developers have deliberatly held back others to promote their own skills. Pretty shocking behaviour really! Make that a +1 instead then :-)TheTXI : Jon: No, I'm definitely not advocating the "drop them off in the middle of the forest and hope they find their way back home" attitude. If anything it would be "drop them off in the middle of the forest along with a forest ranger and let the forest ranger help him find his way back home"Vincent Ramdhanie : With my own team I have been asking the junior programmers to prepare presentation of some difficult concepts and in essence "teach" the rest of us how to do something. I have also been encouraging them to write everything in a blog. This way they do more research and tend to understand some concepts much better than if I tried to teach them. -
The only way to get experience is doing it.
Richard Ev : +1 for this - experience and examples will accelerate their learning.drikoda : How about for a junior guy who comes from a VB background how do you teach him? -
Start with the why and not the how. If they've ever used a template engine such as smarty, then that can be used as an example, that with MVC we try to achieve the same goal, separation of business logic, datamodel and UI logic. Once they've understood the basic concepts, show them a simple example which will demonstrate the benefits of MVC.
I remember when I first learned about MVC, I was shown the implementation principles. I thought that MVC made things more complicated than what they needed to be. I've just later on started to appreciate its benefits.
One example you can use is to have them first to consider a system written in non-MVC model. Then make them consider what would happen if the UI layer would change totally :)
Jon Cage : +1 -> Showing is better than telling and the greatest zealots of an idea are always converts. Show them how to do something with and without MVC and then show them how powerful it can be and what problems it overcomes.drikoda : Kim: I think you are correct that teaching smarty first as this would separate content from logic. Good answer thanks -
If you are using it at work it sounds like all you have to do is explain what it is all about and as you go through things show in your code base how it is implemented.
-
What made the light bulb go on in my head was seeing the examples side by side. Show them code made in a non MVC-style way. Show them how much effort it takes to modify this code to do things differently on different pages. Then move over to a MVC based site/program and show them the same modifications.
Basically, just demonstrate it!
-
As far as CakePHP goes, The Cookbook is a good start. It offers a simple introduction to the concept of MVC, and the reasoning behind it. Then he can continue with the simple blog tutorial to see how that works in practice.
After that, it's creativity time! "Extend the blog tutorial app in any way you see fit, and learn by example."
-
Start them with a simple project that takes them through all the principles of the framework in question. The Django Book offers a great example of a written tutorial that they can follow. CodeIgniter has a series of excellent video tutorials that they will find helps explain what is so useful and interesting about the MVC pattern.
-
I'd definitely advocate the show and tell methodology that others have suggested. I often come back to Wikipedia's definition of MVC when I've been trying to explain the benefits to others.
There's also a relevent question here on SO with some good resources in it.
drikoda : Thanks Jon good post -
i would tell them to first write a very simple blog engine in php (no framework). Next i would tell them to rewrite it using a MVC framework.... but honestly, MVC is pretty simple............
-
If you are in the Microsoft world, check this post out. I am going through the tutorial of DasBlonde:
-
I'd be careful if you plan on trying to do a classroom like routine to teach them as it may well backfire. People generally learn in different ways and so while one method may work for some, it will fail miserably on others. I went through learning MVC because a project on was on used it and so I just had to pick up what was already in use. This could also be viewed as a baptism by fire but it makes sense to my mind for a way to get people to pick up something that shouldn't be that different from what they will have to do time and time again in their career if they stay in this kind of position. The key is to have a real project for this to be used on along with seeing whether or not the juniors know how to pick up something quickly.
Some may read blogs to learn parts of it, some may read books like "Head First Design Patterns," some may just want to put it into a project to see how it works, some may want an oral description of the structure rather than a visual one. Some may want all of the above to drill into their minds. Not that there's anything wrong with that...
Vincent Ramdhanie : Did you mean "Head First Design Patterns" ?JB King : Yes, I did. Thanks for the correction. -
MVC is a solution and I have found that when teaching students if you jump straight to teaching the solution they have a hard time understanding why they need the solution. It is always better to experience the problem first then be presented with a solution to the problem. I have seen this in practice in teaching a number of concepts, not just MVC.
For example, to teach students to use ANT I started by showing them how powerful the tool is and what it can do. I was bombarded by questions over that semester of the "Why do we need ANT?" nature. The next semester we started by building fairly complex applications without ANT, taking a long time to do the steps of each build by hand. Then introducing ANT and the students were so happy to have the "simpler" approach that there were no questions. Everyone understood why they needed it.
The same thing applies to MVC and other concepts that provide a solution to problems that themselves are difficult to understand without experience. In a work environment you may not have the luxury of taking your programmers through a non-mvc application first but it seems as if it is the way to go. Look for a simple example and let them experience the difficulty of maintaining the application without the separation of concerns and then try introducing the concepts one at a time.
For instance, seperating the model from everything else could be your first step in improving the software. When they understand the importance of having a separate model then you could point out the flaws in the view and controller being tightly coupled and discuss the techniques for fixing that problem. This way, they are not exposed to the entire concept in one go but may spend several weeks digesting small parts of the concept one at a time. People need time to digest what they learn.
-
MVC is wonderful but hard to grasp without code examples. That's the problem with most of the tutorials. You get the theory after you've seen some code and how this code differs from non-MVC programming.
Check out this series:
- http://nemetral.net/2008/07/31/a-gentle-introduction-to-mvc-part-1/
- http://nemetral.net/2008/08/06/a-gentle-introduction-to-mvc-part-2/
- http://nemetral.net/2008/08/13/a-gentle-introduction-to-mvc-part-3/
It's good stuff with graphics and code examples.
-
Hi, i consider myself a junior programmer, and i must say that is not easy to understand most of the things at the beginning. There are so many thing that we must learn, and school doesn't prepare you for that. In my case i have to study in double, i learn at the work, and then i go home and try to read more to understand. Books about the subject are very helpful, cos they teach you things you don't even think that is possible to do. In my case, i'm learning DBIx::Class (perl Module) and i must say it is not easy to understand in the beginning. There is no book to read, only the documentation from cpan. And the good people in IRC chat that answer my doubts.
If a junior want to understand MVC he have to work harder, make a list of doubts, have someone to ask the doubts and get answers.
I'm studing alone in the work, but i have always someone to ask some doubt i have, when they don't have a answer i must try from other way.
I had classmates that didn't bother to study... in my opinion:
At first gives him the subject, what you want they learn, what you expect they reach (give some goals to reach) and see if they work harder to reach what you said. Then you will see who is motivated, who is trying but not reaching, who is not doing anything.
Then after that is with you to decide what to do. But nobody born knowing all the stuff, so help, and support are a must.
0 comments:
Post a Comment