views:

1906

answers:

4

I will be developing some applications using mobile barcode scanners and need to choose between C++ and C# for coding on the scanners.

I am considering Intermec's CK31 or similar for the combination of wifi, scanning choices, programmability and user interface options. It runs Windows CE .NET 4.2 according to their spec sheet.

Intermec's Developer Library comes with .Net and C++ SDKs. My previous Win CE 2003 experience is in C++ (MFC GUI, sockets and serial comms). I'm comfortable in C# with WPF and can learn other GUI frameworks if I have to. That gives me freedom to choose a language - any recommendations one way or another?

I am NOT looking for answers advocating C++ over C# as languages in general - my productivity in either is similar and I have enough experience to be able to create complex, robust C++ solutions.

What I would appreciate are war stories or factors to put into our platform evaluation, about programming on these devices. eg: battery life of C# apps vs C++ apps, memory consumption or other environmental impacts of the language choice. If there are specific versions of .Net CE to avoid, that would be a good tip.

A: 

I've been developing for about 15 years. Approx 5 years in C++ and 3 years in C# (which currently is my language of choice). In C++ I always used stdlib, and sometimes boost.

I have cut my development time with a third since I switched from c++ to c#. That was done because of a couple of things (nothing scientific, just my opinons):

  1. .Net is a more complete framework and easier to use than stdlib and boost combined.
  2. C# has a better structure which make easier to read others code and to code.
  3. Unit testing in .Net is light years from unit testing in C++, especially with Resharper and xUnit (xUnit got clean syntax, resharper let's you test specific test methods directly inside dev studio).

I mostly code servers, GUI programming should be even faster.

jgauffin
thanks for bothering to answer but you explicitly ignored my instructions in the question - I don't care about language opinions, just want some facts about mobile development.
Andy Dent
+3  A: 

The answer to your question has to do with the type of your application. If your application is mainly around communicating with the hardware and only a thin layer of business logic and User Interface is needed, then C++ would be a better choice. To interact with the scanners you need to talk to a driver. This is better and faster achieved with C++. The .NET SDK will actually be a wrapper of C++ code using a ton of P/Invoke, which makes the code performing less faster.

If on the other side your application requires a significant business layer and/or a User Interface, then .NET (and specifically C#) is a better option. In that case the productivity gains far out weight the performance gains of C++.

Another important factor is the type of the devices the application is going to be deployed to. Are you targeting Windows Mobile devices only? Then .NET is a safe option. For Windows CE devices you need to investigate whether the compact framework is pre-installed or not. Also, some Windows CE devices may not support all .NET namespaces.

Finally, I recommend reading Mobile Architecture Pocket Guide, which is a recent document about architectural decisions for mobile applications.

kgiannakakis
Based on my own experience using C++/CLI called from C#, I question your assertion about the P/Invoke use in the SDK. Do you actually know this about their SDK or are you assuming?
Andy Dent
This is a general remark - I don't know the specific SDK. However, to communicate with a device driver, you need P/Invoke. It is impossible to do it with managed code. P/Invokes are probably hidden in dlls that you are referencing.
kgiannakakis
You're partly wrong. Try searching on device driver c++/cli to see hundreds of examples - C++/CLI gives a good alternative to using P/Invoke. It's not managed code but allows smooth bridging to C++ to call pure C.
Andy Dent
Thanks for the link to the Mobile Architecture Pocket Guide.
Andy Dent
+8  A: 
Adam Haile
Thanks. I love seeing someone else's enthusiasm for their work coming out despite incredible self-restraint :-)Evaluating devices has been interesting and it's early days. I agree with picking based on SDK - I was looking for some device characteristics to narrow down the SDKs.
Andy Dent
Re the Intermec CK31 - the features list "Integrated 1D (standard, long range) / 2D Intermec scanning technology"
Andy Dent
+1  A: 

First I'll strongly echo Adam's recommendation against running anything based on CE .NET 4.2 at this point for essentially the same reason. At this point it's an ancient version of the OS and unless you are getting the terminal for free it's not worth it and if you choose to do C# development the download of the CAB to run .NET 2 is just painful.

We've developed a lot of applications for both Motorola(Symbol) and Intermec devices. The current set of APIs for both of them work reliably so I'd worry more about the suitability of the device than the specific APIs. They also both provide reasonable sample programs that make it easy to cut and paste a solution.

I have noticed one other big difference between Motorola and Intermec. On the Intermec devices I've worked with (in C#), it takes about a second for the decoder for each symbology to be loaded. This typically isn't a big deal if you use a limited number of symbologies and setup the scanner at the start of the application, but can cause significant delays if you change the decoders(symbologies) within the application.

skeeve