I would consider Developer 2 (the less-experienced developer) as less than a full resource. I'd go to the resource page, set his max units to 66.6666%, and use the fixed work task type. This way, the task duration would be increased after he is assigned to it, to account for the extra work he has to do compared to the skilled developer. On the resource usage sheet, it will show that he's only scheduled for 5.33 hours in a regular eight-hour workday, but at least the durations on your gantt chart would be correct.
This essentially makes your most skilled developer equivalent to 100%, and everyone who takes longer gets a max units of less than 100%.
Note that setting max units in the resource sheet doesn't change durations of tasks to which that resource has already been assigned. You'll get an overallocation warning (the little red person in the Task Mode column) and will have to level your project to fix the overallocation.
(To make this more clear, add the "Work" column, which is not shown by default.)
- I create a task (Task 1) that has an estimated work of 5d.
- I set the task type to Fixed Work. This means that duration will change when resources are added, but work will remain constant.
- On the Resources page, I create Developer 1 (my skilled developer) and set him to a max units of 100%.
- I also create Developer 2, who is my less-skilled developer. For every hour that Developer 1 spends on a task, it takes Developer 2 1.5 hours. So I set his max units to 66.6666%. Project will round to 66.7% on the screen, but those extra digits to the right of the decimal point are still used, and are important.
At this point, if I assign Developer 1 to the task I created in Step 1, the Duration will remain 5d. But if I instead assign Developer 2 to the task, the duration will become 7.5 days. If I assign both resources to the task, the duration becomes 3 days. In all cases, work remains fixed at 5d.
[Edit: Fixed a few stupid math mistakes, and added the example.]