Short Coding Projects? 122
sapped asks: "Whenever somebody advocates a new programming language for you to try, they will usually suggest writing something in it that will take you an hour or two to code, so that you can get a feel for it. My problem is that I tend to go from extremely trivial ideas straight to stuff which will keep me busy, for at least a few days. I don't seem to have a handy in-between size project that I can test stuff in. The closest I came to this was writing a little ad-blocking proxy for my browser, a few years back. Any ideas on neat small non-trivial projects?"
Pfff lots of things (Score:5, Funny)
voice recognition software, compilers, parser generators , browsers , OS kernels etc etc.
Come on, be creative...
what about a Trivial Pursuit ? (Score:2)
sorry
Re:Pfff lots of things (Score:4, Interesting)
Re:Pfff lots of things (Score:3, Insightful)
Re:Pfff lots of things (Score:3, Interesting)
Re:Pfff lots of things (Score:2)
Now, if an IE-based shell (Avant, MyIE2 (I know that's not its name now, it's something else, I forge
Re:Pfff lots of things (Score:3, Interesting)
However, I think I DID find a way to get Gecko working in IE. Make it a Gecko plugin that associates itself with everything that IE does itself, without handing off to a plugin. I don't know if that will actually WORK, but it's worth a shot.
Re:Pfff lots of things (Score:1)
Note that it'll break things like Windows Update.
Re:Pfff lots of things (Score:2)
Or no code at all [macdevcenter.com] if you're a Cocoa programmer.
Re:Pfff lots of things (Score:2)
Not quite. To implement a parser generator as quickly as possible, the backtracking features of Prolog are going to be crucial.
In Erlang, it's going to take a little bit longer to write. On the other hand, unlike the Prolog version, it will probably work.
Re:Pfff lots of things (Score:1)
Compilers and parsers have actually been written in 2 hours...
a little easy but... (Score:4, Interesting)
Re:a little easy but... (Score:2, Interesting)
Re:a little easy but... (Score:5, Informative)
Re:a little easy but... (Score:1)
i thought _goto_ "is considered harmful"
Re:a little easy but... (Score:3, Interesting)
Funny you should mention that. The first code I ever wrote in C was PiHex [cecm.sfu.ca] (a distributed project computing project, back in the days before those became cool, which computed the 5 trillionth, 40 trillionth, and quadrillionth bits of Pi. All of them were zero.)
Re:a little easy but... (Score:3, Informative)
It might be helpful if you were to mention which particular language you were currently trying to master, however.
Re:a little easy but... (Score:2, Interesting)
Re:a little easy but... (Score:2)
Therefore, a great way to learn a language that would also help others would be to take the k language idiom list and build a similar one implementing the problems in whatever language you are trying to learn. Maybe even post the resulting idiom lists for various languages on sourcefor
Re:a little easy but... (Score:2)
Re:a little easy but INSTRUCTIVE (Score:2)
school/college programs (Score:5, Insightful)
Re:school/college programs (Score:2)
I remember my VB class and the lessons were mostly "type exactly what is shown in the book and press run" but the tests were writing programs that had enough functionality to write and test and be sure that everything worked right but were designed to be done in a shorter period of time.
Consequently, they were not useful at all...what good is a homemade text editor that consists of a toolbar for save/open/new/font and the standard VB text box.
open ended (Score:2, Informative)
When I taught myself python, I first wrote a program that determined the word-wrap properties of a text file. It detected wrapping behavior across lines, and then constructed a range of possible wrap settings. I then added tabwidth detection. After this, I began to think about interpreting t
Rock Paper Scissors (Score:4, Insightful)
Or, if you're terrible at programming or the programming language or compiler sucks, "Hello World!" might take a few hours.
Alex.
Re:Rock Paper Scissors (Score:3, Insightful)
RPN Calculator (Score:5, Insightful)
What I do... (Score:5, Interesting)
User then guesses, and computer replies if the guess is higher or lower until number is guessed. Teaches use of loops, random number generation, text input & output etc. Can also go on to store lowest number of guesses in "high score" table etc, or use TCP to make it playable over telnet, if you so wish.
Re:What I do... (Score:2)
Keeping just one high score, my nephew and niece played it for at least 2 hours.
I couldn't believe it.
My issue (Score:2, Funny)
Tic Tac Toe... (Score:1)
Nim would work nicely also.
Once the basic two human player version is done you can have them add a simple ruleset to let the computer play the game.
Re:Tic Tac Toe... (Score:1)
Re:Tic Tac Toe... (Score:2)
Re:Tic Tac Toe... (Score:2, Funny)
I did a self learning tic-tac-toe game once, using Martin Gardner's matchbox learning algorithm.
It learned so well that it started to cheat.
An implementation of CipherSaber (Score:2)
Couple I've done (Score:5, Interesting)
You get:
a) simple string parsing/processing/manipulation
b) File I/O and filesystem manipulation
c) Network I/O
Optionally or language dependent:
d) Threading
e) Packaging
If a dynamic language (e.g. lisp):
f) Write something like JSP on top of it: dynamic dispatch to handling method/function
Optimizations are easy as well. Caching will give you a good overview of data structure speed.
Re:Couple I've done (Score:2)
Re:Couple I've done (Score:2, Funny)
how about... (Score:5, Funny)
Re:how about... (Score:1)
A couple of days (Score:2)
Lots of stuff (Score:1)
Re:Lots of stuff (Score:1)
Benefit the world: A program to show data splits. (Score:5, Interesting)
Here's a simple program that would benefit the whole world:
Make a program that shows what parts of a huge folder fit on individual CDs or DVDs. The output of the program would say, for example, that all the files from sub-folders A to Information would fit on the first CD, and all the files from sub-folders Installers to Netgear would fit on the second CD, and so on.
It is necessary to store backup sub-folders in alphabetical order on the backup CDs or DVDs because then they can be found easily.
Right now there is no good way to decide how to apportion the data. Breaking any file into two pieces just causes problems later, so the Easy CD Creator method does not work well.
Later, it would be excellent if the program made
--
100 Facts and 1 Opinion -- The Non-Arguable Case Against the Bush Administration [thenation.com]
Re: BTTB (Score:2, Interesting)
Not Burn to the Brim: No alphabetical (Score:2)
Burn to the Brim does not work the way I described. When I last checked it, there was no way to put the files in alphabetical order. That makes them difficult to find. There were other problems, too. I wrote to the author, but he did not want to make changes.
Re:Benefit the world: A program to show data split (Score:1)
It is necessary to store backup sub-folders in alphabetical order on the backup CDs or DVDs because then they can be found easily.
As described, there's a major problem with your algorithm for decidin
Some data sets have no huge files. (Score:2)
we're paying 14 cents for CDs now. We don't care if some space is wasted. Also, for many data sets, there are no huge files. We have about 5.8 gigabytes of miscellaneous software that we and our customers may need. We don't put anything over 50 Megabytes on the hard drive.
Burn to the Brim doesn't work well when you need one single file from 110,000 small files. It could be on any one of the backup media. There is nothing wrong with my proposed algorithm for that kind of data set.
Short coding project? (Score:3, Funny)
Re:Short coding project? (Score:1)
NP encyclopedia entry [wikipedia.org].
Re:Short coding project? (Score:3, Informative)
Re:Short coding project? (Score:1, Informative)
NONDETERMINISTIC TURING MACHINE. Creating one of
those would be a nice project.
Re:Short coding project? (Score:3, Informative)
NP: problems whose solutions can be VERIFIED to be correct in polynomial time (as opposed to exponential time or some even faster-growing function of time). NP includes all trivial problems which can be solved in constant or linear time, since constants and linear functions are low-order polynomials. No non-deterministic turing machine is required to solve those.
P: problems whose so
Re:Short coding project? (Score:1)
Re:Short coding project? (Score:2, Funny)
1. If the question is for something that is easy, suggest something that is hard.
2. ???
3. Laugh!
Yeah, real funny. Sheesh.
IRC bot (Score:5, Insightful)
The good thing is that you can use this irc bot to test just about every aspect of the language later on. Its not a project which is just done and discarded. Possible enhancements are user recognition or even something fancy like cvs commit reporting.
For example when i decided to play with sqlite took the ruby version of the bot and added a funny quotes database.
Re:IRC bot (Score:2)
Gravity (Score:3, Interesting)
Re:Gravity (Score:1)
Mastermind (Score:1)
Gets some simple algorithms, simple data structures to store things in, and a UI of your choosing (can be text only, or graphical)
Programming challenges (Score:5, Interesting)
-ReK
Re:Programming challenges (Score:2, Informative)
Scratch That Itch (Score:2)
The nice thing about something like this is that you can extend the project as you learn more aspects of the language. For example, your first try might open an input file and dump the results, with the next version adding code for
Re:Scratch That Itch (Score:2)
It's faster to type. Or do you not have BSDGames?
Re:Scratch That Itch (Score:2)
Plus, I wanted to learn some Java.
Re:Scratch That Itch (Score:2)
Depends on your programming language (Score:4, Informative)
Now try doing that without looking up things in a book -- obviously I cheated here and just used the GCC. You see what I mean, though: Writing a mail program in assembler is somewhat more tricky than Python.
Pr0n to the rescue! (Score:4, Funny)
If you use my idea, you should send me some redhead pix. Thank you.
Re:Pr0n to the rescue! (Score:1)
Re:Pr0n to the rescue! (Score:1)
Here's and old entry in my reading list: We'll Return, After This Message [fourmilab.ch]
Re:Pr0n to the rescue! (Score:2)
Open Source as a source for projects (Score:2)
These are pretty easy (Score:4, Interesting)
Here's an asteroids [mytsoftware.com] clone I wrote in javascript. It renders everything with divs.
How about a knowledge base? (Score:1)
They're pretty strait forward - a couple of tables and a couple of pages. But they have enough to cover the bases.
Two things (Score:3, Interesting)
If the language has compelling semantic separation (usually object orientation), I'll write some form of random song guitar tab generator. That's a personal project of interest to me.
Then I go back to Python.
Write an HTTP / SMTP server (Score:1)
A couple of ideas (Score:1)
1) Today
An old program (may had different names on different OSes) that, given the system date, will spew forth a list of things that happened in the past on the same date.
Tricky part: you can augment its files adding programmable stuff like "on the third sunday of august, show this message" or "if the 4th of October is a Saturda
I pretty much ... (Score:2, Interesting)
Calculator - 4 functions to start, then trig funcs (Score:4, Interesting)
For the first hour (or whatever) it takes I have them write a four function calculator (FFC). Once they get that done, I have them extend it to add trig functions like sin / cos in the last 30 mins. If they can't do that, they are not going to be happy with harder assignments.
I also use this as a mini-test of a new language. Try my new language COAL, better than Cobol, faster than VB, a true OO language with VM's that run on any Timex watch!! A short stint creating a FFC lets me know how well it works out.
The FFC is also good since you can use it for GUI checkout to see if that new tool rocks as much as Freshmeat would like you to think.
Go big (Score:3, Insightful)
Why? Well most 1 day projects aren't very challenging or interesting. But most major projects will have subsystems that you can do in one day, and the project in its entirety can hold your attention long enough that you may eventually complete it, by which time you're an expert in the language.
This is pretty much the approach I had to take to learn C++ and OOP. I started a job knowing only C and the basic ideas of objects, and took on small bits of the C++ project until I could handle larger chunks.
Hello World? (Score:2, Insightful)
But seriously, a good project for learning a language depends on the language itself and the problems you yourself face. You're not gonna write a simple 3d engine in python and you're not gonna write a log parser in C (actually you could, but that wouldn't be the easiest/quickest solution).
Just pick something trivial that bugs you at any given moment that's the right job for the language.
C/C++ (Score:1)
Re:C/C++ (Score:2)
Format converters (Score:4, Interesting)
Look at your favorite text, sound, or graphic format that you've had trouble converting to or from some other format. Write the converter.
This can range from 1 hour to a week's work, but it's always instructive and usually fun.
Graph algorithms (Score:3, Informative)
Graph algorithms are good for testing out a language's data structures. Dijkstra's single-source shortest path function is a good one to start with.
I've got a good one... (Score:4, Interesting)
You've got three posts, and up to 64 disks, with the largest disk slid down to the bottom of the first post and the smallest disk at the top, and the diameters of the disks tapering.
You have to move all the disks from the first post to the third post in such a way that no disk is ever placed on a smaller disk, and only one disk is moved at a time, one post at a time. It's harder than it looks.
Your goal: model the three posts and the 64 disks. Write a program that moves the disks from the first post to the third via the middle one, without ever violating the rules. Record the sequence, and let it run, finding the shortest sequence that works.
It's kind of a fun one.
Re:I've got a good one... (Score:1)
How about the Sieve of Eratosthenes, matrix decomposition, or a recursive descent parser? None of these should take more than 20 or 30 minutes.
Make a chess game... (Score:4, Interesting)
--Robert
Code for others! (Score:5, Insightful)
Don't be intimidated by the size of projects. Pick a project, browse through the source code, try to get the feel of things. You can usually find a bug report small enough for you to work on. If not, think of a feature you'd like to have and try to implement it. =)
Great way to get into a language.
Useful first exercise - cubic equation solver (Score:2, Interesting)
On a related note the
Reasonably short; definitely nontrivial (Score:2)
Tetris (Score:5, Informative)
I usually write a tetris clone.
Basic operation is 400-1000 lines typically
Python is the current language (Score:2)
Address Book (Score:1)
21 short exercises by Dave (Pragmatic) Thomas (Score:3, Informative)
For the lazy or doubtful, here's the list of descriptions:
KataOne: Supermarket pricing. Pricing looks easy, but scratch the surface and there are some interesting issues to consider.
KataTwo: Karate Chop. A binary chop algorithm is fairly boring. Until you have to implement it using five totally different techniques.
KataThree: How Big, How Fast? Quick estimation is invaluable when it comes to making design and implementation decisions. Here are some questions to make you turn over the envelope.
KataFour: Data Munging. Implement two simple data extraction routines, and see how much they have in common.
KataFive: Bloom Filters. Implement a simple hash-based lookup mechanism and explore its characteristics.
KataSix: Anagrams. Find all the anagram combinations in a dictionary.
KataSeven: Reviewing. What does our code look like through critical eyes, and how can we make our eyes more critical?
KataEight: Objectives. What effects do our objectives have on the way we write code?
KataNine: Checkout. Back to the supermarket. This week, well implement the code for a checkout system that handles pricing schemes such as "apples cost 50 cents, three apples cost $1.30."
KataTen: Hash vs. Class. Is it always correct to use (for example) classes and objects to structure complex business objects, or couple simpler structures (hash as Hashes) do the job?
KataEleven: Sorting it Out. Just because we need to sort something doesnt necessarily mean we need to use a conventional sorting algorithm.
KataTwelve: Best Sellers. Consider the implementation of a top-ten best sellers list for a high volume web store.
KataThirteen: Counting Lines. Counting lines of code in Java source is not quite as simple as it seems.
KataFourteen: Trigrams. Generating text using trigram analysis lets us experiment with different heuristics.
KataFifteen: Playing with bits. A diversion to discover the pattern in some bit sequences.
KataSixteen: Business Rules. How can you tame a wild (and changing) set of business rules?
KataSeventeen: More Business Rules. The rules that specify the overall processing of an order can be complex too, particularly as they often involve waiting around for things to happen.
KataEighteen: Dependencies. Lets write some code that calculates how dependencies propagate between things such as classes in a program.
KataNineteen: Word chains. Write a program that solves word chain puzzles (cat -> cot -> dot -> dog).
KataTwenty: Klondike. Experiment with various heuristics for playing the game Klondike.
KataTwentyOne: Simple Lists. Play with different implementations of a simple list.
mahlen
A single-file database server and client (Score:2, Interesting)
Might as well earn some money (Score:2)
make a program that can... (Score:1)
puzzles (Score:1)
__________
__|__|__|__|
__|__|__|__|
__ | __|__|__|
__|__|__|__|
I'd just started learning Java at the time and thought it would be fun to try and solve the puzzle using Java.
It was great for learning purposes. It required fairly complex logic (a brute force alg would take weeks), used a couple of classes, and also made