In most cases, when a task can be performed in two different ways, and one of them is with "command", the other way is preferable, for two reasons:
The first reason is simply a matter of efficiency. In the above example, using "command" to change osnap ends up doing the same thing as seting "osnap" directly, it just involves a lot more processing. If your code performs a simple task that is quickly accomplished, this difference is not noticeable; it only makes a real difference if your code loops.
The second is that "command" means "run the command as if you were taking input from the user", in the same way as if you had written a macro. This means that all the additional "features" that Autocad adds during user input, and which may affect the result, are also applied. This can sometimes lead to unintended side-effects. For example, if you use "command" to draw lines without turning off osnaps first, you can get unpredictable results. It's usually best to perform each task in as explicit a fashion as possible.
Sometimes, however, it's preferable to use the "command" version. For example, if you WANT all the extra user-input features applied, go ahead and use the "command" version. And sometimes, the "command" version is much easier to use. For example, when I was recently trying to write a program to offset entities to the current layer instead of the object's layer, I used 'command ".offset"'', because after messing in vain with directional vaguaries of the LightWeightPolyline's offset method for a while, I decided it was much easier use the existing offset command and change the layer of the resulting entities.