1. F*An Anti-Pattern for Sustainable Software Development持续性软件开发的反模式 Perl Workshop Beijing 2009 Thibaud de Souza, London, UKtea.desouza@gmail.com http://www.oogtech.org
2. Agile & Architecture敏捷软件开发 & 架构 Agile is a software development methodology. There are few recognized or proposed ways in which agile interacts with software architecture.敏捷软件开发是一种流行方法,但敏捷性软件开发与架构建设交互的方法寥寥无几。 Architecture is an emergent property of medium to large scale software. This property is affected by design and process, and in turn affects maintainability and extensibility.架构是中到大型软件的突显特性, 受到设计和开发程序的影响, 并反过来影响软件的维护和延展性。 9/19/2009 2 tea.desouza@gmail.com
3. Layering & Stories分层 & 故事 Layering is a well known separation principle in software architecture - e.g. MVC meta-pattern. 分层是广为人知的软件架构分离原则 – 例如 MVC元模式。 End users and business stakeholders perceive software as a bunch of features. Agile uses iterations and stories to keep development focused on business needs. Stories and features cut across application layers. 终端用户和商业控股者视软件为功能的集合体。而敏捷开发利用循环和故事满足商业需求。故事和功能穿透应用程序的层次。 9/19/2009 3 tea.desouza@gmail.com
4. Problems with Layering分层带来的问题 Sooner (development) or later (maintenance), the business perspective hits the development process. At this point, layering mostly gets in the way of ‘making it work’. 无论是开发或维护阶段,或早或晚商业视角会涉足软件开发过程。这时,分层往往是阻挡实际运行的障碍。 Typically, pressure manifests itself as growing pains, hacks and patches - ultimately leading to corrupted software and mounting maintenance costs. 大多时候,压力显示为不断增长的麻烦,重新编写或修修补补 – 最终导致软件无法运行或堆积如山的维护问题。 9/19/2009 4 tea.desouza@gmail.com
5. Problems with Layering分层带来的问题 Refactoring and slack are agile remedies used to safeguard architectural integrity againstbusiness pressure. 敏捷开发通过重构和slack来对抗商业压力保护架构健全性 Unfortunately, many organisations are unwilling to allocate time to fixing stuff that already works. 不幸的是,很多机构不愿意分配时间来修补已经运行的东西 Could business pressure be channelled and used to shape software architecture, rather than working against it? 商业压力可不可以被导向来塑造软件架构,而不是摧毁它呢? 9/19/2009 5 tea.desouza@gmail.com
6. F* Features (‘value increments’) are recognizable elements of functionality that users value and understand. 功能特性(价值增量)是用户重视并理解的 F* is a meta-pattern using ‘strong feature separation’ (not directly related to feature driven development) F*是重度运用功能分离的元模式 (与以功能为导向的开发模式并不直接相关) F* has been tested by using it to create a critically small application (200 files / 350 kb) F*已通过一个小至中型的应用程序的开发测试(200个文件/ 350kb) 9/19/2009 6 tea.desouza@gmail.com
7. F* RequirementsF*必备要素 An application that instantiates F* is such that: 运用F* 的应用程序必须是: 1. Each top level package realises a unique feature. 每个最高层模块具备独特功能特性 2. All source code for a given feature can be removed in a single step. 某个功能特性的源代码必须可以一步消除 3. After a feature has been removed, the application must compile and run correctly. 某项功能被消除后,程序依然正常运行 Strong separation is achieved by ensuring that features are both logically and physically separated. 功能特性通过逻辑上和物理上的分离实现重度分离 9/19/2009 7 tea.desouza@gmail.com
8. Instantiating F* - Case StudyF*运用实例 F* is a separation model or meta-pattern. It can be instantiated in various ways and is open to some interpretation. F*是一种分离模式或元模式。可以通过多种方式甚至衍生方式运用 In this case, I am creating an IDE using a weightless application framework. 在这个例子中,我通过一个并不重要的应用程序框架制作了一个IDE(集成开发环境)。 As framework actors, features communicate using heavyweight, typed notifications: features import events and sometimes interfaces. 由于框架的作用,功能块通过功能强大并分类成型的通报来交流:功能块会引进事件有时甚至是界面 Features are listed in a text file. Any feature can be removed or replaced. 功能块都列在一个文本文件里。所有的功能都可以被剔除或取代。 9/19/2009 8 tea.desouza@gmail.com
9. Features, then...功能,然后是… Examples of what counts as a feature: 功能块的示例 (目前共40个):open-app, help, open-as-text, undo, undo-text-actions, usage-data, auto-update, new-file-or-directory, command-wizard, outline, coloured-syntax, ee-docs-skin, ...(currently 40) On average, each releasable feature used 4 classes and requires 3 man hours. 平均来说,每个成形的功能块有4个层次,需要3个工时 1/3 of the code consists in standalone utility classes. 1/3的代码由独立的工具类组成 Maybe 5 features are ‘support features’ that do not contribute a value increment. 约有5个功能块是支持性功能,并不贡献任何价值增量 9/19/2009 9 tea.desouza@gmail.com
10. Anti-Pattern?反模式? Strong separation allows a ‘rough and ready’ implementation style: maximise work not done. 重度分离使‘粗略’的开发模式成为可能:最大化未完成的工作 Some features create runtime components, other features collaboratively act upon such components. There is no structured application model or view. Some features are MVC, some are not. 有些功能产生runtime组件,其他的功能集体对这些组件产生影响。 没有成形的程序结构模型或概览。一些功能块是MVC, 其他的不是。 Features begin as spikes. Many features are plugged ‘as is’ without concern for internal elegance or structure. 功能块以实验的形式开始。许多功能块插入时好像没有考虑内部结构或其简明优雅性。 ‘Ad-hoc’ notifications. 临时通报 9/19/2009 10 tea.desouza@gmail.com
11. Technical Benefits技术好处 Fast and fun. Features are easy to write. You can literally hack them away. 高效有趣。功能块容易编写。 Maintainable. It’s easy to find bugs and easy to fix them. No fumbling across application layers. 易维护。容易发现并修补bug,不用在几个层次间一通瞎忙 Extensible. The pattern of connectivity between actors is scale-free; the number of notifications grows linearly. 延展性。各因素间的连接模式不受规模限制;连接模块的通报成线性增长。 9/19/2009 11 tea.desouza@gmail.com
12. Business Benefits商业好处 Mix and match. Features are easy to add, remove and replace. A feature set can be used to generate several applications.>> In this project, there are 3 products released and 2 products pending. 混搭。功能特性实现简单增加,消除和取代。一套功能块可产生多个应用程序。 >>就这个项目来说,已发布3个产品,2个产品即将完工 Short release cycle. 1 to 2 release per day if desirable (I release weekly). 发布周期短。最多一天可以发布2个产品。 Transparent, dynamic process. Progress with confidence; spot and seize opportunities. 透明,充满活力的开发过程。充满信心的开发过程,随时迎接机遇与变化。 9/19/2009 12 tea.desouza@gmail.com
13. Conclusion & Further Work结论 & 未来 ee-ide and ee-docs are freely available from oogtech.org. Another application, ee-xml has been released as freeware. ee-ide和ee-docs可在oogtech.org免费下载,ee-xml已作为共享软件发布。 The underlying platform, Kippu,supports external plugins. This allows decentralised, collaborative development using F*. 后台Kippu支持外部插件,运用F*分散协作开发成为现实。 Last, but not least, I am planning on using F* in game development and AI research. 未来,我计划运用F*进行游戏开发和人工智能研究。 9/19/2009 13 tea.desouza@gmail.com