Creative Uses of IDisposable

We all know IDisposable interface in NET Framework. It is used to signal to any object with dependencies to other objects when should it dispose of them. IDisposable is a very handy feature together with the using statement, when IDisposable is called automatically when we exit a using code block.

I was reading the Introduction to Rx by Lee Campbell, in preparation of my session for DotNetSpain conference in February. There, I’ve found some creative uses of IDisposable.

Basically, it leverages the fact that Dispose method is called after “using” statement code block exits. So, we can use it to do some wrapping around that code block.

Before the code in the block is executed, the IDisposable constructor will be invoked. After the code is executed, the Dispose method will be invoked. In effect, our code will be surrounded by “Pre” and “Post” actions in an elegant way.

In Campbell’s exemple, a console app can leverage IDisposable to print text in different color inside a code block.

The “wrapper” is a short class named ConsoleColor that implements IDisposable. It remembers the previous console foreground color by saving it in the constructor and restoring it in the Dispose method.

The calling code just decorates Console.WriteLine code blocks with custom ConsoleColor instances, and voilà, we have a multi-color console application.

2016-01-30_13-31-52

Book Review of “Debugging Teams” and “Exercises for Programmers”

In the last couple of weeks I’ve been reading two books that I hoped would help me with my role as a practice lead.

debugging teams cover page

One of them is “Debugging Teams” by Brian Fitzpatrick and Ben Collins-Sussman published by O’Reilly. It is a small book of around 150 pages, filled with practical advice on how to make successful teams that work and collaborate together. When I started reading it, it reminded me of a book I read a year back called “Team Geek”. Of course, I missed the clue that “Debugging Teams” is a rewrite of “Team Geek”, expanded to include feedback from the first book.

The main advice of Debugging Teams is a simple idea of practicing HRT (Humility, Respect and Trust). It permeates the whole book as a effective acronym to remember during your team leadership work. The rest of practical advices in the book include how to manage conflict, how to make a strong team ethos, how to navigate the organizational hierarchies and so on.

Debugging Teams, in essence, is a great update to an already great book. I’d rate it with 5 stars, wholeheartedly.

exercises for programmers cover pageexercises for programmers cover page

The second book is even smaller, but equally useful. It is called “Exercises for Programmers” by Brian P. Hogan, published under the umbrella of Pragmatic Programmers brand. With the subtitle of “57 challenges to develop your coding skills”, it is an exercise book that begins with “Hello, world” challenges and ends with complete small projects such as to-do lists or URL shorteners.

I use it now to send bi-weekly code challenges to my team. We then sit together to do a joint code review of each individual solution, in order to learn from it how to improve the code legibility and mantainability. It is equally suitable to use it as a source for code katas, test-driven development (TDD) assignments or self-study challenges when learning a new programming language.

My review of the “Exercises for Programmers” is 4 out of 5, just because many programs are very simplistic and also because several examples in it are maybe too US-centric (use of imperial units and USA-specific jargon) for a universally applicable book. Having said that, it is also a must-have if you want to challenge your (or your team’s) programming skills.

 

Talking about Claims and Claim Providers at ESPC15 in Stockholm

Last week I was in Stockholm for the annual European SharePoint Conference 2015. A little bit tired after being in USA for MVP Summit the previous week, but happy to meet my dear SharePointers and get to know some new ones.

Me at ESPC15
Me at ESPC15

My talk was about “Extending Authentication and Authorization”. I talked about claims, the underpinning of all thinks AuthN and AuthZ in SharePoint 2013. My demo was a custom claims provider that exposed dummy claims in People Picker that were used to protect confidential document from normal users.

I also demoed the federated authentication with SharePoint and ADFS.

My Session announced at ESPC15
My Session announced at ESPC15

You can find my slides on the ESPC15 website or on SlideShare. The demo claims provider code is also available on my OneDrive.

Special thanks to Spencer Harbar for coming with the claims as boarding pass analogy in the first place. It’s a great explanation tool.

Learn Building Highly Scalable Applications in Azure

In the first half of this year I’ve been busy producing a new course for Pluralsight, called “Building Highly Scalable Web Applications in Azure”. It is a course about making a normal web applications scalable to thousands and millions of users.

In my opinion, the majority of the development tutorials that show you how to make a web application do just that: they show you how to make a demo application. This demo application isn’t supposed to be production-ready nor should support high user loads. But, what happens when you need a scalable application? This is the missing piece I thought I could provide with my course.

Slide from my Pluralsight course

The course takes a simple web application named Ticketer, a simple-but-complete event and ticketing MVC 5 application, and refactors it into a scalable, redundant version of itself using a variety of techniques such as storage locking removal, caching, asynchronous calls or non-relational data storage.

In the following clip you can see the load test of the application before and after the scalability improvements.

Questions? Leave a comment and I’ll do my best to answer it.

 

SharePoint 2016 y las expectativas

Como ya muchos sabéis, SharePoint 2016 IT Preview está disponible para descarga desde ayer, 24 de agosto de 2015. Con ello, han empezado a proliferar posts sobre la instalación, las mejoras y en general lo que se espera de SharePoint 2016.

Mi post no pretende repetir nada de esto, sino a aclarar lo que pretende conseguir Microsoft con esta versión beta IT Preview. Sólo ha pasado un día y ya he oído comentarios como “vaya SharePoint 2016, que pobre de funcionalidades que viene” o “si está clavado al 2013, si lo se no me lo instalo”, que van muy desencaminados.

SharePoint 2016 Preview Tilt

Si Windows 8 y Windows 10 han mostrado algo, es que Microsoft ha cambiado su estrategia de “betas” de software.

Antes, uno tenía que esperar hasta la Beta 1 para ver algo del nuevo software, pero ese software internamente ya estaba bastante maduro y lo que buscaba la beta es detectar las cosas . La Beta 2 y la Release Candidate o Technical Refresh (o cualquier otro nombre comercial bonito) servían para refinar esos errores minoritarios que siempre hay.

Ahora, la idea es que tengamos la beta Preview muy básica y mucho más “verde” pero mucho antes de lo que habitualmente se tenía. El objetivo es tener feedback real lo antes posible para ver como se comporta el nuevo producto en el “mundo real” y fuera de los laboratorios de Redmond. La primera Preview tosca muy pronto (en un par de meses) se sustituye por una Preview más refinada y así hasta la “beta final”: RTM. Con Windows 8 se siguió este patrón: primero la “Developer Preview” y luego la “Consumer Preview”, es decir los cambios más de back-end y la API primero y luego la interfaz de usuario y el pulido final. Con Windows 10 lo mismo: Preview con un ciclo más lento de cara al usuario final y otro más rápido (Fast Track) de cara al desarrollador/administrador.

Entonces, lo que tenemos entre manos es un SharePoint 2016 en el que la API y el back-end han sido cambiados por dentro de manera muy exhaustiva, pero donde la interfaz de usuario y la cara pública de la API es prácticamente la misma que en SharePoint 2013. De allí el nombre de SharePoint 2016 “IT Preview”. Con ello Microsoft pretende, en mi opinión, validar los cambios tan críticos como los MinRoles, búsqueda híbrida y los nuevos límites de escalabilidad.

Entonces, en una “IT Preview” es normal que no se vean grandes mejoras “a simple vista” ya que son más bien refactorings y reingeniería para poder habilitar esas grandes mejoras en los builds siguientes.

Yo esperaría una “Developer Preview” entre octubre y noviembre, y otra “Consumer Preview” en enero/febrero. La Developer Preview traería las mejoras de API de SharePoint cliente CSOM, el modelo de Apps y a saber que cosas más, con el objetivo de tener el feedback real de esos nuevos cambios para poder pulirlos lo antes posible. La Consumer Preview sería ya una fiel imagen del SharePoint 2016 tal como saldría acabado, con todas las mejoras de funcionalidad ya de cara al usuario y al administrador de sitios de SharePoint.

Entonces…paciencia, “pequeños saltamontes”. Esta IT Preview es sólo la punta del iceberg de las mejoras de SharePoint 2016.

Galileo and SharePoint (via Azure) at SPS London 2015

Yesterday (July 11th) I was presenting at the very first SharePoint Saturday London. The SPS event was very well organized by Peter Baddeley and Seb Matthews.

Galileo with PIR sensor sending data to Azure
Galileo with PIR sensor sending data to Azure

My session was about connecting IoT to Office 365 (via Azure). I used an Intel Galileo prototyping board with a Passive Infrared sensor (PIR). The sensor data was used to determine if a meeting room was empty or occupied. The raw data is uploaded by Galileo to an Azure Notification Hub. A continuously-running Stream Analytics job is then used to translate the raw data to 1-minute resolution of the room availability and to insert this data into Azure Table Storage. Finally, a provider-hosted Office 365 SharePoint application is used to visualize the room availability.

The slides for my talk are available at SlideShare and the code is now live at GitHub.

CEUS by Iberian SharePoint Conference 2015

El día 9 y 10 de junio se celebró la conferencia CEUS by Iberian SharePoint Conference 2015, en las oficinas de Microsoft en La Finca (Pozuelo de Alarcón). Este año la conferencia tradicional de Microsoft llamada CEUS (Conferencia española de usuarios de SharePoint) se ha unido con la Iberian SharePoint Conference organizada por los grupos de usuarios para unir lo mejor de las dos conferencias.

Logo de CEUS by ISPC

He podido ayudar como parte del equipo organizador, como asistente en los talleres y como ponente. Han sido dos días intensos pero muy satisfactorios al ver que los asistentes a la conferencia han podido aprovecharla al máximo para aprender, interactuar y pasárselo bien. Desde la organización de la conferencia nos sentimos muy orgullosos del resultado.

Mi charla sobre las apps high-trust ha sido muy concurrida, con mucha gente que la siguió de pie al estar totalmente llena la sala. A pesar de los pequeños errores técnicos con el proyector, creo que la sesión ha sido provechosa para los asistentes.

IMG-20150610-WA0001 Twitterb2df895 Twitter396d528 Twitter667f325 IMG-20150611-WA0003

Todo el material de las charlas está disponible en el repositorio GitHub de la conferencia.

Os dejo algunas fotos del evento para acercároslo a los que no pudísteis asistir.

Ahora os esperamos a todos el día 26 de septiembre, cuando se celebrará SharePoint Saturday Barcelona 2015.

 

Hablando de herramientas de desarrollo SharePoint

En el First Monday de mayo los miembros de SUG.CAT nos reunimos para hablar de las herramientas de desarrollo en nuestros proyectos de SharePoint. En la discusión sacamos varias herramientas útiles para el desarrollo con SharePoint / Office 365, que recojo en esta tabla.

Equipo SUG.CAT reunido

Esenciales
Sharepoint Manager El clásico y con razón. Explorador de modelo de objetos de servidor de SharePoint
ULS Viewer Visualizador simple de logs de SharePoint
Feature Admin and Cleanup Tool Herramienta para detectar y quitar features huérfanas
CAML
SharePoint CAML Query Helper Herramienta para construir y probar las consultas CAML
CAMLJS Herramienta para construir las consultas CAML para JavaScript/CSOM. También disponible como extensión de Chrome.
CISAR Editor de las plantillas CSR (Client-side Rendering)
CSOM / JS / Cliente
Fiddler “Debugger” HTTP para ver la conversación entre el navegador y el servidor
Sharepoint Client Browser SharePoint Manager que funciona en remoto con API cliente, para SharePoint en la nube y on-prem
JSON Formatter & Validator Formatea y valida el contenido JSON. Útil para investigar los errores de formato.
Postman Extensión de Chrome para probar y debugar las APIs HTTP
SharePoint Search Query Tool Para probar y debugar las consultas contra la API REST del motor de búsqueda de SharePoint 2013
Provisionamiento e instalación
SPMETA2 API para crear artefactos de SharePoint (listas, content types etc) desde código de manera sencilla
SharePoint Genesis Framework Un framework para declarar y provisionar artefactos de SharePoint
SharePoint Solution Deployer “Instalador” de paquetes WSP que ejecuta también tareas adicionales via PowerShell
AutoSPInstaller Instalador y configurador desatendido de servidores SharePoint. Ahorra mucho, mucho tiempo.
Varios
ZoomIt Zoom de pantalla (CTRL+1) muy útil para las presentaciones
Process Explorer Información detallada sobre los procesos activos en la máquina
Debug Diagnostics Tool Analizador de “cuelgues” de las aplicaciones IIS (y SharePoint)
SMTP4Dev Servidor de correo SMTP “falso” para ver que correos se envían desde nuestras aplicaciones. Los correos se guardan y se pueden ver.
SharePoint Color Palette Tool Editor de paleta de colores de SharePoint
Gary Lapointe SharePoint Automation Extensiones útiles para PowerShell de SharePoint. Mirad por ejemplo la extensión que automáticamente publica todos los elementos en estado borrador en una colección de sitios.
Migración de contenido
SP Content Deployment Wizard Utilidad para exportar e importar contenido de SharePoint. Usa la API de Content Migration de SharePoint.
Metalogix Content Matrix Express Utilidad de migración de contenido de SharePoint completa, con limitación de 25 GB de tamaño de la base de datos de contenido
Office Patterns and Practices PnP Ejemplos oficiales de tareas de desarrollo sobre SharePoint. Directos del equipo de SharePoint y de API de SharePoint.
Herramientas de pago
SPCAF/SPCOP [de pago] Analizador de código SharePoint, con versión gratis (SPCOP) y de pago (SPCAF)
SPDocKit [de pago] Documentador de la granja de SharePoint. Además, facilita la gestión y seguimiento de los permisos.
BCS Meta Man [de pago] Creador de esquemas de Business Connectivity Services (BCS)
ReSharper [de pago] Extensión de Visual Studio para refactorizar código

Espero que os sean útiles.

New Professional Adventure at Sogeti

I have been unusually silent on Twitter and on this blog in the last few weeks. The reason is that I have left Spenta / Beezy, after two wonderful and exciting years, and I have joined Sogeti Spain as Senior SharePoint Architect. I have nothing but words of gratitude for my fellow Spentians, and it is always a pain to part ways with so awesome a team.

sponsor_sogeti_large

My new work role in Sogeti Spain will be to keep building top-notch SharePoint solutions, but additionally I will be acting as a SharePoint Team Lead. I have already started making some changes in the development practice with the ultimate aim of creating a culture of excellence in SharePoint solution development.

Wish me luck :-)

The Evolution of the Intranet Home Page

I have been thinking lately of the evolution I witnessed in the corporate intranets working on many SharePoint projects. In this post I’m going to summarize my thoughts on that evolution. This is also going to be a technology-free post.

The main difference between intranet and public web site is that intranets are not anonymous. The user browsing the intranet has a name and a username (and hopefully more than that) and this information can be used in many ways.

The “Classic” Intranet

The “classic” intranet in the prehistory of SharePoint was fairly uniform in the content it presented. Little or no information was personalized for the user that was viewing the page.

The content of the intranet was “pushed” to the intranet from centralized locations such as the News Center or the Announcements of different sites. Usually, there were few people actively adding content and all the rest of the intranet users were passive consumers of that information.

So much for the “dynamic” content that was being added. However, the most of the content in the intranet was static or nearly static: telephone listings, project and department descriptions and so on. That content rarely (if ever) changed.

In consequence, the Intranet home page reflected that approach. The “push” model distributed news that were prominently displayed. There was also a myriad of shortcuts, links and navigation contraptions that allowed the user to further explore the intranet.

SAP Design Guild Intranet 2007
SAP Design Guild Intranet circa 2007. Source: SAP Design Guild History

Naturally, this led to the unengaged intranet users. They just had no need to visit the intranet every now and then. Only a casual visit every now and then or a fact-finding necessity would cause the users to open the intranet in their browsers.

Some companies would leverage the user information to filter the information they see on their home page, such as showing only the information that is relevant to their department. However, the most of the organization didn’t have these problems as their volume of new information was low and filtering then served no purpose.

The “Social” Intranet

In the last 4-5 years the social computing technologies have made their appearance in the corporate world, after having taken the private user space by assault. The immediate nature of social updates and the viral-like features of popular content were seen as the cure for the unengaging, static intranets of the past.

The news section was being replaced or prominently complemented by a “wall“, “feed” or “conversation”. It’s dynamic nature ensured always-fresh content in the intranet. However, it also opened the way for information overload. From being starved to information death by old intranets to being choked by the sheer overload of information that is generated every day…in just a few years.

Ono Social Intranet with Beezy
ONO Social Intranet with Beezy. Source: Beezy case study

Social computing also features a network, where every users has connections to other users. It may be an explicit connection such as user follow action or an implicit connection such as having the same department. These connections are then used to show the information generated from the users the visitor is connected to. You could see documents and content created by the people you are connected to and hopefully this “social” filter capability would reduce the information overload to more personal level.

Office Delve pulled information
Office Delve pulled information. Source: Office support

This filtering by user characteristics such as connections, context and behavior is what is being called a “pull” model, where the information is pulled for the current user out of the vast information overload.

To Push or To Pull?

In the light of the rising popularity of the social intranets, we may think that the “pull” model is superior to the “push” model. There is some truth in this, but in my opinion the answer isn’t just that simple.

I think that the key of the intranet success is the information context. This context is the thing that separates the raw data from useful bit of information.

The “push” model makes the context static and uniform to all users. The “pull” model makes the context unique to the user. And the answer lies in a wise mix of both push and pull models.

All the content in the intranet isn’t the same. There is a need for global information (such as IT services outage) that could benefit from the push model. All the rest of the information is more or less contextualized. So, the “news pushed to every user on their home page” are clear candidates to be ditched in favor of the pull model.

The pull model makes the context social and user-centric. This is true for many situations: the content I have been interacting with, the content created by the users I have interacted with, the content about the topics I find interesting and similar derived situations. However, there is no single recipe: the fact that I follow a user doesn’t mean that I am interested in all the thing he or she creates and shares.

Here is a feature that is missing from many “social” intranets: the curated content. The act of content curation is the act of providing context to the information. We need users to curate, collect, collate and organize the content that is relevant in a specific context and then make this context easily findable. Wiki pages are perfect containers for curated content, for example.

Microsoft Curah! curated content portal
Microsoft Curah! curated content portal

Conclusion

The art of good intranet design is the art of wisely combining the three models: pushed, pulled and curated content to provide the best experience for the intranet users. There is sadly no unique recipe to share here, that’s why I call it an art.

It is also what makes intranet information architecture projects so exciting!