Assigning your EVs is usually an easy thing- this needs stronger Attack, that needs to be faster, and so on. Defenses, though, can be complicated.
There are currently essentially two arguing camps, because there are three ‘peaks’ for defenses.
A pokemon is most durable at one of two points: Either where its HP are twice its defenses, or where its defenses are twice its HP. There is evidence supporting both arguments, which makes it hard to say that one or the other is definitively right. However, this is not about what is overall best- this is about the situation. The third ‘peak’ is towards the middle- a pokemon is highly durable at a point where its HP and defense stats are at a certain proportion in between- one that is closer to, but not actually near, HP = Defense or Special Defense. This middle point is where you usually will be reaching for, because it is the one you can get closer to more easily.
Every pokemon has different stats, and some of them are naturally closer to one of these than the other. Shuckle and Bastiodon are both heavily leaned in the ‘HP one-half of defenses’ direction, where Blissey and Wailord are clearly on the ‘HP double of defenses’ side. Typically speaking, if you want the best durability increase payoff from your EV investment in either case, you will actually be reaching towards the average. After all, there’s a limit to how many EVs you can invest. Blissey hardly needs more HP, it really should be making better use of what it’s got- so you boost its defense and not its HP. Bastiodon has plenty of defenses, but not enough HP to spread the damage into- so you boost its HP and not either defense stat.
There are situations and pokemon where you’ll want an extreme, though, and it pays to be aware of those. These situations are brought about not by the pokemon or its stats, but by the moves you place on the pokemon. Three moves stand out in particular, though others do count as well, and these three moves are Pain Split, Leech Seed, and Substitute.
On a pokemon that uses Pain Split or Leech Seed, you want to tend towards HP equalling half the value of the defensive stats. This is because Pain Split and Leech Seed depend on the HP of your opponent most of all, and increase your pokemon’s HP by a set number. The bigger a part of your pokemon’s maximum HP that number represents, the more benefit you’re getting out of Pain Split and Leech Seed. This is why your Pain Split Dusknoir and your Leech Seed Jumpluff will want to have EVs invested in their defenses before their HP. This increases further if you’re using them with Substitute in their movesets, as Substitute basically caps the amount of damage they take from any attack at 1/4 their HP- and the faster they heal that HP, the better.
Substitute itself results in the opposite situation if it’s on something that doesn’t have Pain Split or Leech Seed. Because Night Shade and Seismic Toss exist, a lot of pokemon with poor offenses (Blissey, for instance) will use them to reliably cut an opponent’s HP by 100 every round that they manage to endure. Since Substitute has HP set at 1/4 of the creator’s HP, and few pokemon normally have over 400 HP, Night Shade and Seismic Toss will generally break a Substitute. If the Substitute’s HP are set over 100, though, your pokemon suddenly takes -two- such hits with every Substitute, doubling your holdout time against such pokemon and giving you twice as many chances to either recoup your HP loss or knock the opponent out. Because of this, a pokemon using Substitute that expects such moves will want at least enough HP investment in EV to have 101-HP substitutes- maybe even more than that. This gets even more drastic if the pokemon has Baton Pass, because a bigger substitute passed to something with higher defenses means even more added durability. So a pokemon that relies heavily on Substitute will want to approach the point where HP is twice its Defense stats.
For most pokemon, though, a more moderate measure is warranted- a good rule of thumb some use is to make Defense and Special Defense as equal as possible, raise them if you can while keeping them equal -and- leaving them at or moderately below HP, and then put any leftover EV you want to spend on defenses into HP. For most pokemon this is good enough to result in a high durability.