Language Wars

When I started programming, one of my friend and I always had a fight over programming languages. He used to be a nerd and preacher of C++ language whilst, I’m being tenderfoot, always favored Visual Basic aka VB.

He insisted that, being a machine level, ‘PURE’ language, C++ is the most powerful while I believed that VB is most simple, easy to understand and hence can deliver the commands more transparently. Hence, VB is more powerful. But indeed, these were kid-fights.

But, I can see these fights and they still exist in industry too. Many people debate over C#, VB, Ruby, Python and many more languages. However, when it comes to C# and VB.NET, how does it matter? Both of these languages are going to target the same CLR, use the same CTS and the same BCL. And at the end of the day, it’s going to be MSIL. Or to go at deeper level, it’s just going to be 0s and 1s.

Let’s say, if you go to the hotel and order the food in Marathi or Hindi, you’re going to get the same thing, which you’ve ordered. So, if you ordered Pizza, you’re not going to get Dosa.

Nevertheless, guys, it’s not about the power or purity or level of a language, but it’s always about the ease. How easily, I can order the system to perform some tasks? It’s the matter of simplicity. If someone is trained on English since childhood, definitely, he’ll prefer English in conversation. Same ways, if you know VB since ages, you’ll prefer VB in your projects. However, there can be some business reasons behind choosing a particular language.

But, in .NET parlance, it really doesn’t matter, whether you choose VB or C#. Though, previously there were few features available in C# only (like Automated Properties) are now available in VB as well (like Line continuation). And just like that the features dominated by VB are now integral part of C#.

With the release of Visual Studio 2010 and .NET Framework 4.0, developers will have a CHOICE of language. Most of the features are common to both, VB and C#. In subsequent posts, we’ll see the new features introduced in these languages. Meanwhile you can revisit my previous entries to see what was new in previous versions on C# and VB.

I remember one story of Akbar and Birbal and would like to narrate it over here.

One day a guy came to Akbar’s darbar and challenged Birbal to guess his mother tongue. He was so fluent in every language, that every one was shocked. Every one was worried about, how Birbal is going to guess that guy’s mother tongue.

But friends, wait a sec. He is Mr. Birbal.

At night, when everyone was sleeping, Birbal went to Akbar and said, “Boss, do you wanna know that guy’s mother-tongue, then come with me”. Both of them went to the guest house, where that guy was enjoying a sound-sleep.

Suddenly, Birbal poured a bucket full of water on that guy’s head and that guy woke up and shocked. The first word came out of his mouth was “You A****E”.

Birbal said, “Bingo!!! Boss, this is your mother tongue. Whenever people get hurt, delighted or want to express their emotions/feelings, they use their mother tongue.”

And thus, once again Birbal won this challenge.

I hope you enjoyed this story. J

Namaste

Mayur Tendulkar | www.mayurtendulkar.com

Advertisements

Sending SMS

Windows Mobile SDK allows developers to send SMS from their application. For that matter, there is a special object model called as Pocket Outlook Object Model (POOM), which allows developers to access Pocket Outlook data (Contacts, SMS, Email, Appointments, Tasks) from device.

SmsMessage sms = new SmsMessage();
sms.To.Add(new Recipient("Mayur Tendulkar", "+919561051234"));
sms.Body = "This is a test message";
sms.Send();

But unfortunately, when SMS is sent, there is no track of it. By default, neither this sent SMS will appear in ‘Sent Items’ folder nor there will be any delivery receipt. This SMS will be sent silently.

Luckily, POOM also have another class, using which developers can send the SMS and they can keep a track of it. This ways, end-users will get delivery receipts and SMS will appear in ‘Sent Items’ folder. To send SMS using this way, use following code.

OutlookSession os = new OutlookSession();
MessagingApplication.DisplayComposeForm(os.SmsAccount.Name,
"+919561051234");

This is too good. With just two (2) lines of code, WM provides, a SMS sending dialog box (just like Common Dialog Box Objects, e. g. FileOpen, FileSave, Font, ColorPicker,..)

Apart from this, it also has spell checking, dictionary facilities.

You can find more information about this MessagingApplication.DisplayComposeForm at http://tinyurl.com/yff83hd

I hope, this will help you to build SMSable Apps.
Happy Coding.
Namaste
Mayur Tendulkar

J2EE & .NET Interop

I’ve realized one thing – there are so many technologies, using which developers can build applications and solve real world problems. These technologies include Microsoft’s .NET, Sun’s J2EE, Adobe’s Action Script based technologies like Flash, Director and even there are some age-old technologies like C++, COBOL, Pascal, etc…

But frequently, in this day and age applications are developed using .NET and J2EE. Rather, there are already so many applications in the market – which are developed using these technologies. And for sure – these technologies are going to be there to solve many problems like – platform independency, language interoperability, data consistency and what not.

Unfortunately this situation makes developers life frenzied. Because, some applications like Payroll Management are written in J2EE and are working fine whilst Leave Management application, which is working superb was developed using .NET Framework. Now both, J2EE and .NET have different features set, different data-types and to make it more complicated – different working runtime with totally different internals. So, how these applications could ever interact with each other?

Well, there are some methods, using which these applications can talk to each other. And these methods have their own pros and cons as well. So, let’s see these methods one by one.

1. Using common storage methodology:
This is the easiest way to communicate between J2EE & .NET. Both technologies can talk to database using JDBC and ADO.NET technology. So, let’s have one database, which will store data, which is common to both of these technologies. So, whenever there will be any changes to this data, J2EE and .NET will work accordingly. But there are disadvantages as well. Every now and then, J2EE/.NET application will need to check the database for changes, making both applications sluggish. Plus, it will involve writing large number of lines of code – just to manipulate that data, rather than working on core business logic.

2. Using Inter Process (In-Proc) Communication methodology:
This is the most complicated method ever to communicate between two applications written in J2EE & .NET. In this case, one can ‘host’ the JVM and CLR into one common process. But it’s not that simple as it seems. By this way, one will have to load JVM.dll and mscoree.dll into a single process – which is a complex task to do. This can be achieved by C++ functions like CreateProcess() and LoadLibrary(). But, once it is done, developers can use Java Native Interfaces and .NET Interop for communication and for allowing code access from each other.

So, far it looks pretty challenging, but interesting scenario to bridge the communication channel between these technologies. However, both of these technologies have different standards and set of libraries.

But luckily, one more way is there to interop between these technologies, which has been standardized by many vendors – to save life of developers XML Web Services.

Both J2EE and .NET have their own implementations of Web Services. But ultimately, these web services use SOAP standards and XML to communicate with each other. XML being open (as in not a proprietary of any vendor), text based and easy to cross firewalls – is most preferred. Here, it’s not about XML being used as user defined tags OR to store data. But it’s about transferring data from one part of the world to another, i.e. from J2EE to .NET and vice versa.

To this point, these methods are here to solve the problems being faced by developers to communicate within different frameworks. And developers will be able to write applications in these frameworks.

But once you understand that, at the end of the day – this is just a matter of 0s and 1s, every technology and interop will look easy. :)

Namaste | Mayur Tendulkar

Your chance to WIN

Microsoft India is running a contest for Windows Mobile (aka Windows Phone) developers. You can find more information for this particular contest at: http://www.msdncontest.com/mobile/default.aspx

But, why one should participate in this contest? Well, there are many reasons:

  1. Building desktop and web applications is pretty easy. Developers have the luxury of processing power, memory, screen resolution, bandwidth, whilst in case of mobile – it’s pretty challenging. This contest gives a great opportunity to professional, novice as well as hobbyist developers to understand and get started with Windows Mobile application development.
  2. This contest will allow participants to submit their application to Windows Mobile Marketplace. This is the great chance for you to start your own business and get recognized in software or IT world. 
  3. Apart from these benefits – developers will get to know the rules about mobile application development. Yes. Any Johnny can write a code, but to make it better and to get ‘Certified for Windows Mobile ‘ logo is pretty challenging and interesting. Like, the immediate action item should be on left soft-key, menu items on right soft-key and much more. Developers will get to know about these rules from this contest. A special document has been provided on the contest site about these rules and regulations (or guidelines) for Windows Mobile application development.
  4. And last but not least: you can win 100000 INR cash prize with lots of other goodies like Windows Mobile phones, Certificates and what not.

To get started with Windows Mobile development, you can visit MSDN portal and watch out for cool videos at: http://www.windowsmobile.com

I’ve created some screen-casts on Windows Mobile and you can find them here :

Events! Events!! Events!!!

With monsoon around, this is the time of events ‘n festivals in India. This time in August, Pune User Group (PUG) is proud to host its annual event ‘PUG DevCon’ for 2009 – A professional developer conference.

This is a free event for developers organized by PUG with support from International .NET Association (INETA) and Microsoft. Here, developers can learn about new technologies from the experts. This year, DevCon will be happening on 8th and 9th August 2009 and will be having 2 parallel tracks with 16 back-2-back sessions. Apart from that, there will be quiz and winners will get some exciting prizes too. So, don’t waste time and act now.

For more details, please visit: http://devcon.puneusergroup.org

And, I’m happy to say that, I’ll be presenting 2 sessions in this DevCon 2009. Soon, I’ll publish the details about these sessions.

Along with it, I’ll be taking one more deep dive 3 hr session on Live Framework in October and we’re working on it.

Stay tuned for more information.

Namaste

Mayur Tendulkar

W7: Windows 7 Release Candidate – Complete resources

Windows 7 Release Candidate (RC) is out for public through MSDN and TechNet subscriptions. If you’re a MSDN or TechNet subscriber, then you can download it from here: https://msdn.microsoft.com/en-us/subscriptions/securedownloads/default.aspx OR https://technet.microsoft.com/en-us/subscriptions/securedownloads/default.aspx

For those who are new to these words like Alpha, Beta, RC, RTM –you can find more information at: http://en.wikipedia.org/wiki/Software_release_life_cycle

There are few changes from Beta to RC release. Most of these changes improve the performance of OS and W7 engineering team has written a nice blog about it. Read it here: http://blogs.msdn.com/e7/archive/2009/02/26/some-changes-since-beta.aspx

The installation procedure for this release is almost same as of Beta release. There are some rumors about unable to upgrade Beta release to RC release. However, there is a post on this upgrade scenario and you can find it here: http://blogs.msdn.com/e7/archive/2009/04/07/delivering-a-quality-upgrade-experience.aspx

But again, the main question is what about developers? Well, Microsoft has released a software development kit (aka SDK) for it too. You can find it on MSDN link posted above. There will not be ‘big’ changes as in APIs. Most of the code written for Beta should work with RC release. Rather, you’ll find some more managed APIs for Windows 7 in future release of SDK or as a separate package.

As I mentioned in my last post (W7- Seven is a magical number) you’ll need Windows 7 RC machine, Windows 7 RC SDK and Visual Studio 2005/2008 (Express editions will work) to start development for RC release.

In my next post, we’ll talk about developing applications using latest Win7 SDK and we’ll see some code for it.

Namaste :)

Mayur Tendulkar

W7: Seven is a magical number

As the title says, seven (7) is a magical number. There are several ‘seven’ things in this world like seven colors in rainbow, seven days a week, seven musical notes in Indian music, seven wonders of the world and yes, we can’t fold a paper from corner-to-corner for more than seven times. Try it out with any kind of paper with different GSMs.

For many people, technology is a magic. Many things work behind the scene and looks like a magic. for example, for a new user, when he’s typing in word, spell check and grammar check can be a magic. For a novice developer ‘IntelliSense’ which shows methods, properties when he puts a dot after object name might seem like a magic. Just like that there are so many things which look like a magic, has happened with the new operating system which Microsoft is about to ship in this year. And the twist of fate is the name of this operating system –Windows 7 or Win7 or simply W7.

Win7 has copious new features which bolster productivity, makes life easy, secure data and ultimately gives rich end-use experience. Every minute thing which has been included in Win7 has a strong study behind it. For example, it has a new feature rich taskbar. This taskbar has been newly designed to support touch functionality. Icons are big enough making figure touch easy, these icons glow in a color which is specific OR highly used in that icon. Like, if user will hover the mouse pointer on Office PowerPoint 2007 icon – it glows in red while if the icon is of Office Word 2007, it glows in blue.

Apart from it, Win7 introduces a concept from Office 2007 called Ribbon User Interface. Microsoft has taken a gigantic step while introducing Ribbon in Microsoft Office 2007. What would have happened, if customers cast off the user interface? But Microsoft took this risk and added Ribbon UI. Now, this UI seems to be the easy and most productive user interface. And yes – many people like it. This Ribbon UI is a part of W7 operating system as Scenic Ribbon. You can see this Ribbon everywhere in WordPad, Paint etc…

Along with it, there is a new concept which replaces Folders called as Libraries. Libraries are the destinations where users can find and organize their data as collections of items that may span multiple locations across computers. Libraries take over from the functionality of folders (e.g. Documents, Pictures, Music) and replace them as a main “storage” destination. Many times, I put my music files on ‘E:\Music’ or ‘E:\Zune’ folder and create different folders for Hindi, Marathi, English songs. Now, I don’t need to do it. I just need to put all these files at any location and I can find those files from my Music Library folder. Yes, you can still do it in Vista, but these ‘Libraries’ in Win7 are more than just ‘Folders’ in Vista.

There are lot more features than these, which helps to make life much more easier. You can see a complete new list at: http://www.microsoft.com/windows/windows-7/whats-new.aspx

But what about developers? What developers are getting out of it? Well, as new products from MS comes out, it comes with new APIs and helps developers to build applications on top of it.

Most of the APIs which are shipped with Windows 7 SDK are COM based or can be used in C/C++. But Microsoft is working on managed wrappers and soon, there will be managed APIs to play with new operating system.

Through this blog (along with Windows Mobile development), I’ll share, how developers can exploit these APIs and build stunning applications for the new operating system.

However, before starting with development, you might want to install OR setup the development platform for Windows 7 development. So here are the tools that are required for it:

  1. Microsoft Windows 7 Beta (Build 7000 or later): You can download this build from here: http://www.microsoft.com/windows/windows-7/beta-download.aspx
  2. Microsoft Visual Studio 2008: Download OR order it from here: http://msdn.microsoft.com/en-gb/evalcenter/bb655862.aspx
  3. Microsoft Windows 7 Software Development Kit: The Windows SDK for Windows 7 and .NET Framework 3.5 SP1 BETA provides documentation, samples, header files, libraries, and tools designed to help you develop Windows applications using both native (Win32®) and managed (.NET Framework) technologies.
  4. http://tinyurl.com/dy5t6l

So, keep looking for articles and demos on building apps for new operating system.

Namaste :)

Mayur Tendulkar

P. S.: When this blog post was written, Microsoft has made an announcement about Windows 7 Release Candidate (RC) was about to ship on 5th May 2009 for public.