Discussion by Roy Osherove of Typemock
View in the Blog: Iserializable.com
Open discussions from the group:
• Unit testing for Data Access
• Link to existing code (Legacy)
• Duplication between Unit Tests and function tests
• Other platforms or older languages
• Unit testing after refactoring
• Interface Testing
• Can you write unit tests w/ only what Visual Studio provides
Book: The Art of Unit Testing
http://The.ArtOfUnitTesting.com
Unit Testing should be a test of small functional pieces of code
What’s assumed is that it will make it easier to find bugs, which is not necessarily true because there can be errors in the text, it should make things easier to maintain (perhaps if you refactor your tests), and it will make it easier to understand the code, which may not necessarily be true if you’re not testing for the right things. However, if the prior three are correct, it should make it easier to develop.
Testing with a real world agenda:
• Make test trustworthy so that testers will run the tests
• Make sure you are testing the right things
• Make the test fail first, then work on making it pass (make it fail when it should, and pass when it should)
Assuring code coverage—that you have created testing in all the necessary areas.
Avoid testing logic
• No Ifs, SWITCHs, or CASEs
• Only create, configure, act and assert
• Test logic = test bugs (don’t repeat the same algorithm in your test as you use in the app because the app logic may have a bug)
• State-based testing
• Make tests easy to run—try to make all the tests run from the click of one button
• Create maintainable tests--test only public APIs (testing private makes the test brittle)
• Reuse test code as much as possible, don’t write a new test for each piece of logic
File Structure—for each project create a test project with the same name and add a suffix like “_Test”. You may want to create a test file for each class in the project.
Avoid multiple Asserts
Don’t over specify
Avoic Mocks if you can, although, you have to do it sometimes in order to return something back into the calling class
Another good book: Working Effectively with Legacy Code – Michael Feathers
Tools: ReSharper Tool, Rinomox
Sunday, June 8, 2008
Developing High Performance JavaScript, AJAX, and Layout for Microsoft Explorer 8
Cyra Richardson
Senior Program Manager Lead – Microsoft Corp.
cyrar@microsoft.com
JavaScript Coding Inefficiencies (IE7 Only):
Background: String concatenation
Recommendation: Array.join for string concatenation instead of doing a plus equals on a large string and continue adding to it.
IE8 JavaScript Improvements:
Strcat is faster for large and small strings better than ArrayJoin
Strings are not flattened until the are pass to DOM
Str canlls may flatten strings
Array lookup is faster
Array.Push and Array.Pop are faster
Background: Costs for using EVAL
Download
Build string
Construct new script execution context
Lookup string
Parse
Execution
JavaScript – SWITCH becomes costly for large sets
Problem: Switch processing time grows linearly
Consider: Hash Table wrapped in Try, Catch
Why: JS does not optimize SWITCH
JavaScript – WITH
Problems: Increased symbol lookup time everywhere
Better control over Jscript Closures
Property Accessor Functions (get/set)
Problems: Increases cycles to access values
Consider: Directly modifying variables
Why: Inserts and additional symbol lookup
IE Performance Considerations:
Instantiating DPM functions
Problems: Costly (in CPU cycles)
Consider: Get ElementById, QuerySelectAll, Node.NextSibling
Why: Platform Genericness
Accessing/Traversing DOM properties
Traversing Sibling Nodes
Accessing DOM
* DOM methods are faster to get items than InnerHTML
* GetElementByID better than walking the HTML
* QuerySelectorAll
First visit interactions
Reoccurant visit interactions
Request from Server/Download from Cache
Cache content for subsequent visits
Conditional HTTP Requests
Plain HTTP Request
Pragma: no-cache
Recommendation: For subsequent Visits – Cache Control
• Time Conditional--If-modified-since: datetime
• ETAG Conditional--If-none-match: etagvalue
Tools And Techniques
• Developer Toolbar
• Fiddler—XML HTTP request monitor
• AJAXView--by Microsoft Research. Like Fiddler and watches your javascript functions and tells you how much time each step takes.
“High Performance Websites”-- (great book) by Steve Souders
Solving Performance Problems:
• Identify the type of performance problem
• Network/Bandwidth – use Fiddler
• JavaScript – use DevToolbar
• Aggressive DOM access – using DevToolbar
Reduce, Simplify, Re-factor
Reduce the bytes sent between client and server
Simplify your code to avoid costly JavaScript constructs
Cache DOM properties and function pointers
Use Try/Catch instead of a big SWITCH
Senior Program Manager Lead – Microsoft Corp.
cyrar@microsoft.com
JavaScript Coding Inefficiencies (IE7 Only):
Background: String concatenation
Recommendation: Array.join for string concatenation instead of doing a plus equals on a large string and continue adding to it.
IE8 JavaScript Improvements:
Strcat is faster for large and small strings better than ArrayJoin
Strings are not flattened until the are pass to DOM
Str canlls may flatten strings
Array lookup is faster
Array.Push and Array.Pop are faster
Background: Costs for using EVAL
Download
Build string
Construct new script execution context
Lookup string
Parse
Execution
JavaScript – SWITCH becomes costly for large sets
Problem: Switch processing time grows linearly
Consider: Hash Table wrapped in Try, Catch
Why: JS does not optimize SWITCH
JavaScript – WITH
Problems: Increased symbol lookup time everywhere
Better control over Jscript Closures
Property Accessor Functions (get/set)
Problems: Increases cycles to access values
Consider: Directly modifying variables
Why: Inserts and additional symbol lookup
IE Performance Considerations:
Instantiating DPM functions
Problems: Costly (in CPU cycles)
Consider: Get ElementById, QuerySelectAll, Node.NextSibling
Why: Platform Genericness
Accessing/Traversing DOM properties
Traversing Sibling Nodes
Accessing DOM
* DOM methods are faster to get items than InnerHTML
* GetElementByID better than walking the HTML
* QuerySelectorAll
First visit interactions
Reoccurant visit interactions
Request from Server/Download from Cache
Cache content for subsequent visits
Conditional HTTP Requests
Plain HTTP Request
Pragma: no-cache
Recommendation: For subsequent Visits – Cache Control
• Time Conditional--If-modified-since: datetime
• ETAG Conditional--If-none-match: etagvalue
Tools And Techniques
• Developer Toolbar
• Fiddler—XML HTTP request monitor
• AJAXView--by Microsoft Research. Like Fiddler and watches your javascript functions and tells you how much time each step takes.
“High Performance Websites”-- (great book) by Steve Souders
Solving Performance Problems:
• Identify the type of performance problem
• Network/Bandwidth – use Fiddler
• JavaScript – use DevToolbar
• Aggressive DOM access – using DevToolbar
Reduce, Simplify, Re-factor
Reduce the bytes sent between client and server
Simplify your code to avoid costly JavaScript constructs
Cache DOM properties and function pointers
Use Try/Catch instead of a big SWITCH
Saturday, June 7, 2008
Conference Summary
The TechEd conference for 2008 has concluded and we are all very tired from 5 full days of learning. Overall the experience was good. The highlights for this year was the release of Visual Studio 2008 (Released already), SQL Server 2008 (Release date 06/2008), Silverlight (1.0 released already and 2.0 in November) and some interesting Mobile features (Available Now).
I recommend that we migrate to Visual Studio 2008 as soon as possible and that we find a way to incorporate Silverlight into our development standards. VSTS 2008 adds several new and exciting features to improve our development process. Silverlight is a "Flash" type software that will help spruce up the UI without the help of graphic designers. Last but not least, we saw some mobile features that would allow the mobile devise to connect to our domain which would then allow the users to access our applications. Of course we would have to write some of them to work with the mobile device.
In conclusion, I want to thank Bob for allowing us to attend the conference as I gained a lot of valuable information. All the Microsoft resources are available in one place. If you don't understand something all you have to do is ask one of the experts.
This years conference was a little different in that they split the developer and the IT conference. There were only half the amount of people this year which was good. The food was terrible, but good enough for us not to have to eat out for breakfast and lunch.
Overall I think the conference was a success and I am very glad I had the opportunity to attend.
I recommend that we migrate to Visual Studio 2008 as soon as possible and that we find a way to incorporate Silverlight into our development standards. VSTS 2008 adds several new and exciting features to improve our development process. Silverlight is a "Flash" type software that will help spruce up the UI without the help of graphic designers. Last but not least, we saw some mobile features that would allow the mobile devise to connect to our domain which would then allow the users to access our applications. Of course we would have to write some of them to work with the mobile device.
In conclusion, I want to thank Bob for allowing us to attend the conference as I gained a lot of valuable information. All the Microsoft resources are available in one place. If you don't understand something all you have to do is ask one of the experts.
This years conference was a little different in that they split the developer and the IT conference. There were only half the amount of people this year which was good. The food was terrible, but good enough for us not to have to eat out for breakfast and lunch.
Overall I think the conference was a success and I am very glad I had the opportunity to attend.
Taking Applications to the Next level with Data Mining
Why Data Mine
- Too much Data not enough Info
- Enables Data exploration
- Use to solve following Buisness Scenarios
- Identify responsive and unresponsive customers
- Detect fraud
- Target Promos
- Forcast Sales
- Cross-selling
Whats in SQL 2008
- Has 9 Algorithims to extract Data
- Decisions Trees - Most Popular
- Clustering - Finds naturl groupings
-Sequence Clustering
- Naive Bayes
- Line Regression
- Logistic Regression
- Association Rules
- Time Series
- Neural Net
Data Preparation
- Significant amount work is normally involved in getting data ready for Data Mining. It helps greatly if you plan for this when designing your Database.
Data Mining Visualization
-OLTP and OLAP will return exactly what is asked, be careful you ask for thins correctly
-Can use Analysis Services Project in VS to help
- Too much Data not enough Info
- Enables Data exploration
- Use to solve following Buisness Scenarios
- Identify responsive and unresponsive customers
- Detect fraud
- Target Promos
- Forcast Sales
- Cross-selling
Whats in SQL 2008
- Has 9 Algorithims to extract Data
- Decisions Trees - Most Popular
- Clustering - Finds naturl groupings
-Sequence Clustering
- Naive Bayes
- Line Regression
- Logistic Regression
- Association Rules
- Time Series
- Neural Net
Data Preparation
- Significant amount work is normally involved in getting data ready for Data Mining. It helps greatly if you plan for this when designing your Database.
Data Mining Visualization
-OLTP and OLAP will return exactly what is asked, be careful you ask for thins correctly
-Can use Analysis Services Project in VS to help
Friday, June 6, 2008
UnderStanding ADO.NET Entinty Framework
by Erik Thompson -- ereckt@microsoft.com
Why the Entity Model
- Bridge Gap between OOP and relational databases
- Complex Types
- Your Data Model is not tightly bound to your DB
Creating Model
- EDM is represented as XML
- Use Ado Entity Designer -in vs2008 sp1
- Start Blank or from a Database
- Supports Many- to -Many relationships
- Entity Framework Requires 3 artifacts
- Model -CSDL
- Definition of Store - SSDL
- Mapping between the 2 - MSL
Programming Against it
- Enity Types
- CLR versions of EDM entities generallt generated by Tools
- Object Services
-LINQ
- Used to query against the generated classes
- Entity SQL
-SQL Variant for working in EDM
-String based not SQL
- Always keep entities attached to Object services
- Relationships are single worst stumbling blocks of EDM
Why the Entity Model
- Bridge Gap between OOP and relational databases
- Complex Types
- Your Data Model is not tightly bound to your DB
Creating Model
- EDM is represented as XML
- Use Ado Entity Designer -in vs2008 sp1
- Start Blank or from a Database
- Supports Many- to -Many relationships
- Entity Framework Requires 3 artifacts
- Model -CSDL
- Definition of Store - SSDL
- Mapping between the 2 - MSL
Programming Against it
- Enity Types
- CLR versions of EDM entities generallt generated by Tools
- Object Services
-LINQ
- Used to query against the generated classes
- Entity SQL
-SQL Variant for working in EDM
-String based not SQL
- Always keep entities attached to Object services
- Relationships are single worst stumbling blocks of EDM
TechEd Night at Universal
Microsoft rented Universal Studios theme park last night for 3 hours of free food, drink and rides. Although, they did close off about 1/4 of the park. Didn't get to ride the Mummy or Jimmy Newtron because they were in that part of the park. Lines were a little better than last year and we got to check out the replacement for Back To The Future. It is a Simpson's ride that is very similar to the old one, but in cartoon format. Pretty neat.
Julia will not be coming back to work because she was the star of her on movie called Disaster! You should see her now with her star sun glasses! :) Men in black was the other attraction that we got on. The best part was being able to eat and drink anything in the park, although I did not partake in any alcoholic beverage.
So there you have it, our night out on Microsoft(not). Off I go!
Julia will not be coming back to work because she was the star of her on movie called Disaster! You should see her now with her star sun glasses! :) Men in black was the other attraction that we got on. The best part was being able to eat and drink anything in the park, although I did not partake in any alcoholic beverage.
So there you have it, our night out on Microsoft(not). Off I go!
New Windows Mobile Entriprise Archetecture
Current 4 types of data Networks
- CDMA -This is generally what is found in the US
-GSM - This is generally what is found rest of the world, tho is also inUS some
-UMTS - Is an upgrde of GSM, to work more like CDMA
-OFDM - Is the technolgy befind wi-fi, and wi-max networks
System Center Mobile Device Manager (is windows server for mobile devices)
-Using mobile 6.1 can have moble devices join a domain (using mobile vpn)
-This allows mobile devices to be like computer on local domain so the can access intranet content without difficulty
-Makes it easier for company to push setting they want to mobile users
-Server keeps mobile vpn sessions even if mobile device is fading in and out of coverage
-Uses Direct Push Technology - Exchange knows where you phone is and will push items out to you, even works on Iphones
-Uses Queing, means it will only push out stuff whan it knows it will succede
Mobile Merge Replication
-Integrated with SQL2005
-used to sync with Databases on Mobile devices
-has wizards to build filters for what is pushed out
-Sql2008 -Sync Services for Ado.net
-Sends data litltle at a time, can set what size batch you want to send
Mobile Web to Terminal Services
-Can terminal server so you can use apps not degined for mobile
- CDMA -This is generally what is found in the US
-GSM - This is generally what is found rest of the world, tho is also inUS some
-UMTS - Is an upgrde of GSM, to work more like CDMA
-OFDM - Is the technolgy befind wi-fi, and wi-max networks
System Center Mobile Device Manager (is windows server for mobile devices)
-Using mobile 6.1 can have moble devices join a domain (using mobile vpn)
-This allows mobile devices to be like computer on local domain so the can access intranet content without difficulty
-Makes it easier for company to push setting they want to mobile users
-Server keeps mobile vpn sessions even if mobile device is fading in and out of coverage
-Uses Direct Push Technology - Exchange knows where you phone is and will push items out to you, even works on Iphones
-Uses Queing, means it will only push out stuff whan it knows it will succede
Mobile Merge Replication
-Integrated with SQL2005
-used to sync with Databases on Mobile devices
-has wizards to build filters for what is pushed out
-Sql2008 -Sync Services for Ado.net
-Sends data litltle at a time, can set what size batch you want to send
Mobile Web to Terminal Services
-Can terminal server so you can use apps not degined for mobile
Subscribe to:
Posts (Atom)