3 ms·
That is the problem. The system is very complicated and verbose to use. Lets say you want to write a program that extracts all links from a web page. How would
by jules 15y ago
That is the problem. The system is very complicated and verbose to use.
Lets say you want to write a program that extracts all links from a web page. How would you go about this? First, you look up in the documentation how to load a web page over http. This requires several lines of code, and it's complicated enough that you don't know it by heart after the first time you've done it. From there on it gets easier: you get a library and read the documentation to parse HTML and use an xpath or css selector to load all the links and then read of the href attribute. All of this probably requires around 15 lines of code, with various method calls that you have to look up.
In Ruby, I do this:
doc = Nokogiri::HTML(open('http://google.com'))
urls = doc.css('a').map{|link| link[:href]}
I know how to do this by heart because there are just a couple of things to remember. Not having to look at any documentation to do simple stuff like this saves a lot of time.
- eropple 15y agoI rarely use the MSDN, because I have the important parts in Visual Studio. I don't have to look up a bunch of methods as you assert, because I know (roughly) what objects I'll need and I actually have working, effective intellisense and detailed inline comments. And I only have to look it up once or perhaps twice--I am not, you might be surprised to know, limited to remembering two-line snippets by heart, but perhaps even stretches of code. I can do your rather contrived example in about five lines with recursion and LINQ, but I wouldn't because I have Perl and Python (both in cygwin and IronPython) on my machine, which are better-suited to the task of simple text processing. If it were part of a bigger project, then it'd be reusable code and as such writing those five lines (or even--gasp--fifteen, as if that's such a travesty!) is very much No Big Deal. You're making up problems that don't exist.