4 ms·
> My keyboard driver isn't unix-ey, because I can use it to input a 'k'. Or a 'K'. Or a lot of other characters. You're missing the article's forest for its tr
by fenomas 10y ago
> My keyboard driver isn't unix-ey, because I can use it to input a 'k'. Or a 'K'. Or a lot of other characters.
You're missing the article's forest for its trees. The author is claiming that "filter or sort the items in a list" and "get a list of files in a folder" are two different "things". That's not a frivolous, hair-splitting thing to say - the difference between generating a list and re-ordering it should be apparent to anyone who writes code.
After all, when you write a function that returns an array, do you typically have it take in a boolean argument for whether or not to reverse the array's contents?
- flukus 10y ago> After all, when you write a function that returns an array, do you typically have it take in a boolean argument for whether or not to reverse the array's contents? And the granularity of unix is much more course than a single function. Have you never written a program or application that returns the array and sorts it?
- Someone 10y agoYes, but I preferably compose it of two functions: one that gets the data and one that sorts it. Only rarely that isn't the right thing to do. For example: if the data comes from SQL, I tend to do the sorting in SQL, it I see that as a problem with SQL: it composes badly.
- flukus 10y agoIs there anything stopping you from doing that with current unix tools? You can do that, I'll continue using the more pragmatic option.
- Someone 10y agoThere isn't, but if you see the base system as the library to build your tools on, a library function to get all files in a directory and, optionally, sort them by name, doesn't seem like a good design.
- Too 10y agoBig data sets in general composes badly, you have to do the filter+sort+pagination as close to the data as possible. It has to be embedded in the query protocol, you don't want to transfer one billion entries over the network, just to later filter out 5 of them and then sort.
- Someone 10y agoThat depends on the expressive power of your protocol. For example, a JVM program running on a client could send a _program_ to a JVM program running on a server to run it there, with the server using the security features of the JVM to enforce that that program is well-behaved by limiting what interfaces it can call, how long it can run, etc. With that in place, a service could provide a call that produces the data and takes client-provided Java code fragments that filter and sort the result, and use hotspot to do optimizations across the stack. (SQL, in both theory, can accept query fragments to insert into queries, too, and that can be done in practice, too, by concatenation of query fragments, but it always feels like a hack, and typically doesn't enforce security)
- rakoo 10y agoYeah, but you write those 2 functions once, and use the result combination all the time without separating them. You don't want to write both of them all the time, which is what happens on the shell (unless you create an alias, or a program... which is exactly what 'ls' is)
- vacri 10y agoI don't think I missed its trees - I called out the article as missing the 'doing it well', and the bit you quoted me on was the bit of satire on overzealous puritanism. We'll have to agree to disagree here. I think of a 'tool' as more than just a named simple function - the author's definition of 'do one thing' is ridiculously narrow (hence the satire).