4 ms·
Does it annoy anyone else when someone says something like "I wrote X in 50 lines of C" And then the first non-comment line is: #include <X11/Xlib.h> Which
by ktm5j 8y ago
Does it annoy anyone else when someone says something like "I wrote X in 50 lines of C"
And then the first non-comment line is:
#include <X11/Xlib.h>
Which itself is over 4000 lines and includes tons more code.. It's a pretty meaningless metric.
- StreamBright 8y agoAnd all of this runs on a 1M+ loc kernel ;)
- azinman2 8y agoExactly. Nothing is built in a vacuum. It’s also running on top of cpu firmware, etc
- nickpsecurity 8y agoThere are some counterexamples that worked, though. In Verisoft, they did a whole stack from verified CPU to microkernel to simple OS and compiler. Everything was necessarily simple. http://www.verisoft.de/PublicationPage.html http://www.verisoft.de/PublicationPage.html The high-assurance community also did a low-complexity GUI: https://www.acsac.org/2005/papers/54.pdf https://www.acsac.org/2005/papers/54.pdf
- proyb 8y agoFrom what I understand, it's precisely a "wm" for Window manager and you'll see a list of other wm. https://en.wikipedia.org/wiki/Comparison_of_X_window_managers https://en.wikipedia.org/wiki/Comparison_of_X_window_manager... Just as web developers could write x lines of code that run on any web browsers and engines.
- segmondy 8y agoYeah, it annoys me when it's actually 50 lines of C code and it's more than 50 opcodes /s
- deleted 8y ago[deleted]
- wtallis 8y agoWriting X in 50 lines is almost always a statement more about the ecosystem X exists in than about the cleverness of the author of X. This headline tells us that the building a window manager can be done almost entirely with code that's already part of the window system, and requiring very little new code to achieve basic functionality.
- drb91 8y agoIt also tells us the term "window manager" is equivalent to a few X11 calls.
- sillysaurus3 8y agoIt’s not meaningless though. Every language and platform has a stdlib. It’s interesting what can be done with them.
- AboutTheWhisles 8y agoI think it depends on what the dependency actually is. Here it is expected that you would include this header. When someone does a python one liner that just calls a library or something that relies on boost, the point is lost for anyone hoping to have a minimal example.
- tree_of_item 8y agoIt's meaningful. X11 is a part of the structure of reality now, it's not going anywhere. Why can't you assume it?
- justin66 8y ago> Which itself is over 4000 lines and includes tons more code.. It's a pretty meaningless metric. Hardly. Including standard libraries in the line count wouldn't mean much, unless you're the compiler. Doing it this way lets you know how many lines are likely to have problems. Not to mention how much code the guy wrote.
- deleted 8y ago[deleted]
- ktm5j 8y agoThis isn't just some standard library though, and what do you mean by "wouldn't mean much, unless you're the compiler"? ... The code in X11 libraries is infinitely closer to a window manager than what this guy wrote. This is barely anything at all added to work that other people did already.
- detaro 8y agoAnd? It doesn't claim otherwise, and nicely shows off what's built in and what a window manager does.
- city41 8y agoI disagree. I think most people distinguish between "end developer" code and libraries. I always find projects like this interesting and useful as they can be decent starting points to getting to know something.
- ChrisRR 8y ago#include "TheRestOfTheFuckingOwl.h"
- squarefoot 8y agoI'm a lot more annoyed by programs requiring entire desktop environments such as Gnome or, even worse, KDE to do things which would be perfectly doable without that dependency. Those 50 lines probably won't become most people's favorite WM, but could be among the best places to look how to start writing one.
- mikec3010 8y agoI learned this the hard way when I realized CUPS (printing services) is a dependency on almost any major desktop app. I thought "I don't own a printer, probably will never need one, let's remove this superfluous printer software" only to find it's so ingrained in applications it may as well be a part of the OS. In all fairness, it is convenient to be able to print to pdf sometimes
- imode 8y agoI feel that way when people write anything in a functional programming language. "Here's this lovely new functional language!... written in Haskell, using Haskell's entire runtime as a basis."
- userbinator 8y ago...as opposed to other window managers that are several orders of magnitude more code, also not including Xlib.h? This "classic troll comment" appears with reasonable frequency in the demoscene: "your 4 kilobyte binary depends on gigabytes of OS libraries" --- and is countered the same way: "as opposed to a multi-gigabyte application also depending on same."
- geofft 8y agoHeader files are generally declarations, not executable code, and for a program that's 50 lines long, it probably doesn't even have room to use all 4000 lines of declarations. It looks like it uses three structs and about three members of each of those structs, a half-dozen function calls, and a handful of constants, so you could write it without the include in under 100 lines. A more meaningful objection is that you link with -lX11, which is a significant amount of actual code. But apart from "what about libc and the kernel" counterarguments, the X protocol is actually pretty straightforward - I'd bet you could write this with just socket syscalls in about as many lines of code, too. (Which is to say, an embedded system without libX11 could implement a window manager for a remote machine given just ~100 lines of C or similar and a TCP stack, and the TCP stack is only required because it's remote, anyway.)
- dig1 8y agoWith your reasoning, the one should use only kernel interrupts and go even without glibc; because even simple printf() would require thousands of lines pulled from stdio.h X11 is part of the system, just like glibc...