What Can You Build in 600 Lines of Code?

This 256 byte intro (yes BYTES) is impressive: http://pouet.net/prod.php?which=3397

A 4KB intro with graphics and music, for example, http://pouet.net/prod.php?which=16373 , is also impressive.

A todo list with a HUGE framework in 600 lines of code? Not so much. I would call it “cute”.

If you think 600 lines of code is small, then you clearly are not a perl programmer.

Of course, if we start counting characters (or punctuation) I might be in trouble.

I just did Conways game of life in just over 200 lines of code: http://www.gumuz.nl/blog/lifegame-2d/

Python with Pyglet, OpenGL (consider those my rails :wink:

Ruby on rails is fine for small simple sites; but when you start adding logic then you have to start coding.

It also makes assumptions about the database that are against convention, ie: naming tables in plural form.

If you want to talk about impressive, how about a raytracer written completely in ONE line of Linq?

http://tirania.org/blog/archive/2007/Nov-16.html

Yep.The Rials looks like a magic in productivity:)But an interesting news: Have you ever tried “web2py” ? In my opinion it’s the best pythonic Rials! It’s productivity… unimaginable :slight_smile:

Ruby on Rails uses a lot of code generation. Comparing it with other programs written in other languages brings up a lot of questions. Both the verbosity of the language has to be taken into consideration as well as the underlying libraries.

Take for example Java. It’s got a lot of libraries that one can use. Making a desktop application would just mean that one has to use the SWING library.

Compare that to Common Lisp. Common Lisp can do the same thing that Java does, and probably even more, but are the libraries that one can use, or does one have to write everything?

One can even write a desktop application Brainf*ck, but the understanding the source code would probably require omniscience.

in BrainFck

Sorry for my bad English.

I assume we’re not talking about ‘tricks’ where you’re just running external code, plugging together existing components, or having 8000 char+ lines.

So, given that:
Full applications? No.
Incredibly useful utilities? Absolutely.
Gadgets / Widgets / Plugins? Sure

Depends on what your definition of an application is I suppose.

Total lines of code is, and has always been, a poor measure of effort required. Sure, they might have legitimately only needed to bang out 579 lines - but if it took them longer to get to that point, it all becomes redundant.

That said, I’m all for expending less effort for more productivity, and if they’re getting great results through rails - good on 'em!

You can do some really cool user interface stuff in C#.NET with WPF and Expression Blend (XAML user interface descriptions). Do all the data binding of .NET objects to XAML elements. Using other .NET 3.5 frameworks like WCF, you could probably create a networked photo sharing application in less than 100 lines of C# code.

There’s a lot to be said for well-designed, productive frameworks and environments that don’t make you reinvent the wheel every time you need a GUI app or a web app or a data structure or whatever.

Do not count lines of code.

This is not a programming language issue, but its about the available libraries that support it.
It is obvious, you know it, but you do not mention it. Why?

“you can’t write an app in one absurdly long one line of Code when using Python”

Of course you can:

exec "absurdly long one\nline with embedded\nnewlines"

i could solve fizzbuzz.

I’m not that impressed really…

You could do single, double and circular single and circular double linked list implementations in under 100 lines of standard c99 so you’d have at least 500 lines of space left to use them. That’s a whole lot of possibilities, I bet it includes tetris! and many more puzzle games.

Now imagine what you could do with 600 lines of c# or objective-c, the sky is the limit!

The little detail that it’s a web app makes it sound a bit more impressive, but then, that’s exactly what Ruby was designed for.

So no… not really impressed.

XForms is quite good for writing short web applications. If I remove the empty lines, inline instances, comments and some static XHTML, I’m down to 487 lines for a data entry system currently in production. This features adding, editing, and removing data in three forms separated into tabs, validation against other XML files (with helps, hints, and alerts), file upload / deletion, navigation between data items and a collapsible log displaying all the entered items with the current one highlighted.

I felt the need to help you, because you are so right and because many of the people who commented didn’t get it. See the full post here: http://my.opera.com/alex_boly/blog/2008/01/25/writing-less-code-is-good-for-your

Briefly the idea is:

The more lines of code your software has, the greater the number of bugs.
The more lines of code your software has, the longer it takes to solve one bug.
So writing less code helps you write good software.

Who said this code wasn’t complex though? It could be 579 lines of code that are all 1000 characters long!

Honestly… who cares how many lines of code an application is? As long as it fufills it’s requirements and it’s easy to maintain, that’s all that matters. Not some c0ck-measuring contest to see how small you can get the source files!

Well, not sure if it counts, but if I’d persevered it COULD have become a commercial application:

I wrote my own (VERY clunky!) word processor in Z80 assembly language for the TRS-80 in about 1980, I guess. It must have been in less than 16K bytes, probably quite a bit less, because that’s all the memory my computer had. But it worked pretty well - I wrote most of a novel on it.

I remember the TRS-80 had a chess program that fitted into less than 4K of memory. Played pretty bad chess, but it did work.

The creators of the darkbasic language (thegamecreators.com) regularly hold a competition where the entries have to form a working 3d computer game within 20 lines of code. Due to the level of functionality you can achieve with such a high level command set, this is not only feasable, but results in some great games.
However, due to each command being of such a high level of functionality, each takes a long time to execute. I think many programmers don’t think about the execution complexity due to being so focused on the uncompiled code and how that looks.
It is a great practice to avoid using 20 lines instead of the 5 you actually need. I recently rewrote a class method at work and removed 50% of its code. This lobotomised code not only fixed the problem, but ran faster (no surprise there). That said, if the system had been properly designed at the beginning, that class would never have been needed.
Measure twice, cut once.

“Honestly… who cares how many lines of code an application is? As long as it fufills it’s requirements and it’s easy to maintain, that’s all that matters. Not some c0ck-measuring contest to see how small you can get the source files!”

Exactly!

All the “Oh boy, someone wrote a 600 liner which represents does cool. I should drop what I’m doing and do what that guy’s using!” moaning… some people should simply take a step back and think about what they’re doing. Hint: programming isn’t about typing text in an editor.

People are too focussed on operating tools (e.g. a language, editor, ide). The tool isn’t important, it’s what you do with them and more importantly WHY you’re using these tools.

The more of these same-themed blogposts are posted on this blog, the less motivated I am to read them.

I’ve just published an internal Excel app with 832 lines of VBA code.

I think that’s not bad, even though it could probably be done in less.