1

https://en.wikipedia.org/wiki/Rule_of_least_power

Does it mean that if you can do an animation with css you should do it with css instead of using javascript. Or if you can do an application in javascript you should do it with javascript instead of other languages like php or java?

  • 1
    In terms of this concept, javascript is on the same power level as java and php, decidedly imperative. However one can choose to constrain the use of any of these languages to use less power. The css vs. javascript example is a better one for this concept. css is declarative. js is imperative. – joshp Jun 13 '16 at 0:20
  • 1
    And otherwise, as for the question of what you should do....that's a matter of opinion, many right answers. As a practical matter choosing css over a js implementation of the same capability is often a great idea. These decisions are beyond the scope of a simple rule. – joshp Jun 13 '16 at 0:21
  • I note that "power" is probably not the best name imaginable for what the article is talking about -- i.e. I'm not sure I agree that functional languages are less powerful than imperative ones -- but I can't really think of a better name for what the rule suggests avoiding. – Jules Jun 13 '16 at 12:02
1

Does it mean that if you can do an animation with css you should do it with css instead of using javascript

Pretty much this. Try to drag everything you can away from powerful tools (such as plain code) toward data : declarative languages (html/css), configuration...

Another example is pointer arithmetic. Modern languages avoided its use because it gave too much power (corrupting memory, accessing all the heap and stack) for the use of writing working software.

The drivers behind the rule are maintainance costs, because powerful tools are always more complex and error prone, and security, because reduced power means less ways of evil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.