tags:

views:

257

answers:

9

Hi,

I have the task of developing an application to pull data from remote REST services and generating Excel reports. This application will be used by a handful of users at the company (10-15). The data load can reach 10,000-200,000 records. I have been debating whether to use Python or C#...

The only reason I am considering Python is because I am familiar with it and it would be less of a risk.

Personally I want to try use C# since this would be a good opportunity to learn it. The application is not too complicated so the overhead of learning it won't be too much... I think.

Are there any issues with C# that I should be concerned about for this type of program? The users run Windows XP... would users not having .NET installed be a major concern?

Thanks in advance.

EDIT: I guess I need to stress the fact that the end users should be able to run the application without installing additional libraries/frameworks.

+2  A: 

I would normally say, use what you know.

However, here you may have some performance issues using an interpreted language. I, myself, would use C#. If you want to learn it, now is as good of a time as any.

However, if your own cost/benefit analysis reveals that you would be better off in python, use that.

.NET will be required for C# on windows, but you can use the .NET Client Profile to make the install pretty painless.

John Gietzen
The performance issues won't probably come from the language or environment, but from how you handle the data (i.e. the algorithm)
hasen j
The Python language is not interpreted but also compiled to bytecode, the difference lies in the dynamic nature of the data which prevents the same level of optimization than C# allows.
RedGlyph
Is it reasonable for me to expect .NET will be installed on all the end user's machines? It is pretty crucial that the application is smooth and painless as possible... that includes no additional downloads.
lucks
100K records is a pretty tiny dataset to worry about performance issues. Given that they're being fetched from a remote server, I'd bet they'll spend more time in transit than in being processed.
Just Some Guy
@RedGlyph: IronPython can be compiled. Python is interpreted (they say so on the homepage.)
John Gietzen
With respect to the .NET framework being installed, it's likely there, but you should check which version is there. I had the unpleasant surprise to build something against .NET 3.5, to be told that "IT had not validated .NET 3.5 yet". Fortunately, they had "validated" .NET 2.0, and I think it's a safe bet to assume 2.0 is there in general - but I have been surprised at how many people didn't have 3.5 on their machines yet...
Mathias
@John: Yes, in a way. CPython compiles the code to bytecode which is run by a virtual machine, as JPython is compiled to bytecode for the Java virtual engine, and IPython to bytecode for the CLR. For example, you can see it with `import dis; dis.dis(f)` after defining the function f.
RedGlyph
@John: Technically, by that definition, C# is interpreted, too. The definition differs, however, from the one people use when they think of scripting languages in general. Python runs as bytecode on a VM, just like Java or C#. The major difference is that implementations for compiling to bytecode for other VMs exist and Python modules can be compiled on demand, i.e. dynamically.
Alan
Ah, I see. I was unaware that it was actually running on a VM. Anyways, I'm +1 on the IronPython idea anyways.
John Gietzen
To add to the shades of grey, C# is also normally JIT-compiled, as some implementations of Python are (Psyco, Laden-Swallow for instance), which makes them much more performant. I'm not sure how they achieve that for Python (dynamic nature of the data being an obstacle). Then also, some processors directly take Java bytecode and are very fast at it.
RedGlyph
1: The reason that static languages are fast is because the lack of flexibility allows the compiler whole classes of optimizations that just aren't available to dynamic languages. 2: Python is pretty damn fast, and unless you are doing video encoding or something else extremely cpu intensive, I/O is usually an issue long before cpu is. 3: Python is not JITed, .pyc files are binary caches so that the interpreter doesn't have to re-parse the text file. LadenSwallow is far from ready for prime time, but it uses LLVM, which is a highly performant platform for dynamic languages.
Matt Briggs
A: 

If the users have to install a C# client then not having .NET installed would be an issue. You can package the installer so it downloads the .NET runtime, but depending on what features you use it could be quite a big download.

If your application is web based then all the C# code runs on the server and just delivers HTML to the browser so whether .NET is installed or not shouldn't matter.

ChrisF
+5  A: 

If you want to learn C# and you don't have such a limited time constraint, now might be a good time to try it. Also, though I haven't done Excel work with either Python or C#, I would expect it to be easier to work with Excel files with a Microsoft product rather than Python. If you're just dumping data in CSV format to a file, though, either Python or C# will work fine.

If you want to try something even crazier, you can use IronPython such that you'll have .NET resources available but you can still write in Python.

Sarah Vessels
I don't think using IronPython is crazy! It's a pretty mature product, and it would allow full interop to the .NET Excel assemblies. And C#/Office interop is pretty painful in C# 3: IPy features like dynamic binding and optional/named parameters might well make it *easier* than using C#! Well worth investigating as an option I'd say!
itowlson
Interop isn't that bad - at least not after doing any sort of Office development in a pre-.NET world. ;-) However, there is a nice wrapper up on Codeplex that I have used that has a much cleaner API: http://msofficefornet.codeplex.com/
joseph.ferris
While I don't have experience with Python, I have done quite a bit of C# + Excel, and this is among the least "natural" C# code you will find (Interop returns mostly un-typed objects, function signatures are horrendously long because of the lack of optional arguments in C#...). C# does work great to achieve the goal described, but from a pedagogical standpoint this is not the first assignment I would give!
Mathias
+12  A: 

Why not IronPython which merges the two worlds together?

mimetnet
A: 

Integration with Excel will almost certainly be simpler from C#. Given the requirements "Windows only" and "Integrates with Excel", it would seem a simple choice that C# is better suited to this individual problem.

And, no, users' not having .NET is not a concern compared with Python as the alternative. The Dot Net framework is a standard part of Microsoft Update. In contrast, Python will almost certainly not be there on the average end users' machine. In your case, with an internal app, that last point might not matter of course.

Clay Fowler
Can't I just use py2exe to compile an executable for the end users?
lucks
Yes. I'm not sure if py2exe works with IronPython, but IronPython Studio has facilities to generate .exe's from scripts.
Nick T
A: 

If you are doing any kind of HTTP work with C# make sure you take a look at the new HttpClient library that is in WCF REST Starter Preview2. Ignore the name of that download, the HttpClient part can be used independently of WCF.

It is a WAY better client than just using HttpWebRequest.

Darrel Miller
A: 

If you do a web based application not having installed .NET in the client machine wont be a problem .. but I suppose you dont want to try both C# and web development at the same time

Pablo
A: 

It is easy with Python to pull data from a web server, parse the JSON or XML, and generate some kind of report. If you need really good Excel integration (for example, your output is supposed to be an Excel spreadsheet that includes numerous graphs) C# might be better, but Python is still possible; there is PyExcelerator for writing rich spreadsheet files, and there is Python support for COM if you want to use COM to talk to Excel.

With Python it is also very easy to make a stand-alone executable, for example with py2exe.

This sounds like a batch tool, one that won't have a GUI; I think I would write it in Python if I were you, unless I really wanted a fun project to help me learn C#. But anything with a GUI, C# is probably better. (I haven't done GUI development with Python, but I have seen comments here and elsewhere that the performance of Python GUIs tend to be slow.)

steveha
A: 

The answer probably has more to do with the circumstances than the question of which is the better language for the task at hand.

If you have no prior C# experience, it's probably not a good idea to jump into it now and learn it as you go along. Syntax differences are trivial to learn, mastery is defined by knowing the dirty details and how to use the language's strengths to get the job done.

If you have plenty of time and starting over a lot is NOT an issue, or you have experience with a language that is paradigmatically very similar to C# (say, Java or C++), you could probably afford to take the risk and adapt to the new language very quickly.

If you don't care about efficiency (e.g. it's a pet project, you don't care much about your job or efficiency simply isn't important), try C# just to learn something new (always a good thing) or stick to Python to make sure you won't have to adjust your thinking too much (always a source of vulnerabilities and misunderstandings).

If you definitely want to use C#, you should play around with it in your "free time" (not necessarily at home, but preferably at work when there's nothing else to do) and thus build a skillset you can use once you have to start with the actual project. This way you'll already be familiar with the paradigm (to use the term loosely) and encounter less problems where they count.

Alan