19

I am a computer science student based in India. I am quite good at mathematics and I love solving programming puzzles on Project Euler and Sphere Online Judge. However I was just wondering - how do these puzzles relate to real world programming? Would I benefit in real world from solving these sort of problems? A friend of mine suggested that I should rather invest my time in learning database management systems and frameworks like Qt and new languages like Java, C# and Python. (As of now I know only C and a bit of C++; I don't really get why people learn multiple languages. According to me it is a plain waste of time.)

What do you people suggest? What should I do? I am very confused.

23

People learn different languages because they are good for different uses. I've used Java and PHP for web applications. I've used C# for Windows desktop apps. I've written PL/SQL systems for large-scale data manipulation in databases. I've written graphics applications in C and C++. I've written text parsers in Perl.

What it comes down to: Use the right tool for the job.

As for "what is real-world programming?"... It varies. A lot. I have never had a job which involved very complex algorithms and puzzles - at least not like the ones you describe. Sometimes the hardest part of the job is getting the client to cough up a set of comprehensible requirements. Once I have that, the programming may be as simple as a few web forms or a small change to a database table. On the other hand, I have friends who have gone into write GIS software and seem to use lots of graph theory to solve day-to-day problems. People I know who write games have completely different challenges than the database stuff I'm working with these days.

There's no real definitive answer to what is "real-world" programming...

19

If you want to have fun, just learn what you like.

If you want a job, learn what people need.

I suggest listening to your friend :-)

18 accepted

"I don't really get why people learn multiple languages. According to me it is a plain waste of time."

That's a poor attitude.

Different Languages have different biases. Some languages express some things well other languages express other things well. Doing OO programming in C doesn't work out well. Trying to due functional programming in C++ will be a struggle. We use SQL to access databases, no C or C++, because SQL has advantages in what it expresses well.

Languages come and go in popularity. There was a time when knowing COBOL was sufficient to get a good programming job. Those days seem to be behind us. There was a time when Java didn't exist. Now it's one of the most popular languages.

Sticking with one language is a really bad policy. Before long, you'll find that your skills aren't current enough to get the job you want.

13

Real world programming involves dealing with real world people. This means shifting requirements. It is one thing to go to project Euler and solve a problem which is concrete and has a right and wrong answer. It is quite another to meet requirements which are constantly changing.

Real world programming also means dealing with real world systems which are already in place. This often means not having the luxury of choosing your language, your operating system, and your framework. It often means dealing with legacy code which you are not permitted to rewrite.

BUT - by all means solve the project Euler problems. They will make you a better programmer and you will learn things. Just don't expect that when you get into the work place you will find problems like these.

11

I don't really get why people learn multiple languages

Another reason to learn multiple languages is the same reason you had to use English to post your question (I'm assuming your native language is not English):

Just as lots of information is not available in your native language, many times you'll find a solution to a problem expressed in another language. Being able to read other languages is very important.

7

"I don't really get why people learn multiple languages. According to me it is a plain waste of time."

The American linguist Benjamin Whorf once wrote

Language shapes the way we think, and determines what we can think about.

He wrote this in the context of human languages but programming languages also confirm his assertion. Learning another paradigm will provide you with a new perspective from which to approach problem solving.

You can mix the strengths of each (syntax permitting) and program into a language rather than thinking within the confines of it.

4

The real world of software engineering is much more expansive than a few algorithmic puzzles. You have back end systems, middle tiers, front ends, user requirements, customer management, user adoption issues and I haven't even mentioned the SDLC (software development lifecycle) process.

Many skills are called for in implementing a solution. And while Euler is a great way to warm up certain parts of your brain it alone will certainly not help in teaching you how to deliver a working application. Not even close. You need to be well rounded, that's where the idea of learning different systems and languages comes in. And your other schooling (e.g. literature, geography) should not be ignored either.

3

To somebody with only a hammer, I'm sure it looks like a waste of time acquiring other tools. Learning other languages (especially ones very different from what you already know) can give you a lot of new tools for your belt. Paul Graham directly credited his success to Lisp.

This is equally true for frameworks, although in a different way. Without a framework, writing certain kinds of apps (particularly graphical apps) is a ridiculous chore. A good framework, by providing such a good starting point, can improve your ability to create things many times over.

2

"What is ?Real world programming? ?"

It's a term, primarily used on the internet, to try to convince you you're a loser because you're not exactly the same as the person using this term. For example:

alice> I use Python, and I'm looking for a web framework

bob> Django is a pretty good one for Python

carol> Nobody uses that in the real world ... you should learn Ruby on Rails instead


As of now I know only C and a bit of C++; I don't really get why people learn multiple languages. According to me it is a plain waste of time.

But of course. Even learning a first programming language is a waste of time: I know plenty of people in the real world who are doing just fine not knowing any.

That said, if you're a CS student and only know C and C++, then you must be early in your education since you haven't gotten to SICP yet. When you do, you'll see that there are many very important concepts which are very easy to express in one language (like Scheme) that would be insanely difficult to do in other languages (like C).

As a taste of what's to come: C doesn't have an object system. C++ tries to provide one, but note that it requires a whole new compiler. (In the early days, it required only a preprocessor, haha, which kind of mostly worked for a little while.) In SICP they show how to build an object system in Scheme in a few lines of code. If you wanted to learn how object-oriented programming was implemented, you could read the G++ source code (how many tens or hundreds of thousands of lines?), or you could read a couple pages of Scheme code. If you wanted to modify how it worked ... well, I don't even want to think about having to maintain GCC. You always want to work at an appropriate level of abstraction for the problem at hand, or the company next door (like Google) will do your work in 1/100th the time and put you out of business.

2

Another reason why it's not a waste of time to learn multiple languages.

Web applications are on the rise. You cannot know only one language and be a web programmer. You have to know javascript, (x)html, and css (though I'm not sure if this is an actual language) for the front end. That's only if you don't get into flash. For the back end you need to know some language like PHP, Python, Ruby, Perl (maybe), C or one of the windows ones. You'll also need to know SQL. Then you'll need to know about the http stack and which server gives you what information.

Then what about connecting to other sources of information like Geonames' awesome GIS stuff. You'll need to understand XML or JSON. And that's just how the information is passed back and forth. That doesn't cover learning the APIs of Google or Twitter.

This is what you need to know, if you're going to be making more than a business card website.

2

"Real World" business programming is mostly about manipulating String objects and updating database fields and displaying that data to an end user to manipulate in some way. Project Euler doesn't even begin to address business programming concerns. You will probably be bored out of your skull if you get into business programming in the "Real World".

The reason people use different languages is that they are tools. A hammer and a screwdriver will only get you so far. The reason I know Python is I can code whatever you can code in C in 1/5 the lines of code, 1/10 the time and with 1/100th of the bugs. Erlang can cut this down even further for server based programs, I could probably write a complete distributed network server with hot code loading in the same amount of lines of code that it would take you just to set up a socket in C.

1

I would suggest you spend time on both. It is important that you get yourself up to speed with development tools, environments and skills you will need when you get a job, unless you can get a job solving puzzles! But solving puzzles and challenges is all a good and fun way of learning not just how to solve a problem, but different ways to solve problems and new techniques in your chosen programming language that you may not have otherwise learnt.

1

If you are talking about puzzles like in ACM programming contests then there are 2 common ways:

  1. 99.9% won't gain huge profit from their puzzles solving
  2. Few people (who wins medal at world final) will be employed to Google
1

Knowledge is fun ... 'real world' skills are bread ... if you know more than one language / skill your likelihood of finding a job goes up.

Like KLE I suggest listening to your friend ... but don't forgett to have fun!

1

Learning a new language helps you understand the shortcomings of your languages. This is huge. However, if you're just starting out your friend is right. Find a job first, learn what they need, and then expand your horizons.

1

If you want to earn a living developing business applications, you will need to broaden your horizons a little. Almost all business systems involve a database now, so some basic knowledge of database and their management is very helpful. Languages such as C# and Java are (have?) established themselves firmly in the business applications sector, and things like most modern websites are written in languages other than C or C++.

Learning multiple languages is useful for a number of reasons, not least being able to choose the right tool for the job. Most problems could be solved in C, but there are whole classes of them that should not be! (Would you really write a website in C?)

You ability to develop algorithms for problem solving is useful, but so is being able to envisage large scale application architectures, being able to work in them, working as part of team, understanding the business domain are all essential aspects of being a modern (business application) developer.

1

if you're going into academia then you have to be very good at math and being able to solve those problems is the only way to do it. being able to program in acadamia is pretty much besides the point. (at least in my experience). It helps to do assignments quickly one and a while but mostly you just end up solving things in psudocode. Math is what makes or breaks grad school.
On the other hand forget about math if you want to work into the work force. Learn the latest languages and technologies. You're not going to be given a jab that requires more math than you've studied anyway.

1

You need to know how to use debuggers, version control, bug-tracking, and how to actually deploy an application to someone else's computer reliably.

All these are 'real world' skills you won't learn by simply learning programming, but are essential to work effectively in a team.

1

Most programming jobs involve working on a large, existing codebase that other people have and will contribute to.

Real professional programmers may have their favorite languages or those they have the most experience in, but can pretty seamlessly move between them as jobs needs dictate. I'm not sure how many languages you need to learn, but you need to learn at least 3 or 4 before the language starts to matter less. Plus you want to learn declarative languages like SQL and XSL if you want to really contribute to real-world projects.

1

Usually those problems don't translate into "real programming" work, unless you are working in academia. Academia usually requires to come up with something inventive.

The real life programming is done with frameworks and usually don't require problem solving skills (there are exceptions). I think you need more architectural skills and getting-things-done skill. That means you should know how to do a program with easy modifiability and less effort.

Article and book about what matters in real life:

1

College assignments such as Project Euler, in my opinion, are meant for you to develop your logical thinking and the ability to solve problems. These assignments also help you learn how to use tools you're going to need in your programming career (for instance, Data Structures, Complexity Measuring Metrics, etc).

You are going to get in touch with real world programming when you start working. I'd suggest you joining an open source project, or becoming an intern.

I also think it's very limited of you to think learning new languages is a waste of time. As said above, each language has its focus and benefits for particular situations. A college teacher used to tell us "Don't try to fix a nail on the wall using a screwdriver" (literal translation).

0

The method used to solve the puzzle may be recycled into other problems as some ideas like "Divide and Conquer" or "Recursion" can be used in many places. I would suggest doing a few real world problems though to gain some perspective to the difference between a puzzle and a common problem.

I'd suggest thinking for a moment or two about what you really want to do. Do you want to make a living as a programmer? Do you want to be a researcher who builds programming languages? What do you want?

As for learning multiple languages, try doing database or web work within C or C++ and then learn other languages used for handling it and see what is gained.

0

"Real world" programming is that which makes you or your employer money. Arguably not counting open-source.

0

It depends what your trying to achieve. You should establish the requirements of the project / piece of code you want to write and then analyse which language best suits your requirements.

For example if you want to develop a stand alone Windows application you would probably use C# but if you want to develop a web based solution you would use Java / PHP.

Learning the first language is always the hardest. The rest follow the same basic blueprint. Some offer extra functionality or different ways of doing things so it's always worthwhile to be able to develop in a few different languages.

0

It's programming that impacts on life. The more life it impacts, the more it is real. No matter how bad or good it means.