search

Home  >  Q&A  >  body text

html5 - Is there any programming paradigm useful for writing business in JavaScript?

Do you use object-oriented methods when writing business? I feel that unless you are writing a plug-in or a particularly obvious module that can use these, it seems that they are basically not used in regular business. Complex business is relatively thin and cannot be completely abstracted together. Since I started using mvvm, I feel like I don’t need to use it anymore, but the kind-hearted back-end staff keeps reminding me to do it, but I don’t feel that it’s easy to write. Maybe I’m not used to that kind of writing and thinking. Please give me some advice~

大家讲道理大家讲道理2778 days ago525

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 13:44:22

    题主的意思应该是类似 namespace 那种,后端人员一般不会去考虑,因为后端语言本身就是分好了的。他应该是担心你的代码function,变量,之间冲突的问题。题主说过mvvm,说明应该用过angular之类的框架。其实angular已经分好了。如果controller不在某个module下,是不会被调用的。
    如果不用mvvm的东西,简单的封装下:
    //按照业务逻辑
    var user_module={getName:function(){//to do}}
    var business_module={getBusinessName:function(){//to do}}
    //调用user_module.getName()

    In fact, es6 classes can also be used

    reply
    0
  • Cancelreply