from http://dotnetperls.com/empty-string
Equality operator ==: 796 ms
string.Equals: 811 ms
string.IsNullOrEmpty: 312 ms
Length: 140 ms [fastest]
Instance Equals: 1077 ms
Using empty string methods
Here we see the five empty string tests shown in the graph and in the table above. Each of the five tests will be true, as the string str is empty. The code prints out the results of the tests, which you can see at the end.
=== Program that uses empty strings (C#) ===
class Program
{
static void Main()
{
// Example string
string str = "";
// Example tests
if (str == "")
{
// 1
// Test with op_Equality
System.Console.WriteLine(1);
}
if (string.Equals(str, ""))
{
// 2
// Test with static Equals method
System.Console.WriteLine(2);
}
if (string.IsNullOrEmpty(str))
{
// 3
// Test with IsNullOrEmpty
System.Console.WriteLine(3);
}
if (str.Length == 0)
{
// 4
// Test with Length property
System.Console.WriteLine(4);
}
if (str.Equals(""))
{
// 5
// Test with Equals method
System.Console.WriteLine(5);
}
}
}
Software Engineering, Programming Note
Personal notes ~
2010年3月15日 星期一
2010年3月3日 星期三
2009年6月1日 星期一
2009年3月15日 星期日
| from http://www.falconpl.org/index.ftd?page_id=facts | ||||||
| Falcon | Python* | Ruby | PHP5 | Lua | Perl | |
|---|---|---|---|---|---|---|
| Document Template | yes | no | no | yes | no | no |
| Native regular expressions | no | no | yes | no | no | yes |
| Coroutines | yes | no | partial | yes | no | yes | no |
| Multithreading | yes | partial | no | no | no | partial |
| Embeddability | high | low | low | no | high | low |
| C Dynamic Library Interface | yes | via ctypes | no | no | partial | no |
| Native internationalization | yes | no | no | no | no | no |
| Compile-time Metaprogramming | yes | no | no | no | no | no |
| Procedural programming | yes | partial | no | yes | yes | yes |
| Object oriented | yes | partial | yes | yes | no | partial |
| Prototype oriented | yes | partial | no | no | yes | partial |
| Functional programming | yes | no | no | no | no | no |
| Tabular programming | yes | no | no | no | no | no |
| Message programming | yes | no | no | no | no | no |
| Raw VM loop speed (2) | 1023 | 442 | 340 | 116 | 670 | 1247 | 369 |
| Direct binary data access | yes | no | no | no | no | no |
| Data sharing & reflection | yes | no | no | no | no | no |
| Virtual filesystem | yes (from 0.9) | no | no | yes | no | no |
| Library size | small | huge | large | Huge(3) | medium | huge |
| License | FPLL or GPL | Python | Custom or GPL | PHP | MIT | ARTISTIC or GPL |
2008年11月18日 星期二
物件導向設計(Object Oriented Analysis and Design)
轉自網路 http://ooadreason.blogspot.com/: 很吻合我的想法
物件導向設計(Object Oriented Analysis and Design)的精神在於將生活中的實際物件對應成系統裡的程式物件。簡單地說一下設計原則:
靜態物件(Data Model)的拆解原理如下:
有形的物件以一對一的原則生成Class
物件內能拆解出來的獨立物件也要有對應的Class
生成物件Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他物件Class表示可以取代現在物件的位置
輸出物件(View)的拆解原理如下:
頁面、區域、欄位等等可視物件與可拆解物件以一對一的原則生成Class
生成輸出Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他輸出Class表示可以取代現在物件的位置
除了靜態的物件,動態的動作(Controller)也需要拆解:
功能執行的流程邏輯由一個隱喻的Class來控制進行
每一個獨立動作視動作範圍拆解為一個方法或是另一個Class
生成動作Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他物件Class表示可以取代現在物件的位置而存在
如此一來,一個功能需求實作的基本Class組成與關係大致成形。
物件導向設計(Object Oriented Analysis and Design)的精神在於將生活中的實際物件對應成系統裡的程式物件。簡單地說一下設計原則:
靜態物件(Data Model)的拆解原理如下:
有形的物件以一對一的原則生成Class
物件內能拆解出來的獨立物件也要有對應的Class
生成物件Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他物件Class表示可以取代現在物件的位置
輸出物件(View)的拆解原理如下:
頁面、區域、欄位等等可視物件與可拆解物件以一對一的原則生成Class
生成輸出Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他輸出Class表示可以取代現在物件的位置
除了靜態的物件,動態的動作(Controller)也需要拆解:
功能執行的流程邏輯由一個隱喻的Class來控制進行
每一個獨立動作視動作範圍拆解為一個方法或是另一個Class
生成動作Class的同時為之定義一個專用的介面(提供置換用)
符合同樣介面的其他物件Class表示可以取代現在物件的位置而存在
如此一來,一個功能需求實作的基本Class組成與關係大致成形。
2008年11月11日 星期二
訂閱:
文章 (Atom)
追蹤網誌清單
IT Info
Reference
標籤
- 代討論
- 防盜
- 常規表示式(regular expression)
- 進度
- 電子地圖
- 網站搬家程式
- Ajax Library
- Application of Perl
- C#
- CakePHP
- Coding Convention
- CSS
- Data injection
- DBI
- Debug
- Diff Browser
- Effect : Slideshow
- Engineering - Desing Pattern
- framework
- Framework - CodeIgniter
- Functions
- Imgick
- jquery
- JS Framework
- JS Library
- JS Object : Statement
- Linux
- Mapping Other Language
- Need to Turnning
- NetBeans
- OOAD-MVC
- open source suit software
- Performance
- Perl Installation
- PHP Class
- PHP rpc Java
- PHP to PERL
- Presentation
- RIA
- Serculity
- Service
- SQL injection
- Tips
- Tools
- Variable
- Versus
- WCF
- WebSite Thumbnail
- XML
- ZK Ajax