看问题一定要选好角度,才好理解问题 别把问题想的太难 想什么框架啊 设计模式啊,别怕 我来告诉你
建立一个.net程序的时候 有什么
无非就是:类库,类,方法名 还有其他的吗? 没有了 所以以这个角度去理解框架和设计模式就比较简单了 就是让写的程序 好维护,好扩展
1:抽象类和接口
抽象类:面向过程:现在要做一个按摩程序,肯定会先分好,男人,女人,小孩 要去哪里按什么摩, 正常我们就会定义男人类,女人类,小孩类,然后在里面写实现方法 但是这是面向过程的编程
面向对象:把他们抽象起来为 人类, 男女老少都属于下面的子类
接口: 面向过程:有个USB接口程序, 定义个USB类,然后 安卓自己写个方法调usb,苹果自己写个方法调USB方法,再来十几个这不就乱套了吗,如果USB要改一下十几个都要改
面向对象:定义USB接口类,实现接口方法, 安卓,苹果统一调用USB的方法,如果USB有改动不影响安卓苹果, 只要接口入参正常就OK