Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Thursday, 8 March 2012

To var or not to var

When to var:
* Improve readability - where the repeated type is long and complex. For example:

When not to var:
* prime types

Resharper shortcut keys PDF

http://www.jetbrains.com/resharper/docs/ReSharper60DefaultKeymap_VS_scheme.pdf

Wednesday, 8 February 2012

programming scenarios

Since I really bad at creating scenarios, I'm going to make a collection here.

Crm scenarios:
* Update Next Birthday Using a Custom Workflow Activity.
* Create URL link using a custom WF step.
* Validate SSN (social security number) using javascript
* When an account's business phone number changed, all its child contact record need to be updated on that field too.

Friday, 20 January 2012

Unit Testing Principles

General Principles

Test anything that might break.
Test everything that does break.
New code is guilty until proven innocent.
Write at least as much test code as production code.
Run local tests with each compile.
Run all tests before check-in to the repository.
Questions to Ask

If the code ran correctly, how would I know?
How am I going to test this?
What else can go wrong?
Could this same kind of problem happen anywhere else?
What to Test: Use Your “Right BICEP”

Are the results right?
Are all the boundary conditions CORRECT?
Can you check inverse relationships?
Can you cross-check results using other means?
Can you force error conditions to happen?
Are performance characteristics within bounds?
Good tests are “A TRIP”

Automatic
Thorough
Repeatable
Independent
Professional
CORRECT Boundary Conditions

Conformance: Does the value conform to an expected format?
Ordering: Is the set of values ordered or unordered as appropriate?
Range: Is the value within reasonable minimum and maximum values?
Reference: Does the code reference anything external that isn’t under direct control of the code itself?
Existence: Does the value exist (for example, is non-null, non-zero, present in a set, and so on)?
Cardinality: Are there exactly enough values?
Time (absolute and relative): Is everything happening in order? At the right time? In time?