Here are my notes from Day Two of the DevConnections conference. A particular highlight of the day was the Women in Tech luncheon! 100 women attended and a four woman panel of conference presenters answered questions from the crowd.
Morning Keynote: Windows Azure – Scott Guthrie, Microsoft
- He showed a short video of one of their data centers; the servers are literally stored within shipping containers stacked on top of one another. When enough servers in the same container fail, they’ll replace the container with another and fix the faulty servers. Since everything can be done remotely, they don’t need a large staff. I think he said they have 1 data center employee for every 10,000 servers.
- Microsoft Patterns & Practices group has modules you can install to help you monitor CPU and consumption with your Azure account.
- “Extra Small” instance = 1/4 core
- Your two VM instance are spun up on separate servers, separate racks, separate routers, etc. for fail-safe.
- Production vs. Staging in Azure – when you publish your staging instance to production the production VM automatically becomes your staging VM, in case you need to rollback.
- Messaging services allow you to move from tightly coupled apps with high chance of cascading failures to a loosely coupled app. Example was a storefront integrated with shipping services. If the shipping services fail, the Order Queue can still accept orders until it comes back online.
- Scott did a demo with a MVC 4 mobile app that accepted text strings, sent them to the Service Bus Queue, and then were pulled from the queue and displayed on a local desktop app checking for new messages continuously. He also demo’ed a hybrid relay app – cloud app that pulled from Service Bus Relay which pulled from local WCF service.
Visual Studio Leadership Unplugged – Jason Zander, Brian Prince, moderated by Scott Hanselman
- Visual Studio 11 is not the final name – the branding is coming…
- They are putting out less milestones so don’t expect a bunch of additional releases between the Beta and release.
- Feedback about the new UI has centered on three areas: 1) Color – they removed some of the color, meant to drive the eye toward code and text. 2) Contrast – they toned down a lot of the color, though some of it now looks grayed out, they will continue to tweak it. 3) Typography – working on fonts, spacing/kerning, etc. to bring the product more in line with Metro style.
- Same level of theming support as 2010.
- When determining what features will go in what SKU, they look to release a reasonable end-to-end scenario, one that flows and makes sense, instead of being a random collection of features. Also, what engineering trends they are seeing. For example, VS11 incorporates greater emphasis on DevOps and Agile.
- Don’t see offering “ala carte” features for Visual Studio in the near future. Engineering and practical challenges. Product designed to work together as total solution. They are exploring the possibility of renting/leasing features in the cloud.
- Intellitrace will again be offered only in Ultimate.
- Developers who have VS license at work should read license language, because they can probably install a copy of the software at home.
- The Visual Studio team does indeed use the TFS Scrum tools in-house. They have a “pioneer team” who are the first to use the newest versions, before it is rolled out to the rest of the team. There are currently two feature teams who are using the cloud version, including the cloud Build Service.
- There will be a more rapid update cadence with VS11. Instead of a major release every 2 years with a Service Pack in between, they hope to to roll out more features via Visual Studio updates and gallery. As part of the new release, they have invested a lot into updating the service so they have the ability to push updates to most of Visual Studio.
- Ultimate Architect has been improved so it can scale on a much greater level and handle larger projects.
- T4 editor – no Intellisense or syntax highlighting, but Brian and Jason thought it was a good idea. They will look into the syntax highlighting; the intellisense will be more involved.
- PowerTools – more rapid release cycles. Want to be responsive to customers and community demands. All existing PowerTools will work with VS11, except for the ones rolled into the product itself.
Techniques, Strategies and Patterns for Structuring JavaScript Code – Dan Wahlin, Wahlin Consulting
- JavaScript prone to spaghetti code, so closures gives us a way to emulate classes.
- Closures get us “ravioli code”: data encapsulation, decoupled code, separation of concerns.
- Douglas Crockford, author of JavaScript: The Good Parts, says: a variable/parameter returned from a nested inner function within a closure will remain in scope.
- The closure function then behaves like a class: it preserves state.
- Object literals are a way to store name/value pairs in JSON & AJAX operations.
- To declare a namespace in JavaScript: var myNamespace = myNamespace || {};
- Use the namespace to scope variables.
- Self-invoking functions create a singleton called when page first loads.
- Three main patterns: Prototype, Revealing Module, Revealing Prototype
- Prototype Pattern: Constructor, Prototypes can be overridden
- Benefits include modular, reusable code, JS inheritance, move variables & functions out of global namespace, functions load into memory once, ability to override functions. Cons include “this” keyword craziness & constructor separate from prototype definition.
- Rule: If you need to use the “new” keyword, capitalize your variable name. If not , use lowercase.
- Prototype only gets called one time; the variables and values will not be unique to each instance.
- The “this” keyword is required for every instance variable, which can get overwhelming.
- Revealing Module Pattern:
- Benefits include “modularize” code into reusable objects, variables/functions fall out of global namespace. Cons include functions duplicated across objects in memory and not easy to extend. Some people also think private members/functions do not belong in JavaScript.
- Revealing Prototype Pattern:
- A combination of Prototype and Revealing Module Patterns.
- Best of both worlds – you get public/private members and ability to override functions.
- http://tinyurl.com/CleanJS
HTML5 and JavaScript Fundamentals with MVVM & KnockoutJS – John Papa
- Knockout.js is a JS library that gives you rich client-side interactions, MVVM-like pattern, and web browser support. Separates behavior and structure.
- Knockout is 3 steps:
- Declarative Binding to HTML elements – “data-bind=”
- Create Observable – ko.observable(). If observable value changes, KO will notify the UI.
- Bind the ViewModel to the View – ko.applyBindings(viewModel). If you want one time binding, you don’t need “ko.observable”. If you want two-way binding, it’s required.
- Without data binding, you have to manually push and pull JSON values from the source object to the target and vice versa. jQuery can assist, but it requires a lot of manual coding.
- Now we can use Observables:
- Wrap property in observable function => similar to iNotifyPropertyChanged
- Automatic two-way binding: both sides updated when value is changed
- Also check out “Subscribable”
- For computed properties:
- Define the function to evaluate the computed value, and use it for binding.
- When its observable changes, it notifies that the change occurred.
- Containerless Control of Flow Bindings
- No need for script template. No unnecessary HTML elements just to use for flow (like div tag). Moves binding logic outside of HTML elements.
- You instead use HTML comment-based control flow syntax.
- <code><!– ko with: blah –> do stuff here <!– /ko –></code>
AppFabric Caching: How It Works and When You Should Use It – Shy Cohen, IDesign
- Data Categorization
- Reference Data – read-only mostly, changes slowly. Like user profile photos, product descriptions.
- Resource Data – read-write, concurrent. Like number of units in stock, online survey results.
- Activity Data – Read/write, user specific, not concurrent. Like shopping cart items, individual survey responses.
- Determine what to cache
- Categorize your data and cache – where, how long, explicit deletion.
- Cache the right data – output cache is not always efficient. Create meaningful subsets used independently.
- Use efficient caching strategy
- Balance number and size of objects. Cache the smallest objects possible. Minimize round trips. Measure performance to determine optimal point.
- Keep data coherent – don’t break down large objects into multiple smaller ones if you can’t reconstruct them.
- Assume “best effort” caching
- Your app must be able to withstand the cache being unavailable and the cached data being unavailable.
- Don’t store critical/important information only in the cache; it’s costly to reproduce.
- Craft your keys wisely
- Minimal but complete set of unique identifiers for data.
- Keys consume space in the cache.
- Automatic Object Removal
- Explicit Deletion – remove manually.
- Expiration – staleness, proactively remove. Hint for system on how long to keep object.
- Eviction – reactively remove due to low memory.