WCF Se Maine Pyar Kiya Tak :)

Today, we’re going to understand a new concept and for that matter, you must be familiar to Bollywood and movies like ‘Maine Pyar Kiya’ (MPK). You can say this as a pre-requisite.

In MPK, there was a situation, where hero and heroine were separated a distance apart. Then heroine used to send ‘Love Letters’ using pigeon postal service. And she used to sing a song for that matter – ‘Kabootar Ja Ja Ja

Untitled-1

Now, Windows Communication Foundation (WCF) is a unified programming model to build distributed applications. In our scenario, Sallu is providing his ‘best love’ services (pyar, daulat, shoharat, etc…) and Bhyagyashree is going to consume those.

Here hero and heroine are at two distant places and we call it as end-points. And, if they want to communicate, they must have ABCs i.e.

  1. A for Address on which she will send a letter, look at Sallu’s address
  2. B for Binding which defines how they communicate – here ‘OnAirBinding’ or Pigeon is used
  3. C for contract, the contract between Sallu and Bhagyashree says, if Bhagyashree wants Sallu to bestow all romantic poems, letters on her, she must send a love letter to him, kind of.

This scenario depicts the basic peer-to-peer communication in WCF (oops Bollywood movies). Here, in this mode of communication Salman is service provider and Bhagyashree is consumer, but sometimes situation can be other way round. And it’s very much possible.

image

In this new picture, what do you understand?

Well, WCF is not just about peer-to-peer applications. But can be used in many different applications as well. In this case Salman is a service provider (or publisher) and Aish, Kat and Bhyagyashree are service consumers (or subscribers). They are registered with Salman for his ‘best’ services.

But to provide these services, everyone needs to have ABCs.

  1. A – Address. Everyone will have a unique address for communication purpose
  2. B – Binding. Everyone will have their own mode of communication. In previous case it was Pigeon service, now it’s Email, Phone, Mobile and what not. WCF provides bindings like Http, TCP/IP, etc…
  3. C – Contract. All these actresses will have their own terms and conditions to work with Salman. And these terms and conditions will be put into contracts.

The main advantage of WCF is – it can communicate with any other technology. That means, WCF can communicate with .NET Managed based applications, Native applications, J2EE based applications.

To consume WCF services, client creates a proxy object of the service (mostly called as ‘ServiceClient’). In our scenario, all the gals will be having their own ‘personal copy’ of Salman Khan; however, original Salman is totally different. It’s like Salman will be having clones to enjoy himself with his girlfriends. Remember Dev Anand in ‘Teen Devian’? Nice idea, if we could implement in our world.

Probably, I’ll share some technical examples in next few posts. But, after this, you can see the how WCF works.

Enjoy.

Namaste

Mayur Tendulkar | www.mayurtendulkar.com

Must Read Guest Post – Electrical Concepts in Bollywood

I always wanted to share this story with you all. The story is about the analogies, or to be precise Latch-On, I’ve made for electrical concepts. This happened, when I was pursuing my Diploma in Electrical Engineering, on a Teacher’s day, one of my teachers asked me to teach something to the students. And rashly, I thought of this story and everyone liked it. Now, I always make such latch-ons for everything which I want to remember for life.

In electrical, we talk a lot about positive terminal, negative terminal, potential difference, direction of current, and direction of electrons, resistance and what not. Let’s see, how our Bollywood movies represent electrical engineering.

In a typical Bollywood film, there is this Hero, Shahrukh Khan (A Positive terminal or pole), who is always attracted to this heroine called Kajol (A Negative terminal or pole). And as you know, guys always run behind girls. Just like that Shahrukh was always running behind Kajol. Yes, you can see lots of movies of them, K3G, KKHH, DTPH, DDLJ and many more. If you’re a movie freak, you’ll understand what I mean when I say K3G.

And here in electrical engineering current flows from positive terminal towards negative terminal.

Now, there are some movies, in which Shahrukh had a one sided affection towards Kajol and Kajol was not at all interested in him. This is doleful one sided affair. And can be found in movies like Anjam, Darr, etc… In case of electrical engineering, Diode represents this one side affection. When Diode is used, current can flow ONLY in one direction. Either Hero loves a Heroine OR Heroine loves a Hero. No two sided traffic is allowed.

However, there were some movies like Sapaney (at that time called as Right Angled Triangle of Love) and Duniya Dilwalon Ki (at that time known as Equilateral Triangle of Love), which has one heroine and two heroes chasing her. No wonder, I find the similarities in Transistor, which is a three terminal (P-N-P) device. And may be sometime N (heroine in this case) more infatuated with left P (Prabhudeva) or sometimes left P (Arvind Swami).

Now, in typical Bollywood film, there is villain, ladaki ka baap. Yes, girl’s father is always against the love life of these kids. In electrical engineering we have same effect called Resistance, which actually resists OR opposes the flow of current i.e. from hero chasing his dream girl or vice a versa.

Now, there are some effects of electric current. These effects are magnetic effect and heating effect. Well, as hero and heroine are attracted towards each other, represents the magnetic effect of their current, oops, should I say love? And for heating effect, I better close my mouth over here and give you an opportunity to think about. And build more concepts from here. :P

Seriously, my funda is if you want to learn something, you need to make it look like with your daily life. Or at least with the things you enjoay, may be its food, movies, whatever you enjoy the most. Just like I made this resemblance of Bollywood and Electrical, I’ve another analogy of Microsoft .NET framework and hotel industry. You can check it out in my previous posts.

You need to make it weird; you need to make it simple. This will help you to clear your concepts and understand the things more transparently. Mugging up is not the solution.

I hope you enjoyed it.

Namaste

Mayur Tendulkar http://www.mayurtendulkar.com/

Revisiting – Device Development

Technology is amazing and has changed itself and our life – significantly. We’ve seen computers filling entire room and heating up like hell. In this day and age, we call them Personal Computers (PC), sometimes which can be carried anywhere in a form of Laptop, Personal Digital Assistant (PDA) or even a small embedded ‘smart-device’. These devices also include mobile phones, PDAs, ATM machines, Kiosks, Tablet PCs, Robots, Electronic toys, Music systems, digital cameras and what not. And these small devices are capable of doing lots of things and that too within a fraction of a second. You just need to wish (or should I say ‘program them’) and these devices will obey the command.

Programming these smart-devices is exigent task. Developers don’t have that luxury of GBs of RAM OR TBs of hard-drive space OR GHz of Processing power with 32 OR 64 bit addressing space from a desktop OR even millions of pixels and thousands of colors hogging up screen OR even 24x7x365 broadband connectivity.

When it comes to smart-device programming, developers need to mull over many scenarios. Most of the today’s smart-devices still have 100-200 MHz processing power or even less with small addressing space like 8-bits OR 16 bits. These devices don’t have hard-drive and by and large they depend upon flash memory of MBs and termed as ROM. These devices also have a constraint on RAM. Mostly these devices don’t have a display screen (called as headless device) or if they do have, then it might be in a size of 240×320 with only selected color scheme. Even these specifications change from device to device and according to the position in which device is held like horizontally OR vertically. Sometimes, these devices have limited connectivity like Wi-Fi, Infrared, Bluetooth, GPRS, Cellular network or sometimes no connectivity at all. And as a developer, we need to think about how the application will behave in these scenarios.

There are lots of technologies out there to help us command these devices and address these scenarios. Depending on the type of device, its working process model, environment conditions, cost and risks associated, development process, time to market these devices and last but not least – interest of manufacturer, developers can choose any technology which suits and interests them.

These devices can be powered by technologies like Microsoft Windows Embedded family, Linux, Symbian, iPhone, Android, etc. and can be programmed by C, C++ and Java. And nowadays developers can choose VB.NET or C# as well – whichever is perfect for them.

There is subtle difference between writing applications for desktop/web and these devices. Developers build apps for desktop OR web and just deploy it. But in case of smart-device, if the device is a brand new custom made device, perhaps developers would need to have their own operating system running on it e.g. Kiosks, ATM machines have a custom made OS. And then, developers will write an application which will run on top of it. After all this, what if developers don’t have access to a real device?

Does it look pretty complicated? Well, it’s easy once we get our hands dirty with some practical stuff.

In next few blog-posts, I’m planning to share my understanding of Windows Mobile, Windows Embedded, Symbian, Android and iPhone with you.

So, stay tuned and keep looking for further updates on technological world.

Namaste!

Mayur Tendulkar