Programming
Study Notes for 70-486 - Developing ASP.NET MVC 4 Web Applications
0After the 70-480 Programming HTML5 and CSS 3 Exam, I finally got around to taking 70-486 - Developing ASP.NET MVC 4 Web Applications which gets me 2/3 towards the destination for MCSD: Web Applications. Following are the set of notes I used along with MCT material which may help those preparing for the exam. The topic-by-topic breakdown is courtesy of a colleague and friend Frank Liao.
Design the Application Architecture
-
Plan the application layers.
-
This objective may include but is not limited to: plan data access; plan for separation of concerns; appropriate use of models, views, and controllers; choose between client-side and server side processing; design for scalability
-
-
Design a distributed application. [link]
-
Design and implement the Windows Azure role life cycle. [link link link link]
-
Configure state management.
-
This objective may include but is not limited to: choose a state management mechanism (in-process and out of process state management, ViewState); plan for scalability; use cookies or local storage to maintain state; apply configuration settings in web.config file; implement sessionless state (for example, QueryString) [link]
-
-
Design a caching strategy.
-
This objective may include but is not limited to: implement page output caching (performance oriented); implement data caching; implement HTTP caching
-
-
Design and implement a Web Socket strategy. [link]
-
This objective may include but is not limited to: read and write string and binary data asynchronously (long-running data transfers); choose a connection loss strategy; decide a strategy for when to use Web Sockets
-
Design the User Experience
-
Apply the user interface design for a web application.
-
This objective may include but is not limited to: create and apply styles by using CSS; structure and lay out the user interface by using HTML; implement dynamic page content based on a design
-
-
Design and implement UI behavior.
-
This objective may include but is not limited to: implement client validation; use JavaScript and the DOM to control application behavior; extend objects by using prototypal inheritance; use AJAX to make partial page updates [link]; implement the UI by using JQuery
-
-
Compose the UI layout of an application.
-
Enhance application behavior and style based on browser feature detection. [link link link link]
-
This objective may include but is not limited to: detect browser features and capabilities; create a web application that runs across multiple browsers and mobile devices; enhance application behavior and style by using vendor-specific extensions, for example, CSS
-
-
Plan an adaptive UI layout.
-
This objective may include but is not limited to: plan for running applications in browsers on multiple devices (screen resolution, CSS, HTML); plan for mobile web applications [link]
-
Develop the User Experience
-
Plan for search engine optimization and accessibility.[link]
-
Plan and implement globalization and localization. [link link link link link]
-
This objective may include but is not limited to: plan a localization strategy; create and apply resources to UI including JavaScript resources; set cultures; create satellite resource assemblies
-
-
Design and implement MVC controllers and actions.
-
Control application behavior by using MVC extensibility points.
-
Reduce network bandwidth.
Troubleshoot and Debug Web Applications
-
Prevent and troubleshoot runtime issues.
-
This objective may include but is not limited to: troubleshoot performance, security, and errors;implement tracing, logging (including using attributes for logging) [link], and debugging (including IntelliTrace) [link link]; enforce conditions by using code contracts [link link]; enable and configure health monitoring (including Performance Monitor) [link]
-
-
Design an exception handling strategy. [link link]
-
This objective may include but is not limited to: handle exceptions across multiple layers; display custom error pages using global.asax or creating your own HTTPHandler or set web.config attributes; handle first chance exceptions
-
-
Test a web application.
-
This objective may include but is not limited to: create and run unit tests, for example, use the Assert class, create mocks; create and run web tests
-
-
Debug a Windows Azure application.
-
This objective may include but is not limited to: collect diagnostic information by using Windows Azure Diagnostics API Implement on demand vs. scheduled; choose log types, for example, event logs, performance counters, and crash dumps [link]; debug a Windows Azure application by using IntelliTrace [link] and Remote Desktop Protocol (RDP) [link link]
-
Design and Implement Security
-
Configure authentication.
-
This objective may include but is not limited to: authenticate users; enforce authentication settings; choose between Windows [link], Forms [link link], and custom [link] authentication; manage user session by using cookies [link]; configure membership providers [link]; create custom membership providers [link]
-
-
Configure and apply authorization. [link]
-
Design and implement claims-based authentication across federated identity stores. [link]
-
This objective may include but is not limited to: implement federated authentication by using Windows Azure Access Control Service [link]; create a custom security token by using Windows Identity Foundation [link]; handle token formats (for example, oAuth, OpenID, LiveID, and Facebook) for SAML and SWT tokens [link link link link]
-
-
Manage data integrity. [link]
-
Implement a secure site with ASP.NET. [link]
-
This objective may include but is not limited to: secure communication by applying SSL certificates; salt and hash passwords for storage [link link]; use HTML encoding to prevent cross-site scripting attacks (ANTI-XSS Library) [link link]; implement deferred validation [link] and handle unvalidated requests [link], for example, form, querystring, and URL [link]; prevent SQL injection attacks by parameterizing queries [link]; prevent cross-site request forgeries (XSRF) [link]
-
Cloud Computing and CQRS Resources
MSDN Blogs: Cloud Architecture Series - CQRS Part 1 (Bruno Terkaly)
MSDN Magazine: CQRS on Windows Azure (Mark Seeman)
http://msdn.microsoft.com/en-
http://www.amazon.com/
http://www.h-online.com/
CQRS Starting Page (Rinat Abdullin)
http://abdullin.com/cqrs/
The Best Way to Learn CQRS, DDD, and Event SOurcing (Rinat Abdullin)
http://abdullin.com/journal/
MSDN: CQRS Journey Project
http://msdn.microsoft.com/en-
Slides: CQRS: Command/Query Responsibility Segregation
http://www.slideshare.net/
Slides: CQRS and Event Sourcing, An Alternative Architecture for DDD (Dennis Doomen)
http://www.slideshare.net/
http://abdullin.com/storage/
Writing High Quality Code in C# by Svetlin Nakov
This is an excellent presentation by Svetlin Nakov of Telerik which I thoroughly enjoyed and decided to share it via my blog. Following is the abstract.
The author introduces the principles of high-quality programming code construction during the software development process. The quality of the code is discussed in its most important characteristics – correctness, readability and maintainability. The principles of construction of high-quality class hierarchies, classes and methods are explained. Two fundamental concepts – “loose coupling” and “strong cohesion” are defined and their effect on the construction of classes and subroutines is discussed. Some advices for correctly dealing with the variables and data are given, as well as directions for correct naming of the variables and the rest elements of the program. Best practices for organization of the logical programming constructs are explained. Attention is given also to the “refactoring” as a technique for improving the quality of the existing code. The principles of good formatting of the code are defined and explained. The concept of “self-documenting code” as a programming style is introduced.
Enterprise Node Advocacy Talk
Node.js adaptability in a medium to large, regulated enterprise can be quite challenging; various process items including risk & compliance, OSS, supportability, static-code analysis, IDE/SC integration info-sec concerns etc need to be addressed before any new technology can be adapted.
My co-worker Daniel Imrie-Situnayake did a great presentation on this very topic titled "Within the Whale: a story of enterprise Node advocacy from the inside out".
WCF vs. ASP.NET Web API – An Architect’s Primer - Speaking to Southern California .NET Architecture Users Group
I will be speaking to the next Southern California .NET Architecture Users Group - IASA chapter meeting will be Thursday February 21, 2013 at Rancho Santiago Community College District, 2323 N. Broadway, Santa Ana.
Meeting starts at 7:00 pm, pizza and networking 6:30 pm. Abstract follows.
WCF vs. ASP.NET Web API – An Architect’s Primer
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. The new ASP.NET Web API is a continuation of the previous WCF Web API projection. WCF was originally created to enable SOAP-based services and other related bindings. However, for simpler RESTful or RPCish services (think clients like jQuery) ASP.NET Web API is a good choice.
In this meeting we discuss what do you need to understand as an architect to implement your service oriented architecture using WCF or ASP.NET web API. With code samples, we will elaborate on WCF Web API’s transition to ASP.NET Web API and respective constructs such as Service vs. Web API controller, Operation vs. Action, URI templates vs ASP.NET Routing, Message handlers, Formatters and Operation handlers vs Filters, model binders. WebApi offers support for modern HTTP programming model with full support for ASP.NET Routing, content negotiation and custom formatters, model binding and validation, filters, query composition, is easy to unit test and offers improved Inversion of Control (IoC) via DependencyResolver.
You will walk away with a sample set of services that run on Silverlight, Windows Forms, WPF, Windows Phone and ASP.NET.
Downloads: Slides and Source
Study Notes for 70-480 Programming HTML5 and CSS 3 Exam
Having recently taken 70-480 Programming HTML5 and CSS 3 Exam, I think these notes I made may help those preparing for the exam. The topic-by-topic breakdown is courtesy of a colleague and friend Frank Liao.
- Exam 70-480: Programming in HTML5 with JavaScript and CSS3
- Exam 70-480 Study Material: Programming in HTML5 with JavaScript and CSS3
- Videos - Jump start from Microsoft Virtual academy:
- Some Specifics
- Jquery
- onblur Event
- Regex Validation
- HTML5 Form Validation Examples
- HTML <input> value Attribute
- HTML <Aside> tag
- jquery to goto a url on form submit with field values added to the url string
- DecodeURIComponent
- Best HTML5 markup for sidebar
- CSS text-transform Property
- HTML5 Inline SVG
- What is the difference between decodeURIComponent and decodeURI?
Implement and Manipulate Document Structures and Objects (24%)
- Create the document structure. [link link]
- Write code that interacts with UI controls.
- Apply styling to HTML elements programmatically. [link]
- Implement HTML5 APIs.
- Establish the scope of objects and variables.
- Create and implement objects and methods. [link link]
- This objective may include but is not limited to: implement native objects [link];
Implement Program Flow (25%)
- Implement program flow.
- Raise and handle an event.
- Implement exception handling.
- Implement a callback.
- Create a web worker process. [link link]
Access and Secure Data (26%)
- Validate user input by using HTML5 elements. [link]
- Validate user input by using JavaScript.
- Consume data.
- Serialize, deserialize, and transmit data. [link]
- This objective may include but is not limited to: binary data [link]; text data (JSON, XML) [link link link]; implement the JQuery serialize method [link]; Form.Submit [link]; parse data [link link link]; send data by using XMLHTTPRequest [link]; sanitize input by using URI/form encoding [link link]
Use CSS3 in Applications (25%)
- Style HTML text properties.
- apply styles to text appearance (color [link], bold [link], italics [link]); apply styles to text font (WOOF and @font-face, size, understudy fonts) [link]; apply styles to text alignment [link], spacing [link], and indentation [link]; apply styles to text hyphenation [link]; apply styles for a text drop shadow [link]
- Style HTML box properties.
- This objective may include but is not limited to: apply styles to alter appearance attributes (size [link link], border [link] and rounding border corners [link link], outline [link], padding [link], margin [link]); apply styles to alter graphic effects (transparency, opacity [link], background image [link], gradients [link], shadow [link], clipping [link link]); apply styles to establish and change an element’s position (static, relative, absolute, fixed) [link]
- Create a flexible content layout.
- This objective may include but is not limited to: implement a layout using a flexible box model [link]; implement a layout using multi-column [link]; implement a layout using position floating and exclusions [link]; implement a layout using grid alignment [link]; implement a layout using regions [link], grouping, and nesting [link]
- Create an animated and adaptive UI.
- Find elements by using CSS selectors and JQuery. [link]
- Structure a CSS file by using CSS selectors. [link]
Refactoring Code to a S.O.L.I.D. Foundation - Speaking @ IE.NET UG
Tonight I will be speaking to Inland Empire .NET users group talking about "Refactoring Code to a S.O.L.I.D. Foundation". Abstract and meeting info follows.
Abstract: SOLID is a mnemonic acronym coined by Robert C. Martin (aka Uncle Bob) referring to a collection of design principles of object-oriented programming and design. By using these principles, developers are much more likely to create a system that more maintainable and extensible. SOLID can be used to remove code smells by refactoring. In this session, you will learn about the following SOLID principles with code examples demonstrating the corresponding refactoring.
S - Single Responsibility Principle - An Object should have only one reason to change.
O - Open/Closed Principle - A software entity(module, library, routine) should be closed to any modification but be open to extension
L - Liskov Substitution Principle - Derived classes should be substitutable for the base classes
I - Interface Segregation Principle - Having more fine grained interfaces over fat interfaces
D - Dependency Inversion Principle - Depending on abstractions, not concrete implementations.
Downloads: SOLID Presentation - Inland Empire UG, LosTechies ebook and SOLID-Code Sample
For RSVP and directions, please click below.
Getting started with PyTools and Visual Studio 2012
Let's face it, Visual Studio is THE best IDE around. IntelliJ IDEA comes to a close second for Java and Eclipse, it's too generic of a base class. I have been using IDLE for python which is ok until you start missing all the modern IDE features. In continued evolution of Iron Python, Python Tools for Visual Studio was created by a few Python and OSS enthusiasts at Microsoft’s Developer Division.
PTVS is a free/OSS plugin that turns Visual Studio into a Python IDE. Its Editing, Intellisense, Profiling, Parallel Debug & Watch, Live Debug REPL, MPI & Cluster Computing and Refactoring capabilities are fairly neat. PTVS claims to support CPython, IronPython, Editing, Browsing, Intellisense, Debugging, Profiling, HPC Clusters, Multiple REPL’s, IPython, Django, and Cloud computing with Client Libraries for Windows, Linux and MacOS.
Among the best features beside being able to put a break point in the code and step through, is the capability to open an existing python library from the source.
Get your existing python library and you can get a .sln out of it in couple of minutes flat; it just works. I was able to get Dr. Szymon Jaroszewicz's belief networks library up and running in few minutes.
Once you have the solution, you can add additional libraries as part of search path.

to avoid getting exceptions
exceptions.ImportError occurred Message: No module named <module name>.
You can start a simple project which uses numpy with a simple start->new project. Numpy is great for performing calculation relying heavily on mathematical and numerical operations. Here I will be calculating an Eigen vector.
If you have never used it, numpy works natively with matrices and arrays, perform operations on them, find eigenvectors, compute integrals, solve differential equations.
Put couple of break points and push F11 and viola.
So this is a quick intro to Python tools for visual studio. For more in-depth review, check out Python Tools for Visual Studio on codeplex.
Happy coding.
In Defense of Code Comments
I like to think that we all agree that effective commenting is important; Code Tells You How, Comments Tell You Why. Comments should say things about the code that the code can't say about itself — at the summary level or the intent level even with intention revealing names. An example by coding horror is
string = join('',reverse(split('',$string))); OR
new string(input.ToCharArray().Reverse().ToArray());
The code above reverses your string, but how hard is it to put the comment
# Reverse the string
into your .pl file to clarify your intent?
Robert C Martin’s must read book Clean Code: A Handbook of Agile Software Craftsmanship has an entire chapter of the book devoted to comments. Uncle Bob puts it quite well
“Nothing can be quite so helpful as a well-placed comment. Nothing can clutter up a module more than frivolous dogmatic comments. Nothing can be quite so damaging as an old crufty comment that propagates lies and misinformation.”
For someone who has worked with both enterprise and open source repositories, importance of comments cannot be understated. BootStrap, Node, JQuery, DNN, GTK, VLC to Hadoop and NServiceBus, useful comments are necessary and ubiquitous. Indeeed, a wall of comments is not being promoted here but the comment
"// doing this because it fixes bug #####"
is not a smell – in fact it's essential. Yes, I am talking to you Mr uber-cool-technology-of-the-day-taxonomy-dev-other-people-code-is-crap; We can all learn something from Paul Lutus's zeal for simplicity. As abtruse goose would say
How about the following example
Configure.With()
//this overrides the NServiceBus default convention of IEvent
.DefiningEventsAs(t=> t.Namespace != null && t.Namespace.StartsWith("MyMessages"))
Sometimes, the other extreme is cited as
int x ; // Integer x
OR
// Copy the string bob into fred making sure not to overflow the buffer.
strncpy(bob, fred,sizeof(bob));
which obviously are anecdotes to the contrary. Speaking of code comments during build process, stating that build systems should just be responsible for generating binaries defies ALM intents and the entire discipline of static code analysis.
In Code Complete, another one of my highly recommended texts, McConnel has a detailed philosophical discussion on “To code or not to code” which makes an excellent reading for a quiet afternoon but I won’t delve into dogmatic debates. Instead, I’d like to emphasize on the pragmatic inference that the discipline brought on by enforcing XML comments or comments in general keeps the uniform practice to enforce comments for less obvious pieces of codebase. By suppressing the XML comments, one essentially develops an atmosphere which discourages code comments in general.
DDD / Uncle Bob / SOLID / Eric Evans "KoolAid" or not, experience suggests that effective commenting is directly proportional to readability and maintainability while overzealous refactoring and class sprawl doesn't help.
Refactoring Resources Extraordinaire
Ebook: 31 Days of Refactoring (Sean Chambers)
http://lostechies.com/wp-content/uploads/2011/03/31DaysRefactoring.pdf
http://www.lostechies.com/blogs/sean_chambers/archive/2009/07/31/31-days-of-refactoring.aspx
Presentation: Refactoring Tactics and Strategies
http://lens.cos.ufrj.br/sugarloafplop/2002/download/refactoring-tutorial.pdf
Site: SourceMaking’s Refactorings Catalog
http://sourcemaking.com/refactoring
Book: Refactoring: Improving the Design of Existing Code (Martin Fowler, Kent Beck, et. al.)
http://martinfowler.com/books/refactoring.html
Book: Refactoring To Patterns (Joshua Kerievsky)
http://www.industriallogic.com/xp/refactoring/
Site: Martin Fowler’s Refactorings Catalog
http://refactoring.com/catalog/index.html
Site: Sources of Refactorings
http://refactoring.com/sources.html
Selected SourceMaking.Com Refactorings Pages
- Refactoring: The Nature of the Game
http://sourcemaking.com/refactoring/the-nature-of-the-game - Refactoring: Convert Procedural Design to Object Oriented
http://sourcemaking.com/refactoring/convert-procedural-design-to-objects - Refactoring: Extract Hierarchy
http://sourcemaking.com/refactoring/extract-hierarchy - Refactoring: Tease Apart Inheritance
http://sourcemaking.com/refactoring/tease-apart-inheritance - Refactoring: Simplifying Conditional Expressions
http://sourcemaking.com/refactoring/simplifying-conditional-expressions - Refactoring: Decompose Conditional
http://sourcemaking.com/refactoring/decompose-conditional - Refactoring: Consolidate Conditional Expression
http://sourcemaking.com/refactoring/consolidate-conditional-expression - Refactoring: Consolidate Duplicate Conditional Fragments
http://sourcemaking.com/refactoring/consolidate-duplicate-conditional-fragments - Refactoring: Replace Nested Conditional with Guard Clauses
http://sourcemaking.com/refactoring/replace-nested-conditional-with-guard-clauses - Refactoring: Remove Control Flag
http://sourcemaking.com/refactoring/remove-control-flag - Refactoring: Replace Conditional with Polymorphism
http://sourcemaking.com/refactoring/replace-conditional-with-polymorphism - Refactoring: Introduce Null Object
http://sourcemaking.com/refactoring/introduce-null-object





