qooxdoo--面向对象介绍

qooxdoo是一个强大的JavaScript框架,它简化了面向对象编程(OOP)的使用,即使JavaScript本身对OOP的支持有限。本文介绍了qooxdoo中的主要面向对象概念:类(Class)、接口(Interface)、Mixins以及继承(Inheritance)。

原文: http://qooxdoo.org/documentation/0.8/oo_introduction

Introduction to Object Orientation
面向对象介绍

qooxdoo allows you to easily leverage many key concepts of object-oriented programming without bothering about limited native support in JavaScript.
qooxdoo让你很容易的利用许多面向对象编程的关键概念而不用为js有限的原生支持而烦恼

The main actors of qooxdoo OO are:

*
Classes
*
Interfaces
*
Mixins

When trying to get a grip of the framework code, you should probably understand all those three concepts. As a regular application developer you often get by just knowing how to use classes.   
当尝试了解框架代码时,你可能会不理解这三个概念,但作为一个常规应用程序的开发者你通常仅需要知道如何使用这些类。

Classes

A “class” is a central concept in most object-oriented languages, and as a programmer you are certainly familiar with it. qooxdoo supports a “closed form” of class declaration, i.e. the entire declaration is provided within a qx.Class.define(name, config) statement, where name is the fully-qualified class name, and config is a configuration map with various keys (or “sections”).
"类"在面向对象的语言里是一个核心概念,作为一个程序员你当然非常熟悉,qooxdoo支持一种"关闭形式"的类声明 ,即所有声明都由 qx.Class.define(name,config)来提供,其中参数name是完全限定类名(类名包含其完整命名空间),config是一个具有多个可选key的配置表(或者称为配置节点)

There are several types of classes available, which are specified by the type key within the config map:

*
regular class:常规类
May contain class variables/methods (in a statics section) and instance variables/methods (in a members section). An instance of the class can be created using the new keyword, so a constructor needs to be given in construct.
*
static class:静态类
Only contains class variables and class methods. Often a helper or utility class. Use type : “static”.
*
abstract class:抽象类
Does not allow an instance to be created. Typically classes derive from it and provide concrete implementations. type is abstract.
*
singleton:单例类
Not more than a single instance of the class may exists at any time. A static method getInstance() returns the instance. Use type : “singleton”.

Interfaces

qooxdoo’s interfaces are similar to the ones in Java. Similar to the declaration of class they are created by qx.Interface.define(name, config). They specify an “interface” (typically a set of empty methods), that classes must implement.
qooxdoo的接口和java中的相似, 相似之处在于声明(qooxdoo中由qx.Interfaces.define(name, config)来声明class的interface)。它们指定一个接口(由空方法组成的集合),该类就必须实现

Mixins

Mixins are a very practical concept that not all programming languages provide. Unlike interfaces, which require a class to provide concrete implementations to fulfill the interface contract, mixins do include code. This code needs to be generic, if it is “mixed into” different existing classes. Mixins usually cover only a single aspect of functionality and therefore tend to be small. They are declared by qx.Mixin.define(name, config).
Mixins是一个非常有用的概念,但不是所有语言都支持。不同于接口需要类为接口的契约提供具体的实现,Mixins包含代码,如果这些代码被"mixed into"到不同的已存在的类,它们需要一般化(并入Mixin的类)。
Mixins通常仅能覆盖某一方面功能,因此趋于小巧,它们由qx.Mixin.define(name, config)定义。

Inheritance

Like most programming languages qooxdoo only supports single-inheritance for classes, not multiple-inheritance, i.e. a class can only derive directly from a single super class. This is easily modeled by the extend key in the class declaration map.
和大多数语言一样,qooxdoo仅支持类的单继承,而非多继承,即

Since a class may implement/include one or many interfaces/mixins, which themselves can extend others, some advanced forms of multiple-inheritance could be realized.
具有可继承性的类可以 实现或包含 一个或更多 接口或mixins 来达到多继承的效果 。

 

基于遗传算法的新的异构分布式系统任务调度算法研究(Matlab代码实现)内容概要:本文档围绕基于遗传算法的异构分布式系统任务调度算法展开研究,重点介绍了一种结合遗传算法的新颖优化方法,并通过Matlab代码实现验证其在复杂调度问题中的有效性。文中还涵盖了多种智能优化算法在生产调度、经济调度、车间调度、无人机路径规划、微电网优化等领域的应用案例,展示了从理论建模到仿真实现的完整流程。此外,文档系统梳理了智能优化、机器学习、路径规划、电力系统管理等多个科研方向的技术体系与实际应用场景,强调“借力”工具与创新思维在科研中的重要性。; 适合人群:具备一定Matlab编程基础,从事智能优化、自动化、电力系统、控制工程等相关领域研究的研究生及科研人员,尤其适合正在开展调度优化、路径规划或算法改进类课题的研究者; 使用场景及目标:①学习遗传算法及其他智能优化算法(如粒子群、蜣螂优化、NSGA等)在任务调度中的设计与实现;②掌握Matlab/Simulink在科研仿真中的综合应用;③获取多领域(如微电网、无人机、车间调度)的算法复现与创新思路; 阅读建议:建议按目录顺序系统浏览,重点关注算法原理与代码实现的对应关系,结合提供的网盘资源下载完整代码进行调试与复现,同时注重从已有案例中提炼可迁移的科研方法与创新路径。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值