5 ms·
Why is that always the first point of comparison? Why does it matter how much shorter hello, world is in Lisp (or Python, Ruby, etc) vs Java?
by cstejerean 19y ago
Why is that always the first point of comparison? Why does it matter how much shorter hello, world is in Lisp (or Python, Ruby, etc) vs Java?
- Zak 19y agoHello world shows how much boilerplate is required before you can print a message to stdout. It's one of several important factors for any language you might use for quick and dirty throwaway programs. You want it to be two tokens only - the name of the print function and the string to be printed.
- cstejerean 19y agoah, quick and dirty throw away programs. Personally I think writing output to the console should be harder (but I'll save that for later). I'd like to see more sane comparisons, like: making a TCP connection, making a web request, encrypting and decrypting a string, computing base64, md5, etc. And in Python, print "hello, world" is bad form. It would be proper to write (news.YC is omitting some newlines below) def main(): print "hello, world" if __name__ == "__main__": main()
- vikram 19y agowell we don't have to do that. Though this isn't the same test as what you propose. This guy has compared many different web frameworks. http://video.google.com/videoplay?docid=6297126166376226181 http://video.google.com/videoplay?docid=6297126166376226181 I think the reason the LOC count is significant is because it means that there is less code for one to look through to figure out what is going on. Fewer lines imply that the solution has high level abstractions. Each one of the examples you mentioned is one construct in lisp (if you use libraries).
- boucher 19y agoI think thats a bit of a fallacy (and I also think this guys video is a bit of a waste of time...). More abstractions can be nice, but don't mistake it for less code. Its still code somewhere, and that can lead to much more subtle and hard to find problems if you don't understand exactly what's going on. Of course, some environments are bigger culprits than others, but its something to keep in mind.
- cstejerean 19y agowell, a big difference in total LOC might be significant, but that's slightly different claim than saying that a difference in LOC for "hello, world" has any importance. The reason you can get by with a shorter hello world program in most dynamic languages is because you're doing it in the "module" definition, which I think is not proper form in any non trivial programs. So any differences in LOC for hello world really mean nothing over the course of a real application.