background preloader

.Net Languages / Platform

Facebook Twitter

Discovering the Design Patterns You're Already Using in .NET. Binding with let, use, and do. Part of the "Expressions and syntax" series (more) As we've have already seen, there are no "variables" in F#.

Binding with let, use, and do

Instead there are values. And we have also seen that keywords such as let, use, and do act as bindings -- associating an identifier with a value or function expression. In this post we'll look at these bindings in more detail. "let" bindings The let binding is straightforward, it has the general form: let aName = someExpression But there are two uses of let that are subtly different. . * and in a later series, when we talk about OO features, classes can have top level let bindings too. Here's an example of both types: module MyModule = let topLevelName = let nestedName1 = someExpression let nestedName2 = someOtherExpression finalExpression The top level name is a definition, which is part of the module, and you can access it with a fully qualified name such as MyModule.topLevelName. Patterns in "let" bindings We have already seen examples of how bindings can use patterns directly let!

4.

C#

F# F# ServiceStack extension. FSharp Twitter List. Visual Basic. WPF. Architecture. Interpreter pattern. Uses for the Interpreter pattern[edit] Specialized database query languages such as SQL.Specialized computer languages which are often used to describe communication protocols.Most general-purpose computer languages actually incorporate several specialized languages.

Interpreter pattern

Structure[edit] Example[edit] The following Backus-Naur Form example illustrates the interpreter pattern. The grammar expression ::= plus | minus | variable | number plus ::= expression expression '+' minus ::= expression expression '-' variable ::= 'a' | 'b' | 'c' | ... | 'z' digit = '0' | '1' | ... | '9' number ::= digit | digit number defines a language which contains Reverse Polish Notation expressions like: a b + a b c + - a b + c a - - Following the interpreter pattern there is a class for each grammar rule.

While the interpreter pattern does not address parsing[1]:247 a parser is provided for completeness. Finally evaluating the expression "w x z - +" with w = 5, x = 10, and z = 42. See also[edit] References[edit] 6 MVVM Tips: Leverage ViewModel and Unit Test Silverlight and WP7 Apps. In-Depth 6 MVVM Tips: Leverage ViewModel and Unit Test Silverlight and WP7 Apps The Microsoft Model-View-ViewModel pattern is an indispensable tool for developing applications for Silverlight, Windows Phone 7 and Windows Presentation Foundation.

6 MVVM Tips: Leverage ViewModel and Unit Test Silverlight and WP7 Apps

Benjamin Day helps you avoid architectural pitfalls and create unit-testable and maintainable applications. Get Code Download After working on a Silverlight 4 project for the last 18 months, I've learned a few things about layer loyalty, code organization, unit testing and maintainable code. Model-View-ViewModel (MVVM) pattern, and used the Repository and Adapter patterns to achieve better results. MVVM Light Messaging. Posted on July 5, 2010 by Chris Koenig Since I started using the MVVM Light toolkit, I’ve gotten lots of questions about the it.

MVVM Light Messaging

In this post, I’m going to show you the basics of using the Messaging infrastructure. In the sample application attached, we have the situation where a Master page with a list of data items is trying to move to the Details page to show the details for one specific item. There are a couple of ways to do this, but the one I’ve starting using is the Messaging infrastructure in MVVM Light. It involves the ViewModels communicating with each other via a lightly-coupled messaging bus rather than a direct coupling or using the query string.

The sample application displays a fixed set of data elements in a list on the main page. Step 1 – Send the message out to the bus The RaisePropertyChanged method includes two overrides – this one publishes to the Messaging infrastructure for us. Building ViewModel Facade Objects - Part 1. The MVVM (Model-View-ViewModel ) Design Pattern requires that you create a facade layer between the Model and the View called the ViewModel.

Building ViewModel Facade Objects - Part 1

The ViewModel is supposed to supplement the functionality provided by the Model, and coerce it into a form the View can more readily consume. The result being; the View code can be pretty thin and concerned only with view based activities, while the Model can remain uncompromising by the demands placed on it by a View meaning it can better represent the data/concepts its supposed model. Brilliant, all we need do now is knock together the ViewModel thing, sounds like a trivial code monkey task....

.Net General