Design Principles (设计原则)
这是我在2018年4月写的英语演讲稿,可惜没人听得懂(实际上就没几个人在听)。
文章的内容是我从此前做过的项目中总结出来的经验,从我们的寝室铃声入手,介绍了可扩展性、兼容性与可复用性等概念,最后提出良好的设计应该平衡这些特性与性能、成本之间的三角关系。
第一次用英文写有一点专业性的东西,不知道算不算好。
以下为原文:
Design Principles
Intro
One day, on the noticeboard in our dormitory, there was a paper saying that the ring for rainy days cannot be added into the bell system in our dorm, and also, they won’t rebuild the system for us. I wondered why, because if the system were designed by me, anything could be easily added. Today, I’m not going to comment on their attitude or solution, but to show what a well-designed system should be like, or, what features should a well-designed system have.
Performance
No matter the system is made for yourself or for others, your design must meet the requirements.
The stick in my hand can display images when I’m shaking it. It has a microcontroller, running at 8MHz, to take control of the LED’s. If I used a microcontroller that could only run at 1MHz, it couldn’t display such complex words.
Cost
Obviously, the one at 8MHz is more expensive than the one at 1MHz. Usually the higher the performance, the more you should pay.
Some people build their computers with accessories chosen by themselves. They can be cheap or expensive, according to your choice. If you don’t pay attention to the balance between performance and cost, you’ll probably have a budget of 3’000 and finally spend 98’000.
This stick examines the frequency of shaking by a mercury switch. (If you are interested, I’ll explain its principle after class.) Another approach is to examine the direction of acceleration to get a more accurate position and frequency, which will be more expensive. However, I made it just for fun, so I didn’t want to spend more.
Extensibility
Performance and cost are basic, which everyone, when designing a system, can take into consideration. But engineering design is not such simple. From now on, I will introduce some professional concepts.
Extensibility is the ability to be extended or stretched, or the quality of being designed to allow the addition of new capabilities or functionalities.
Take an example. Some of you know my research project, which is to build a modular development system. It has pluggable boards and abstractions of every module in source code. The use of the system is quite simple but the usage is powerful: buy modules with functionalities you want, plug them together, write several lines of code, then, it works. The core module itself has limited functions, but by plugging and programming, all functionalities of other modules can be added, which means it has strong extensibility.
Compatibility
We need extensibility because the requirements may change, but what if it changes too much? We can design a new system, but we already have something useful in the previous system. Can they work together? A system with compatibility can.
Compatibility is the state of being compatible, in which two or more things are able to exist or work together in combination without problems or conflict. In your computer, sometimes you have to run a program in compatibility mode. The word here refers to backward or downward compatibility, which is a property that allows for interoperability with an older legacy system.
My modular system is a new concept, but there are already lots of traditional dev boards, a large number of users who are familiar with them, and an amount of valuable but not portable code. So, I’m going to program on other platforms to make my system compatible with them.
A complementary concept is forward compatibility. While backward compatibility can solve some historical problems, extensibility and forward compatibility can reduce the workload in the future.
Reusability
Since a system may upgrade, the unchanged parts in the previous version can be reused in the new version. Also, different systems may have something in common.
The modules in my modular system communicate on a bus. The microcontroller on this stick has access to the storage chip by the same kind of bus. Actually, in the source code of the stick, I just wrote an instruction to include the file in the former system. The source code of bus communication is reused.
Reusability is the state or quality of begin used more than once.
The bus of the stick is only used to transfer data from the storage chip to the microcontroller, but the whole functionality of bus communication is implemented. If I made the stick before the modular system, I may have integrated the storage operation with bus communication, which could make the program faster. But when building the modular system, I would have to redo the work.
Relationship among these features
Extensibility, compatibility and reusability have many emphasized properties in common, including modularity, high cohesion and low coupling. They are tightly linked.
All features above can be divided into 3 groups: performance, cost, and the other 3. An ideal system with high performance, low cost and many other features, can only exist in our mind. We cannot have everything at the same time.
As explained before, and also in your common sense, performance and cost are often incompatible.
If I use the modular system to make a simple project, you may think that it will be better to make a single board. Yes, I’ll need fewer boards, fewer chips, less code, and the program will run faster, which means higher performance. But what if I want to add more functionalities? I’ll have to redesign the board, resolder the board, and change lots of the code.
If I want to change the picture displayed by the stick, I must change the source code. An approach to avoid it is to add a Bluetooth module so that I can control it with my phone. But the price of a Bluetooth module is higher than the whole stick.
The 3 groups can form a triangle. You can’t make all of them the best at the same time. But you can do your best, which is to balance them. So, when you’re designing, think about as many aspects as you can. Don’t design a poor system like the one in our dorm.
Thank you.
Design Principles (设计原则)的更多相关文章
- Design Principle vs Design Pattern 设计原则 vs 设计模式
Design Principle vs Design Pattern设计原则 vs 设计模式 来源:https://www.tutorialsteacher.com/articles/differen ...
- 设计原则 Design Principle
Design Principle设计原则 最近由于碰到要参与设计一个音频处理系统,有人提议用一个大的全局变量结构体来做状态信息交流的地方,引起了我对设计一个系统的思考,于是找到了如下资料,当然,关于这 ...
- Android Wear - Design Principles for Android Wear(设计原则)
---------------------------------------------------------------------------------------------------- ...
- 翻译 | The Principles of OOD 面向对象设计原则
本文首发于vivo互联网技术微信公众号 https://mp.weixin.qq.com/s/Q_pziBUhKRywafKeY2T7YQ 作者:Robert C. Martin 翻译:张硕 本文由来 ...
- 设计模式-设计原则(Design Principle)
本文由@呆代待殆原创,转载请注明出处. 写在前面:所谓设计原则并不是一定要遵守的法则,只是一种建议,因为保持这些原则本身会有一定代价,若是这些代价超过了带来的好处就得不偿失了,所以一切还是以简单为准. ...
- 好RESTful API的设计原则
说在前面,这篇文章是无意中发现的,因为感觉写的很好,所以翻译了一下.由于英文水平有限,难免有出错的地方,请看官理解一下.翻译和校正文章花了我大约2周的业余时间,如有人愿意转载请注明出处,谢谢^_^ P ...
- RESTful API的设计原则
好RESTful API的设计原则 说在前面,这篇文章是无意中发现的,因为感觉写的很好,所以翻译了一下.由于英文水平有限,难免有出错的地方,请看官理解一下.翻译和校正文章花了我大约2周的业余时间, ...
- 优秀设计师应当知道的20大UI设计原则
世界级图形设计大师Paul Rand(保罗.兰德)曾经说过:"设计绝不是简单的排列组合与简单地再编辑,它应当充满着价值和意义,去说明道理,去删繁就简,去阐明演绎,去修饰美化,去赞美褒扬,使其 ...
- 好的RESTful API的设计原则
转载自一位大佬 英文原版 Principles of good RESTful API Design Good API design is hard! An API represents a cont ...
随机推荐
- HTML特殊编码转换
var encoded = ""'&<>¡¢£¤" + "¥¦§¨©ª«¬®" + "¯°±²³´µ¶·" ...
- Win10《芒果TV》商店版更新v3.1.3.0:优化应用速度,支持会员卡兑换
在微软秋季Win10/Surface新品发布会热潮之后,<芒果TV>UWP版迅速更新v3.1.3版,优化应用启动速度,支持会员卡券兑换,新增全网搜索.记忆播放.消息推送等功能. 芒果TV ...
- foreach获取索引值
List<" }; foreach (string item in items) { int index = items.IndexOf(item); Console.WriteLin ...
- Android零基础入门第16节:Android用户界面开发概述
原文:Android零基础入门第16节:Android用户界面开发概述 相信通过前面15期的学习,Android的开发环境已经基本掌握了,如果仍有问题,欢迎到Android零基础入门技术讨论微信群交流 ...
- Android零基础入门第45节:GridView简单使用
原文:Android零基础入门第45节:GridView简单使用 前面一共用了8期来学习ListView列表的相关操作,其实学习的ListView的知识完全适用于AdapterView的其他子类,如G ...
- Windows 10预装应用太多?一个命令删除!
Windows 10预装了很多应用软件,虽然有些其实也不难用,但是使用率可能比较低,很多人也不喜欢预装的东西,而且还占空间,那么这些预装的如何彻底清除呢? 其实微软是自带了命令可以执行这样的操作,用它 ...
- Delphi中无边框窗体应用程序使任务栏右键菜单有效的方法
最近在Delphi开发中用到了无边框窗体显示时,无法在任务栏使用右键弹出菜单的情况,经过整理,通过以下方法可以使右键菜单出现: procedure Tfrm_Base.InitSysMenu;var ...
- 阻止系统自动睡眠的小软件,附C#制作过程(执行SetThreadExecutionState API函数,让系统误判)
因为有时下载东西的时候,不想让电脑自动深入睡眠,所以就开启了离开模式.这样不但不节能环保,而且到真正想要睡眠的时候就是一翻蛋疼. 改过自新,关闭了离开模式,同时无操作30分钟后也会进入睡眠模式.但是在 ...
- 判断一个窗口是否被挂起(发WM_NULL消息,或者调用IsHungAppWindow API进行测试)
判断一个窗口是否被挂起了(就是没有响应了),在多窗口编程了经常会用到,在给别的窗口发消息前,为了目的窗口能确定收到消息,常常在之前先检测窗口是否被挂起了,我们以前常用的方式的是使用下面的方法: // ...
- better later than never
工作一年半,写程序也有几年了,终于开了个博客,记录一下遇到的问题和解决方法,和其他需要记录的东西.希望自己不会懒……已经开通两周了才开始写,唉……