Buscar

Javier's blog

Javier's blog about Software Architecture, Design and Development

Categoría

en-ie

Applying the Mediator Design Pattern

One of the areas to improve in the software development profession is how we name things. I wanted to mention that because this post is about applying the Mediator design Pattern correctly but I do not really feel comfortable saying “Mediator” because it sounds like a law-based profession instead (see: solicitor), I mean it’d had been ok for me to call it after the guy who invented (similar to how astronomers name comets since 1531) but not definitely like «Programmer», «Requester» or other mumbo jumbo term.

There are three roles in the Mediator design pattern: the Mediator itself, the Concrete Mediator and the Concrete Colleague.  In few words, the Concrete Colleague contains an instance of an abstract Mediator, which is mapped to the runtime type during execution. It sounds great but how this can help us?

The mediator is useful when controlling the execution of an algorithm externally, without knowledge of the internal working. In this context externally means that you have two classes and the first class needs to call a function defined the second class. You would normally do it directly similarly to the following example:

    class A
    {
        public void bar()
        {
            B obj = new B();
            obj.foo();
        }

    }
    class B
    {
        public void foo()
        {
        }
    }

But what about if you know that foo() is going to change. You could abstract the B class in an interface and invert the dependencies as described in the following code:

    class A
    {
        public void bar()
        {
            Ifoo obj = new B();
            obj.foo();
        }
    }

    class B : Ifoo
    {
        public void foo()
        {
        }
    }

    public interface Ifoo
    {
        void foo();
    }

But what if you know that A is also going to change? The “Mediator” does the trick by abstracting the first class (role: concrete colleague, A in the example) and inverting the Ifoo (role: concrete mediator) as described in the following code:

   class A : IBar
    {
        private Ifoo mediator = null;
        public A(Ifoo med)
        {
            mediator = med;
        }
        public void bar()
        {
            mediator.foo();
        }
    }

    class B : Ifoo
    {
        public void foo()
        {
        }
    }

    public interface Ifoo
    {
        void foo();
    }

    public interface IBar
    {
        void bar();
    }

In the previous sample both depedencies were inverted, so a consumer would be doing something like:

            Ifoo concreteMediator = new B();
            IBar concreteColleague = new A(concreteMediator);
            concreteColleague.bar();

The next question would be: what are god scenarios to apply it? To be honest I have used it only in brownfield projects where a change must be isolated to do it progressively, without affecting the whole system, just like a construction/safety net on a busy street, however I think is useful for any scenario where the client and customer classes change. There is another clever sample here: http://bit.ly/1adXETS

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer

Review: MS P&P’s SQL, NoSQL Data Access for Highly Scalable Solutions

A few days ago the P&P team delivered the new Data Access guide for highly scalable solutions. This is great. Few manufactures do this kind of stuff.  My kudos to the team. if you still don’t have it feel free to check out this link: http://msdn.microsoft.com/en-us/library/dn271399.aspx . This post is for discussing the good and bad impression I got from that guide in no particular order.

Good stuff:

  • There is a nice classification of data base technologies which might be handy if you’re living a nightmare with all the DB products and technologies made available by different providers.
  • There are really good (an in depth) explanations about indexes and partitions in you’re interested in the magic behind the scenes.
  • I like the emphasis made in analyzing the query pattern as a big decision factor.
  • Good descriptions and advice about the hash function used in key/value like storage.

Bad stuff (architectural point of view):

  • The angular piece behind the proposed architecture for keeping the data access services synchronized is ONE Web Service Facade for routing the incoming request to the target data base. As such this operational web service is a main thing but there is no detail about how this guy will be scaled out. I see this like a single point of failure. The following image describes the service:

WebServiceFacadeForRouting

  • Actually I’m having trouble to get this service into my head because there are several references in the guide conforming the service as a crosscutting concerns resolver. This goes against the whole Single Responsability principle.
  • What’s the rational behind formating all the traffic between the web console and back end services with JSON?
  • I really think Unity is not necessary here.  This might be a typical case of dependency injection via unnecessary complexity. I mean, is it too probable the chance of dynamically changing the data base for this solution?
  • I felt in front of an over used REST implementation. C’mon guys check the following controllers/operations:
    • StatusController: Get
    • SubCategoriesController: GetSubCategories
    • ProductsController: Get, GetProducts
    • ProductsCOntroller: GetRecommendation
  • Is it only me or clearly the service methods are forced into REST verbs. This is a chatty interface indeed.  These are code bloat controllers. Also there are multiple flaws in the API design. I mean, as an actor, should I consume ProductsController.Get or ProductsCOntroller.GetProducts?
  • There are some wild ass definitions like «data-mapper pattern is a meta-pattern?. In someway, the Interpreter pattern is presented as a child of the data-mapper and I wonder why?. Why not the other way around? A typical egg and chicken situation.
  • And finally and certainlly most important: what’re the reasons behind designing a «polyglot» data repository? Why non-use a 100% MS SQL Azure  data access based solution?

Bad stuff (from my personal/subjective/human point of view):

  • The scenario driven guides sound fine to me at the beginning, but I found I’m actually too lazy to read someone else’s specific/abstract situations (no offence, but I used to enjoy the Contoso‘ stories). Too much specific stories for me. Plus, I don’t really care about what happened in 1971 or 1990.
  • Am I the only one who thinks shopping cart or movie rental kind of samples are much less than what an average brain can process? Again, I think Contoso did the job.
  • A graph data base for a departmental organization? Are you kidding me? Unless your company employs millions of people I think is not a good example.
  • Is there any need to describe a lot of non-relevant / domain specific functions?
  • I’d prefer having no information about something rather than little/vague. This is the case for pricing. This is a big topic explained in most of the resources from the stratosphere or in a atomic level (no more «cloud cost» calculators with N input variables please!). I think something in-between is good enough.

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer

Intel Developer Forum 2013 – A summary #IDF13

Hello everybody,

Previously I shared my favorite list of sessions at the Intel Developer Forum (a.k.a. #IDF13) here, today I’d like to share what I think was most valuable. This is not a complete/detailed description, it’s just a recopilation of some interesting notes of mine.

  • New Chips: Intel started as a chip maker, so this event was an opportunity to showcase the Atom Z3770, based on the Bay Trail platform. For non-chip expert readers this means better performance and lower power consumption. For tech readers there are two links I recommend about that here and here. This SoC is intended to be used in the tablets and smart phones market. A  side note about this: Intel thinks in mobility in terms of wearable technology, so this is the transformation of the PC for the next era: Internet of Things. I feel IoT is about to become mainstream, not just an academic term anymore. In that world where tiny devices come into play, tiny chips play an important role. I’d recommend to keep an eye on Quark, which a 14 nm Soc.
  • Big data: one great learnt lesson: to construct graph-like models use Hadoop. To analyze them use Graph Lab (because Hadoop does massive data replication and suffers bottlenecks in graph processing, plus is not a natural abstraction for developers, so WE have to re-image the problem) and for Query processing/storage use Mine Graph. Dear readers just learning about Hadoop: bear in mind that Hadoop is a disk based engine, so get ready for faster in-memory computing like Spark. This world is envolving faster than ever. One of the highlighted companies actually using big data tools is Duke Energy, as you could imagine utility companies are collecting and analyzing data. Keep an eye on traditional data tool makers like Informix and non-traditional like Marklogic.
  • NUI’s  and/or gesture: this segment is getting mature. Maybe not highly recognizable, but mature. If you’re still amazed for touch devices or multi-touch SDK’s I’d have to say that you have been living on a cave. Check Nuance’s Dragon Assistant or the Intel Perceptual Computing SDK.
  • The potentially next big thing in HW/SW: Cloud Foundry (open PAAS), Aepona (NAAS) and Mahsery (Cloud Based API Management) in Software/Services (cloud computing). NI CompactRIO (a compact/open architecture control/monitoring system) and Aeroscout (Wi-Fi tags with telemetry and other sensors) in hardware.
  • Android: I know some readers are actually Java/Android developers, so here I share these technical slides just for you: Building Android* Systems with Intel® Architecture Based PlatformsDevelop, Optimize, Debug, and Tune Applications for Android,

    Developing Native Applications on Android and Optimizing for Intel® Architecture and

    Accelerating Your Software Development for Android* on Intel® Platforms.

I’d like to share some picture because IDF is not only a great professional experience, is a life experience indeed:

El pase de diapositivas requiere JavaScript.

See you at the next IDF, I hope you find this information valuable as well.

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer

My Favorite List Of Sessions in the #IDF13

Hello Everybody,

It’s this time of the year again when Intel showcases the most impressive stuff done during the last months. If you’re a technology follower these times are exciting. Every year the guys behind the event agenda surprises us with topics of interest for everyone, from business devices/software to Hi-Tech (sci-fi like) demos. For this year I just finished hand picking a list of my favorite sessions which I would like to share with you:

TECS003 – Beyond Queries: Finding Patterns in Big Data Using Graph Analytics with Hadoop* Software

ACAS001 – Beyond Hadoop* MapReduce: Processing Big Data

AIOS004 – Developing Software for Portable All-In-One Devices

EDCS005 – Big Data Analytics Software Technologies for the Developer and Deployer

EDCS006 – Moore’s Law And Big Data – Let’s Make Big Data Matter

FUTS004 – Making Big Data Relevant

SFTS004 – Build Effective and High Performance Hybrid Applications Targeting Windows* 8 UI and Desktop Environments

SPCS006 – Technology Insight: HTML5 – The Most Viable Path to Seamless Computing 

BCSS001 – 4th Generation Intel® vPro™ Platforms: Developing Compelling User Experiences

BCSS002 – Intel® Setup and Configuration Software: Discover and Configure Intel® vPro™ Platforms

BCSS003 – Meshcentral.com – Using Intel® AMT and Intel® Smart Connect Features From the Cloud

Finally I would like to give a special mention to the keynotes, which are highly valuable source of information for visionaries and to the sessions to be delivered by Ylian Saint-Hilaire because his sessions are not only very interesting for Intel vPro – related professionals but they’re also great examples of how to mix trendy technologies like HTML5, cloud and so on. See you there!

Thanks a lot!

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer

MVP Award 2013 – Visual C#

Hello everybody,

I have been pretty busy during the last months, but I wanted to write about this before time goes on (also, I just woke up at 3:00 AM after flying from SNN to SFO, perfect time for writing!). So I got good news, I was re-awarded as a Microsoft Most Valuable Professional in Visual C# during last April, 2013 (very busy I’d say!). I would like to thank you to all of you who reads/follows/sponsors my blogs (this and my another one @ Intel) and my offline activities (e.g.:  SQL Saturday # 229 @ Dublin) because your questions, comments and compliments/suggestions make feel that I’m contributing  to make this world a better place through knowledge sharing in computer science. Here a nice pic :

mvp_pic

Thanks a lot!

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer

SQL Saturday #229 recap

Hello dear readers,

Last weekend I presented a session titled «Data Architectural Patterns in C#» in the SQL Saturday #229 Dublin. I want to mention that this event was very organized and I enjoyed a lot giving my talk because of the nice audience and cool peers.

Here there are some pics of  the event:

I uploaded the slides I used here.

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer

//Build Party 26 June 2013 @ Cork City, Ireland

BuildIrelandBanner

Hello everybody,

On October 26 2012 Windows 8 was launched, ushering in new touch centric devices and new developer opportunities.

Come Join us on Wednesday 26 June to see what’s next for Windows, Windows Server, Windows Azure, Visual Studio and more. Build gives you the latest know-how for creating and implementing your great ideas, and then differentiating them in the market. Get yourself registered and join us on June 26th for immersive presentations delivered by the engineers behind Microsoft’s biggest products and services, while networking with other Irish developers, designers and IT professionals getting the first look at what’s next.

What’s Happening

4.30pm – 5.00pm Introduction to Build 2013 and MTUG
5.00pm – 7.00pm Build Keynote Live from San Francisco
7.00pm – 7.45pm Local Q&A + Skype with Irish attendee at Build
7.45pm – Late To the bar to continue the conversation and networking

Venues

Dublin  – Hilton Hotel, Charlemont Place, Dublin 2
Belfast  – Hilton Hotel, 4 Lanyon Place, Belfast BT1 3LP
Cork  – Clarion Hotel, Cork City Centre, Lapps Quay (I’ll be the host)
Galway  – Meyrick Hotel, Eyre Square (formerly the Great Southern Hotel)

We look forward to seeing you on the 26th, we’ll have the Big screen, Refreshments and possibly some prizes to give away. All the sessions can be watched on demand afterwards here. This event is sponsored by Microsoft and run by the Microsoft Technology User Group -MTUG-, I’ll be running/hosting the Cork City edition.

Event link here.

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer

SQLSaturday #229 #Event

Hello everybody,

On next 21 and 22 of June 2013 in  Hilton Dublin, Charlemont Place, Dublin 2,  the SQL Saturday #229 will be back to the Republic of Ireland’s capital: http://www.sqlsaturday.com/229/

I’m happy to comment that I’m preparing a presentation for that event titled «Data Architectural Patterns in C#», more information here: http://www.sqlsaturday.com/viewsession.aspx?sat=229&sessionid=14846

The session topics are described as follows:
(1) Data architectural patterns that can be implemented in a modern Software Architecture for favoring non-functional requirements such as resource management (concurrency, even distribution) and resource demand (incremental caching, hash partitions).
(2) Design techniques (like Resource Pooling, Do Not Wait / Fire and Forget , caching components) and principles (like Eventual consistency, CAP theorem, Fine grained vs coased grained, Statelessness, Idempotency and fallacy of zero latency) to improve the application performance in the data access layer.

The session is for Software Developers/Designers/Architects and Data Architects interested in exploring the available software architectural patterns and techniques.

Hopefully see you there!

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer

Guidelines for designing layers and packages – Part II

This column is the (unplanned) second part of the previous post: “Guidelines for designing layers and packages”.

As a software architect you should ask some questions (and come up with a serious evaluation of some alternatives) like the following ones:

  • What are the operational (common) services you (own and) provide out of the box to all projects (i.e.: authentication, provisioning, SOMETHING to consistently read/write parameters –into DB or config files-, a tenant load balancer –for multi-tenant SAAS environments-,…).

If more than one developer in your team uses AppSettingsReader (and you AS technical lead haven’t come up with a wrapper class around it, consider yourself a bad SW Designer –therefore a terrible SW Architect-)

  • Which layer(s) should handle the errors?
  • If your solution contains Web Services, where will you place them? (e.g.: in the same application directory that other application pages)
  • Where will you place the Factories? (i.e.: in the business rules layer).
  • Where will you place the common abstractions? I mean, if you did any technique based on common abstractions (dependency inversion, strategy pattern, IoC, …).
  • How to handle the code (from upper layers) which does not use the single Facade entry point of the next layer below?

As a software designer you should ask:

  • What’s your policy for finalizing unmanaged resources? (e.g.: enclosing them in using blocks? Close + Dispose?)
  • What are the definitions for common constants? (e.g.: -1 for not found? Date time formats?)
  • How many classes should a package contain? How many packages should a layer contain? How many layers should a module contain?

A software layer usually contains one package, BUT is not always the case (prepare yourself to recognize them).

  • How is going to be the internal DLL distribution process? (An email to ALL does not count).
  • How will technology/middleware specific object be consumed? I mean, if you’re using a distributed cache, will all of you projects have references to that specific DLL (I call them dirty objects)?

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer

Blog de WordPress.com.

Subir ↑