html5 - Is there any programming paradigm useful for writing business in JavaScript?
大家讲道理
大家讲道理 2017-05-16 13:42:22
0
1
523

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~

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
迷茫
题主的意思应该是类似 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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template