views:

1143

answers:

16

How do you find interesting problems to solve?

I often want to learn new programming languages. However, I feel that to really understand it, I must write something which is:

  • Real—it should solve some real-world problem. That problem doesn't have to be new (in fact, having a reference solution might be a good idea), but it has to be something that forces me to work out some grubby, dirty details. I don't want to solve math puzzles or implement algorithms-and-data-structures, because that only teaches me how to solve math (or A&DS) problems in 'new-language.

  • Something I can get passionate about—it takes time learning the ins and outs of a new programming language. That means I have to put in that time. To help me stay motivated, I want to solve problems that appeal to me on some level. I think this part is the most difficult, at least for me, judging by all my half-finished projects; it's also the most important part. No matter how real-world a problem is, if you don't work on it you don't learn from it.

  • Finishable—connected to the passionate aspect, I want something I'm confident I can bring to a shippable state when only working in my spare time. Even though "C compiler" is very real world and I really like compilers, it's a somewhat big mouthful. Even a simple expression evaluator is something you can redesign, debug and optimize many times when you're not familiar with the idioms of a particular language.

So, how do you (or would you) solve the problem of finding something interesting to work?

Particular solutions—that is, problems to work on—will be greatly appreciated, but (pardon the arrogance) they're just "dumb knowledge". What I'll be most impressed by are new ways of thinking about and attacking the problem (i.e. algorithms >> data :D).

EDIT: the winners so far are "make a game" and "fix something that annoys you about (programming|using comptuers)".

The game suggestion has going for it that there are plenty of reasonably simple games I can reimplement (giving me a large selection of problems to attack), they're definitely real world, and I'm a gamer so I'm passionate about good games.

The "fix something annoying" has the passion and real-world-iness built in, but it requires that I'm not spoiled by having things just work and that the fix isn't modifying some program not written in the language I want to learn.

(You both earned an upvote. An accept may be on its way)

A: 

http://icpcres.ecs.baylor.edu/onlinejudge/ here lots of them for you to do.

You can try to solve them and then upload your file and they will run a huge amount of inputs on it, the fastest to run will go to their ranks for that problem.

But be careful not to get timeout which is kind of easy if you're not submitting good code

Edit: You can check here for an average of submissions vs accepted of one of their packs of problems

fmsf
The edit threw me to the bottom :p but you really should check these problems
fmsf
Nah, they're not the kind of problems I'm looking for. They fail the real-world test. But thanks for playing ;)
Jonas Kölker
+2  A: 

Every time I see something being done over and over again I see an opportunity to create some piece of reusable code. It was that with my DAL, and many other pieces of projects I worked on.

Otávio Décio
Dayam - that was my answer...so +1 it is!
Mark Brittingham
A: 

I usually find that there is already a problem that I have been encountering that could be more easily done in a different language. Example: working with PDFs in multiple languages.

jle
+5  A: 

Jeff Atwood blogged about coding practice "code kata" awhile back.

http://www.codinghorror.com/blog/archives/001138.html

Also see (reference in Jeff's blog):

http://www.codekata.com/

MikeW
+3  A: 

I collected this "standard" problem that I've used several times to learn a new language.

http://homepage.mac.com/s_lott/books/oodesign.html

It's real. It has some tangible value. It's finishable.

S.Lott
The problem may be interesting, but I get this unescapable feeling that the design proposed in the book contains a lot of YAGNI generalizations and lots of classes that simply clunk up the design.
Jonas Kölker
Some of the generalizations are there to help learn features of the language. Some are there to teach OO design principles. So, you can argue that they're "too generalized". One person's "extensible" is always another person's YAGNI. Extensible is always debatable until you actually need it.
S.Lott
A: 

Hmm. If that's your goal, then you might try it in two stages...for the algorithms side of things, I'd highly suggest looking at some of the programming challenges out there, and do it in conjunction with reading Skeina's book Programming Challenges. It provides a great deal of theory about how to approach problems from an algorithms and data structure point of view, and then points you to a bunch of sample questions where you can try to put these ideas into action on your own. It will very definitely put you through the mental wringer, in a very good way. Very similar to Project Euler, but for hard-core algorithms and data-structures people, rather than math people.

For just the "learning the language enough to feel like you can really use it", well, there are a lot of ideas for that...for me, just to use an example, I like to build a database driven website. Forces me to do a lot of things that you're going to have to do to get into a language in some breadth/depth.

If you need a specific example of a site, and really want to be pushed to do something real, you could contact a few charities that you are fond of, and see who needs a website or other application done for them for free. You're forced to learn, and have a reason to do so in a reasonable timeframe, and they get a useful app for free. Win-win.

Beska
"you could contact a few charities that you are fond of [...]" - I'd be motivated more of a sense of obligation (avoiding the punishment of having people be disappointed) than intrinsic interest (being rewarded by accomplishing what I wanted to for some personal reason).
Jonas Kölker
Exactly! It would work as a excellent motivator, if the person was feeling like they needed a good reason to slog through some difficulties. Of course, once they'd finished, they'd reap the rewards of both having done a good deed, and learned what they wanted to learn.
Beska
+3  A: 

Find some 'problem' in your own life that you can solve with programming. While it's easier said than done, I'll give you an example. I received one of those calendars with a word jumble on it for every day of the year (real). I like word puzzles and such (passion) and at the time I had been wanting a project to dive into python with. So I created a simple commandline script to solve the jumbles with a sqlite backend, and I've been doing quite a bit with python ever since. The project is as finished as I want it to be, I still add on things to it and continue to improve and add to it, but it served its purpose as a starter project for me. So I really think the trick is to find something that you can work at that is easily and directly connected to your everyday life.

robmerica
+9  A: 

To generate ideas, I find it's always helpful to ask "what bugs me about programming" and "what bugs me about working on the computer."

Finishing things is another story. Finishing things is really hard. I think you will be happier if you accept that you will have a portfolio of projects, many of which remain unfinished. If you finish everything, you will have the opportunity to explore many fewer ideas and technologies.

Choose carefully which projects you wish to finish, and remember the words of Piet Hein:

Put up in a place
where it's easy to see
the cryptic admonishment

T. T. T.

When you feel how depressingly
slowly you climb,
it's well to remember that

Things Take Time.
Norman Ramsey
+1, patience is acquired and unfortunately not contagious.
Tim Post
+6  A: 

Make a game. You'll learn a ton about any language. It doesn't have to be fancy. Make a dungeon crawl or something.

rlbond
+1 :) My favorite game of all time is 'the bard's tale' .. its fun to implement something like it when learning a new language.
Tim Post
My standard exercise for learning a new language or platform is to implement a video poker simulator. It's complex enough to not be trivial, but it's doable in a weekend.
Kristopher Johnson
+1  A: 

Project Euler

renil
+1  A: 

I don't go looking for problems, in code or otherwise. Instead I keep my eyes open as much as possible so that I don't miss inspiration for simpler solutions to old problems :)

Sometimes I just watch people be people .. or a cockroach going about its daily activities.

Often times, if you do that, you'll encounter new problems to solve. Don't try to think of complex problems, doing so typically leads to complex solutions. Every thought you think trains your brain, you are as much what you eat as you are what you think.

Tim Post
+1  A: 

Another source of "inspiration" for bits of software to develop (or just have an explore of how the technology works) is those "Why does it not cope with that?" or "It should work with that!" moments. I've had a few of those moments with things like code generation from XSD's.

Another source are those "There must be a more elegant way to do that!" moments. Simple little things like the C# "if(x is typea) do_a else if(x is type_b) bo_b else ....". Start me thinking about better ways to do things.

Another source, which some have mentioned before, is the "Could I write a system to do that?" moment (or the rhetorical question). I know programmers who have tinkered with an ISAM system for year, tweaking here and there just because the like playing with it. No idea of even finishing the project, just playing with different ideas and implementations.

Aussie Craig
A: 

I maintain a list of projects/classes/functions to create "when I get the time and inclination". I maintain similar lists for other hobbies. Then there's always something to do if I'm feeling bored or want a challenge.

gw
A: 

Although not apparently real-world, I've had an idea for a good source of projects that are at least finishable, and probably something you should be motivated to do (then again, you should floss every day :p).

For reviewing and testing understanding, implement various algorithms you've learned as part of your CS education. Some projects:

  • implement a finite state automaton library, with language membership testing, product construction, and brzozowski minimization.
  • implement max flow, min cost flow and a linear program solver.
  • implement reductions between select NP-complete problems, polynomial time approximations and brute-force solvers.
  • write your own implementation of cryptographic algorithms (but don't use them :D)

IIRC, mona is a finite state automaton thingie used to verify the correctness of an electrical circuit; ISTR my lecturer talking about the applications of linear programming in economics, and gcc does register allocation (which is graph coloring, which is NP-complete). Crypto of course secures all credit card transactions on-line. So it's not completely unreal-world :)

Jonas Kölker
+1  A: 

Am i too late? here is a "sub-real" problem. Since you liked the game thing. Check this Java4K, you should make a game in 4096 bytes only. You will learn a lot about Java, lot of code optimizing and for sure, how to think simple.

And at the end of the day, you will have a new game :)

medopal
A: 

You could try coding a solution to a real problem a friend or family member has on a computer. This could be a particularly good way to practice coding if you're creating the solution for someone who's relativly inexperienced with computers - those kind of people will ask you questions that another coder never would. These real-world questions about your solution might be things like, "Why does this come up in a black window with all this writing?" - in reference to a script running from a DOS command prompt. When you get hit with questions like that, you need to have a firm grasp on your own understanding of the language, and must be able to respond in layman's terms in order to be able to answer them.

I'm in the process of learning perl at the moment and I'm using it to design an property management system for a family member who runs an apartment complex.

By building something for someone who's close to you and expecting you to finish it, you might find yourself more motivated to write the entire solution instead of stopping halfway.

Micah