Application Architecture

Define the components appropriately for the application and create project for each one.

What is Class?

3 Things: Visual Things, Business Things (Domain Entities), Application Things (like Logging & Email Generation)

3 Types: User interface classes, Domain entity classes, Library class

Class is a template or mold,specifies the traits or data,specifies the behavior or operations.

类是一种模板或模具,指定了具体数据或者是行为操作等。

Unit Testing

3 Advantages:

Higher Code Quality, Faster and Easier Debugging, Repeatable

Features:

Tests the behavior of a unit of code (often a method), Automated, Defined with code,Identifies errors

Tools:

MSTest, NUnit

Steps:

1.Define the test scenarios, 2.Generate the tests, 3.Execute the tests

Arrange -> Act -> Assert

FAQ

1.Why is a layer architecture important?

Logical components are easier to create,change,extend and maintain

Code are easier to reuse

2.What is a class?

A template for the objects created at runtime

Specifies the data and operations for each entity

3.What are the benefits of unit testing?

Higher quality code,faster and easier debugging,and they are repeatable over the life of the application

类定义中的访问修饰符

无或internal:只能在当前项目中访问类

public:可以在任何地方访问类

abstract或internal abstract:不能实例化,只能供继承之用(只能在当前项目中访问)

public abstract:同上,但可以在任何地方访问

sealed或internel sealed:不能供派生之用,只能实例化(只能在当前项目中访问)

public sealed:同上,但可以在任何地方访问

接口和抽象类

类似:

都不能实例化,都包含可以由派生类继承的成员。

区别:

1、派生类只能继承一个基类,但类可以继承任意多个接口。

2、抽象类的成员可以拥有代码体(即代码实现),而接口成员没有代码体,都必须在使用接口的类上实现。

3、接口成员是公共的,而抽象类的成员可以是private, protected, internal or protected internal。

4、接口不能包含字段、构造函数、析构函数、静态成员或常量。

C# Best Practices - Define Proper Classes的更多相关文章

  1. C# Best Practices - Building Good Classes

    Building a Class The last four refer as members Signature Accessiblity modifier (Default:internal) c ...

  2. C# Best Practices - Define Fields Appropriately

    Backing Fields private string description; private int productId; Features A variable in a class Hol ...

  3. MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.3 Displaying Classes in a Layer

    MapServer Tutorial——MapServer7.2.1教程学习——第一节用例实践:Example1.3 Displaying Classes in a Layer 一.前言 关于第一节的 ...

  4. [转]50 Tips for Working with Unity (Best Practices)

    About these tips These tips are not all applicable to every project. They are based on my experience ...

  5. Unity 最佳实践

    转帖:http://www.glenstevens.ca/unity3d-best-practices/ 另外可以参考:http://devmag.org.za/2012/07/12/50-tips- ...

  6. ExtJS笔记2 Class System

    For the first time in its history, Ext JS went through a huge refactoring from the ground up with th ...

  7. 6.Type and Member Basics

    1.The Different Kinds of Type Members 1.Constants:a symbol that identifies a never-changing data val ...

  8. Automake

    Automake是用来根据Makefile.am生成Makefile.in的工具 标准Makefile目标 'make all' Build programs, libraries, document ...

  9. Class loading in JBoss AS 7--官方文档

    Class loading in AS7 is considerably different to previous versions of JBoss AS. Class loading is ba ...

随机推荐

  1. delphi新语法之泛型实现的对象池模板

    现在的DELPHI因为支持泛型的语法,所以也能支持模板编程了.   // 标准模板 unit UntPools;   interface   uses   Classes, SysUtils, Unt ...

  2. genymotion 模拟器 真是牛叉了 速度超快啊!!! 不解释了!建议大家速度去体验一把吧!

    已经有人写了blog了 我就不再赘述了,详情去这里看去吧!!   android genymotion模拟器怎么使用以及和google提供的模拟器性能对比  http://blog.csdn.net/ ...

  3. selector是在文件夹drawable中进行定义的xml文件。

    获取Drawable对象: Resources res = mContext.getResources(); Drawable myImage = res.getDrawable(R.drawable ...

  4. css3 选择器的比较(一) -- 以字符串开头

    一.  以“字符串”开头 两种用法的区别是: a. 以字符串开头,需要用"-"分割开, b. 以字符串开头,不需要任何分隔符 1. 资料 a) b)  2. html代码 < ...

  5. SQL类型转换以及自动在前面补0满足10位工号标示法

    1,自动在前面补0满足10位工号标示法 SELECT rtrim(ltrim(right(cast('00000000'+rtrim(CAST(数值 as int)) as varchar(20)), ...

  6. Hadoop学习之shuffle过程

    转自:http://langyu.iteye.com/blog/992916,多谢分享,学习Hadopp性能调优的可以多关注一下 Shuffle过程是MapReduce的核心,也被称为奇迹发生的地方, ...

  7. mvn command is not recognized as an internal or external command

    even though I have configured %m2_home% and %path% correctly, the command "mvn" is still n ...

  8. Ubuntu14.04 64bit安装Android-Studio

    用PPA安装Android-Studio炒鸡简单,墙内亲测可用,就是速度慢了点.(睡觉时开着电脑装-) 安装Android-Studio 打开Terminal,执行: sudo add-apt-rep ...

  9. LaTeX技巧如何拆分源文件并且分别编译

    当处理很大的文档时,经常将文件分成若干个部分分别进行编译,这时我们可以使用LATEX所提供的命令 \input \include \includeonly \input{texfile} 文件名只需指 ...

  10. 【LeetCode题意分析&解答】38. Count and Say

    The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...