views:

282

answers:

10

I am a student at University so my experience is limited, hence the question.

If someone says to you, here is a task to code, what are you looking at in order to choose the language or paradigm in which you will do it in?

Hope the question makes sense?

A: 

Unless it's a task that basically screams at you telling you which language it's best done in, you should pick the one you're most fluent in... I suppose.

LukeN
+13  A: 

There are many factors that would be influential:

  • How critical is performance? Is it acceptable to write a slow solution quickly?
  • What kinds of libraries would I need?
  • What's the platform? OS? Web? Mobile devices?
  • What's the nature of the problem? Regex-type string processing? Mathematical with Matlab/Maple/etc?
  • Graphics? Text?
  • How reusable do I want the solution to be?

This assumes that you actually have a choice of languages to choose from, of course. One language may suit the problem best, but if you don't know enough of it, then it's practically not an option, unless you have the time to learn.

polygenelubricants
Good list! Maybe you could add hardware/platform/OS as this usually excludes some choices as well.
0xA3
+1 - When I did some programming compilations a number of years ago, knowing the capabilities of the allowed languages made it much easier to win. Some languages are really good at some things. While we mostly talk about general-purpose languages there is still enough variables in them to make smart choices.
Nate Zaugg
Nice List, I would add cost/budget as well. The limiting factor of the choice of language may very well be what you can afford. Some libraries that may make the job easy in one language may be show stoppers due to the price.
Bill
I'm not sure when it would *not* be "acceptable to write a slow solution quickly". Even if I was writing an OS kernel today, I'd prototype in something slow-to-run but fast-to-write. I don't know any engineer who doesn't build prototypes first. In software, you simply have the bonus that the prototype might just be good enough that you don't need to build it again.
Ken
A: 

Its all about your interest and your expertise. If you have good knowledge in Java, then you do you want to spend time coding in C/c++/C#?

As far as I am concerned, I will take it on the feasibility. If the solution is feasible in .Net, I will go with .Net.

Also other things to consider are the platforms the tasks will be implemented. If the destination servers can be Linux/Mac/Windows, then go for Java. If the task requires too much of System level work, go for c. etc etc...

Chinjoo
A: 

Redundancy is the key. I would pick the language that I am most familiar with, because i'll be much more productive.

Try to pick one language and master it. Sure it is a good thing to know most languages, then you can pick the one that fit your best.

Then stick with your favorite one.

For me, its Asp.Net C# / jQuery.

PHP is have a nice community and its free. If you new, i'd start with this.

Etienne Dupuis
A: 

I look at a problem, and I think in a very high level how I would implement it in some of the languages that I know. Say for example I knew that it would take me twice as much code to implement a dialog box in MFC/C++ as it would to implement it in C#, and that my Java was a bit rusty. I would elect to program it in C#.

However, since you are a student you may want to pick a language that you're not THAT familiar with and implement the project in that language. My reasoning for that was that I came in to college knowing C++ very well. It doesn't do me much good to implement something in C++ that I know I can do. However, implementing it in C# in which I wasn't very familiar would allow me to gain more knowledge from the program than I would have gotten otherwise. Keep this concept through your years in school, and you'll end up knowing a lot more.

So basically your choices come down to whether you want to code it in the easiest language you know, or if you want to code it in a language you want to learn. There are different advantages to each decision.

Ben Burnett
+3  A: 

I think the question is "How do you know what is the right tool for the job?"

Part of it depends on the requirements. If they talk about a web interface or a database, you'll probably need some SQL experience and HTML experience. If they mention high-performance graphics displays, that might suggest C/C++ and OpenGL/DirectX. If the requirements talk about high-speed numeric processing, you might need... umm... something else. ;)

The next thing to help choose is what's available to you. If you work on a team with mostly Java experience, you will probably stick with Java unless you have a VERY good reason to switch, or if you already have a dozen licences for Visual Studio, it will probably be some sort of .NET solution.

FrustratedWithFormsDesigner
A: 

The first thing I'd look at is: what languages/paradigms do I know? Based on that answer, I'd ask myself which language's/paradigm's strengths play into the problem. Here's an example:

I know JavaScript, Java, and Python (for purposes of this conversation). Is the problem web-based? Huge argument in favor of JavaScript. Would easily trying out new ideas be valuable for this problem? Big argument in favor of Python. Is it long-running and performance sensitive? That's an argument for Java.

Hank Gay
+1  A: 

I always look at a couple of different aspects. Most of it comes down to the support libraries languages have, the environment, and human factors not the language itself. That being said different languages have different strengths and its important to pick the language that matches what you need to do. Below are some of the things I consider when starting a new project.

  1. The scope of the task to perform. Is it a big enterprise level task or is it something smaller. Different languages have different levels of support for different scopes.
  2. What type of problem is it? Is it mathematical, textual, logical, user interface driven? The different paradigms of a language will determine the type of problems it is suited for. You most likely wouldn't use a procedural language for something that is UI driven.
  3. How well do you know a language? Most of the time there is going to be more than one language for the job that perform equally well. Your ability to code (or willingness to learn it) in the language is important to be able to get it done.
  4. What environment is this in? At work I have different requirements than I do at home. Work more often dictates a limited number to use. Also if I am on a team with other people they probably are going to need to understand it as well.
Craig Suchanec
A: 

In the real world, you are almost always building on libraries and frameworks created by other people. So the first question I ask is often what are the best libraries and frameworks to use, and then build on them. Which breaks down to, in approximate order of how much I use them:

  • C++ for intensive graphics and image processing, some numerical work and high level interpreters.

  • Java + XSLT for web server side (though I haven't done much web for about six years, and might use look at using Ruby for some stuff there, or .net in an MS shop)

  • C# for business forms and less intensive graphics

  • python for very small scripts, occasionally small GUI apps.

  • C99 if I want to use lower level libraries, lower level interpreters, and occasional PIC or embedded systems.

I've also ended up doing a bit of Fortran maintenance, but never initiated a Fortran project.

These aren't in any way definitive, but just are what I've found works well in those areas. Some of it is judgement - do I want to trade off long compile times and simple modularity to get a combination of performance and expressiveness (C++)? Do I want to create modern looking form-based GUIs very quickly (C#)? Do I want to manipulate pointers and write my own garbage collection routines (C)? To I want to quickly try an algorithm to see if it works (Python)?

Pete Kirkham
A: 

Choose a language that has been well documented.

abhi