当前位置: 首页 > news >正文

做销售找客户的网站如何建设营销型的网站

做销售找客户的网站,如何建设营销型的网站,看看铜陵新闻,网站后台用什么做服务器目录 摘要 C中的8大设计原则 1. 单一职责原则 (Single Responsibility Principle, SRP) 2. 开放封闭原则 (Open/Closed Principle, OCP) 3. 里氏替换原则 (Liskov Substitution Principle, LSP) 4. 依赖倒置原则 (Dependency Inversion Principle, DIP) 5. 接口隔离原则…目录 摘要 C中的8大设计原则 1. 单一职责原则 (Single Responsibility Principle, SRP) 2. 开放封闭原则 (Open/Closed Principle, OCP) 3. 里氏替换原则 (Liskov Substitution Principle, LSP) 4. 依赖倒置原则 (Dependency Inversion Principle, DIP) 5. 接口隔离原则 (Interface Segregation Principle, ISP) 6. 迪米特法则 (Law of Demeter, LoD) 7. 合成复用原则 (Composite Reuse Principle, CRP) 8. 最少知识原则 (Least Knowledge Principle, LKP) C中的23种设计模式 摘要 C 中的八大设计原则可以帮助我们创建高内聚、低耦合的代码。 C中的8大设计原则 1. 单一职责原则 (Single Responsibility Principle, SRP) - 一个类应该只有一个引起变化的原因即一个类只负责一个职责。可以提高类的可读性和可维护性降低类的复杂度但可能导致类的数量增加进而增加系统设计的复杂性。 class UserManager { public:void createUser(std::string username, std::string password) {// 创建用户}void deleteUser(std::string username) {// 删除用户}void generateUserReport(std::string username) {// 生成用户报告}void sendNotification(std::string message) {// 发送通知} };// 应用SRP后 class UserCreator { public:void createUser(std::string username, std::string password) {// 创建用户} };class UserDeleter { public:void deleteUser(std::string username) {// 删除用户} };class UserReporter { public:void generateUserReport(std::string username) {// 生成用户报告} };class NotificationSender { public:void sendNotification(std::string message) {// 发送通知} };2. 开放封闭原则 (Open/Closed Principle, OCP) - 软件实体类、模块、函数等应该对扩展开放对修改封闭。可以提高系统的可扩展性减少修改代码引入错误的风险但需要仔细设计抽象层次可能增加系统的复杂度。 class PaymentProcessor { public:void processPayment(std::string paymentType) {if (paymentType CreditCard) {// 处理信用卡支付} else if (paymentType PayPal) {// 处理PayPal支付}} };// 应用OCP后 class IPayment { public:virtual void processPayment() 0; };class CreditCardPayment : public IPayment { public:void processPayment() override {// 处理信用卡支付} };class PayPalPayment : public IPayment { public:void processPayment() override {// 处理PayPal支付} };class PaymentProcessor { public:void processPayment(IPayment* payment) {payment-processPayment();} };3. 里氏替换原则 (Liskov Substitution Principle, LSP) - 子类对象应该能够替换掉基类对象且程序的行为不变。可以保证继承体系的正确性增强代码的可替代性和可扩展性但可能需要更多的抽象和接口设计增加设计复杂度。 class Rectangle { public:virtual void setWidth(double width) {this-width width;}virtual void setHeight(double height) {this-height height;}double getArea() {return width * height;} protected:double width;double height; };class Square : public Rectangle { public:void setWidth(double width) override {this-width width;this-height width;}void setHeight(double height) override {this-width height;this-height height;} };void process(Rectangle r) {r.setWidth(5);r.setHeight(4);assert(r.getArea() 20); // Square 不能替代 Rectangle }4. 依赖倒置原则 (Dependency Inversion Principle, DIP) - 高层模块不应该依赖于低层模块二者都应该依赖于抽象抽象不应该依赖于具体具体应该依赖于抽象。可以减少类之间的耦合提高系统的灵活性和可维护性但需要更多的抽象和接口设计增加设计复杂度。 class Keyboard { public:std::string getInput() {return User input;} };class Monitor { public:void display(std::string text) {// 显示文本} };class Computer { public:void run() {std::string input keyboard.getInput();monitor.display(input);} private:Keyboard keyboard;Monitor monitor; };// 应用DIP后 class IInputDevice { public:virtual std::string getInput() 0; };class IOutputDevice { public:virtual void display(std::string text) 0; };class Keyboard : public IInputDevice { public:std::string getInput() override {return User input;} };class Monitor : public IOutputDevice { public:void display(std::string text) override {// 显示文本} };class Computer { public:Computer(IInputDevice* inputDevice, IOutputDevice* outputDevice): inputDevice(inputDevice), outputDevice(outputDevice) {}void run() {std::string input inputDevice-getInput();outputDevice-display(input);} private:IInputDevice* inputDevice;IOutputDevice* outputDevice; };5. 接口隔离原则 (Interface Segregation Principle, ISP) - 客户端不应该被迫依赖它不使用的方法即类间的依赖关系应该建立在最小的接口上。可以减少代码的冗余提高系统的灵活性和可维护性但可能导致接口数量增加进而增加系统设计的复杂性。 class IWorker { public:virtual void work() 0;virtual void eat() 0; };class Worker : public IWorker { public:void work() override {// 工作}void eat() override {// 吃饭} };class Robot : public IWorker { public:void work() override {// 工作}void eat() override {// 机器人不吃饭throw std::logic_error(Robots dont eat);} };// 应用ISP后 class IWorkable { public:virtual void work() 0; };class IFeedable { public:virtual void eat() 0; };class Worker : public IWorkable, public IFeedable { public:void work() override {// 工作}void eat() override {// 吃饭} };class Robot : public IWorkable { public:void work() override {// 工作} };6. 迪米特法则 (Law of Demeter, LoD) - 一个对象应该对其他对象有最少的了解即“只和你的直接朋友通信”。可以降低对象之间的耦合提高系统的模块化但可能增加系统的消息传递复杂度。 class Engine { public:void start() {// 启动引擎} };class Car { public:Engine* getEngine() {return engine;} private:Engine engine; };class Driver { public:void startCar(Car car) {car.getEngine()-start();} };// 应用LoD后 class Engine { public:void start() {// 启动引擎} };class Car { public:void start() {engine.start();} private:Engine engine; };class Driver { public:void startCar(Car car) {car.start();} };7. 合成复用原则 (Composite Reuse Principle, CRP) - 尽量使用对象组合而不是继承来达到复用的目的。这样可以减少类之间的耦合提高系统的灵活性但可能需要更多的对象管理代码增加系统的复杂度。 class Engine { public:void start() {// 启动引擎} };class ElectricEngine : public Engine { public:void start() override {// 启动电动引擎} };class Car { public:void start() {engine.start();} private:Engine engine; };// 应用CRP后 class Engine { public:virtual void start() 0; };class GasEngine : public Engine { public:void start() override {// 启动燃气引擎} };class ElectricEngine : public Engine { public:void start() override {// 启动电动引擎} };class Car { public:Car(Engine* engine) : engine(engine) {}void start() {engine-start();} private:Engine* engine; };8. 最少知识原则 (Least Knowledge Principle, LKP) - 一个对象应尽可能少地了解其他对象以减少相互依赖。可以降低对象之间的耦合提高系统的灵活性和可维护性但也有可能需要引入更多的接口或中介增加系统的复杂度。 class Engine { public:void start() {// 启动引擎} };class Transmission { public:void shiftGear() {// 换挡} };class Car { public:Engine* getEngine() {return engine;}Transmission* getTransmission() {return transmission;} private:Engine engine;Transmission transmission; };class Driver { public:void startCar(Car car) {car.getEngine()-start();car.getTransmission()-shiftGear();} };// 应用LKP后 class Engine { public:void start() {// 启动引擎} };class Transmission { public:void shiftGear() {// 换挡} };class Car { public:void start() {engine.start();transmission.shiftGear();} private:Engine engine;Transmission transmission; };class Driver { public:void startCar(Car car) {car.start();} };C中的23种设计模式 C中的23种设计模式_c设计模式-CSDN博客
http://www.hkea.cn/news/14525567/

相关文章:

  • 饶阳网站建设七星彩网站建设
  • django网站开发视频教程在线网页代理器
  • 合肥那家公司做网站短链接生成接口
  • 网站建设的建议例子黎平网站开发
  • python做网站的书哪里建设网站不需要备案
  • 住房和城乡建设部注册中心网站中国空间站建造历程
  • 网站推广营销怎么做广州网站建设出名 乐云践新
  • 网站里面的链接怎么做的珠海室内设计学校
  • 网站制作温州大英哪里有做网站的
  • 厦门专业做网站的公司销售网站有哪些
  • 做网站的那些高清图上哪里找广州市番禺区
  • 网站开发与设计实训巴中市建设厅官方网站
  • 织梦怎么制作手机网站聚美优品网站建设产品策略
  • 网站加v怎么做安徽网新科技网站建设介绍
  • 为什么自己做的网站uc打不开徐州城乡建设招投标网站
  • 哪个网站可以做破案h5沌口开发区网页设计
  • 做网站都需要考虑哪些网站网站开发犯法吗
  • 网站怎么做分享链接wordpress 调用别名
  • 公司招聘网站续费申请做网站什么笔记本好用
  • 有深度网站企业微信小程序制作
  • html5电影网站设计论文wordpress扁平化博客主题
  • 企业网站排名提升软件网络营销策略制定
  • 北京做网站建设的公司有哪些浏览器一打开就是2345网址导航
  • 与建设通相关的网站网站建设咨询电话
  • 网站建设加推广话术点击精灵seo
  • 阿里云网站建设程序杭州产品推广服务公司
  • 简单网站建设合同模板沧州 中企动力提供网站建设
  • 云空间可以做网站网站建设0doit
  • 太原北京网站建设公司男女做恩爱视频网站
  • 做个网站多少费用大连万词推广