Live data from Hacker News

Learn a Programming Language Faster by Copying Unix

rodrigoalvesvieira.com

11–20 of 110 posts

Re: Learn a Programming Language Faster by Copying Unix

#12
post #7

This is a brilliant idea, and may I suggest that one takes it slightly further than just implementing the core functionality, and aiming for a complete clone (optional parameters and all) with a few enhancements. Indeed, for a further ego boost, why not also benchmark the performance of your versions against the performance of the native utilities? You never know, your new clone might end up being the new 'less' to t…

Yes. I think I nice approach would be just cloning core functionality of the program initially in your language of choice, then dealing with parameters and more advanced options as you learn that language better.

Re: Learn a Programming Language Faster by Copying Unix

#13

Can someone give a non-expert way of going about this learning method? For instance, what are your options on Windows or Mac? And are the languages you can do this with limited to Ruby, Python, or Javascript?

Hi,

Windows doesn't have many of the basic Unix tools, but you can still implement them using your programming language of choice (how great). No, you're not limited to these three languages. I only meant in the article that these three are probably the easier to copy Unix with, for their scripting nature.

Re: Learn a Programming Language Faster by Copying Unix

#14

Rodrigo, I thought you should know that when browsing your site on an iPhone 4, the header overlapped the index. That wasn't a great description, so here is a screenshot: http://db.tt/7grTPHsL You also cannot zoom in, which made it very hard to read.

Hi Gabriel,

I'll change it. Thank you very much for reporting the problem. It now allows you to zoom in. I'll take more time to fix the header, tho.

Thanks man.

Re: Learn a Programming Language Faster by Copying Unix

#15

Can someone give a non-expert way of going about this learning method? For instance, what are your options on Windows or Mac? And are the languages you can do this with limited to Ruby, Python, or Javascript?

One of the simplifying assumptions that is built into this idea is that the input and output to the program are simple streams ( a file, a terminal ). Not surprisingly that makes things a lot less complex so you can focus on the programming.

Since a Raspberry Pi is only $35 or $50 with enough stuff to program it, that is one way to get started. Of course taking an older tossed of PC and installing Linux on it works too (which can often be done for free if there are businesses around)

Re: Learn a Programming Language Faster by Copying Unix

#16

Can someone give a non-expert way of going about this learning method? For instance, what are your options on Windows or Mac? And are the languages you can do this with limited to Ruby, Python, or Javascript?

One of the simplifying assumptions that is built into this idea is that the input and output to the program are simple streams ( a file, a terminal ). Not surprisingly that makes things a lot less complex so you can focus on the programming. Since a Raspberry Pi is only $35 or $50 with enough stuff to program it, that is one way to get started. Of course taking an older tossed of PC and installing Linux on it works t…

Or a Linux VM on your Windows/Mac host

Re: Learn a Programming Language Faster by Copying Unix

#19
post #17

For a purely functional language like Haskell, this would not be a very good advice. Any kind of I/O would involve monads and other imperative constructs. Better implement an algorithm involving trees or graphs to better appreciate a functional language.

    main = interact id
This is a slightly crude implementation of cat in Haskell. As you can see, it is replete with scary monad plumbing that gets in the way of the actual functionality (copying stdin to stdout).

I would explain further and implement more than what the blog post suggested but there's already a book (Real World Haskell) that does this with a number of other Unix commands.

Re: Learn a Programming Language Faster by Copying Unix

#20

Can someone give a non-expert way of going about this learning method? For instance, what are your options on Windows or Mac? And are the languages you can do this with limited to Ruby, Python, or Javascript?

The point is to copy the commands, you can copy them on any operating system. It just happens that Mac & Linux have them built in while Windows doesn't.

As for which languages, this actually seems like it would be useful for learning any language that has reasonable ways of interacting with IO streams. Off the top of my head:

Ruby, Python, Javascript (node.js), Perl, Java, C#, Scala, Clojure, C, C++, Go, etc.

Post reply on HN