74 karma · joined December 31, 2012
I have trouble understanding the "boilerplate" thing because avoiding writing boilerplate is
1) already a solved "problem" long before AI
2) is it really a "problem"?
The first point: * If you find yourself writing the same piece of code over and over again in the same code it's the indication that you should abstract it away as a function / class / library.
* IDEs have had snippets / code completion for a long time to save you from writing the same pieces of code.
* Large piece of recycled functionalities are generally abstracted away in libraries of frameworks.
* Things like "writing similar static websites a million times" are the reason why solutions like WordPress exist: to take away the boilerplate part of writing websites. This of course applies to solutions / technologies / services that make "avoid writing boilerplate code" their core business
* The only type of real boilerplate that comes to my mind are things like "start a new React application" but that is a thing you do once per project and it's the reason why boostrappers exist so that you only really have to type "npx create-react-app my-app" once and the boilerplate part is taken care of.
The second point: Some mundane refactoring / translations of pieces of code from one technology to the other can actually be automated by AI (I think it's what you're talking about here, but how often does one really do such tasks?), but... Do you really want to? Automate, it, I mean?
I mean, yes "let AI do the boring staff so that I can concentrate on the most interesting parts" make sense, but it's not something I want to do. Maybe it's because I'm aging, but I don't have it in me to be concentrated on demanding, difficult, tiring tasks 8 hour straight a day. It's not something that I can and it's also something that I don't want to.
I much prefer alternating hard stuff that require 100% of my attention with lighter tasks that I can do while listening to a podcast and steam off in order to rest by brain before going back to a harder task. Honestly I don't think anyone is supposed to be concentrated on demanding stuff all day long all week long. That's the recipe for a burnout.
Yes, you know by heart that all_of requires "foo.begin()" and "foo.end()" and the capture context "[]", but it doesn't negate the fact that many other, better languages, just know how to cycle an array without having to specify begin and end, know how to capture arguments when needed, don't require a useless (in this context) return, nor clutter a single line of code with nine differenct gibberish symbols like "(", ")", "::", ",", "[]", ";" "{", "}".
Take the ultra humble javascript: foo.every(a => a % 2)
When you need three times the characters to obtain the same result, and those charcters are a clusterfuck, it is not relevant if years of usage made you comfortable nonetheless with it.
Sure, you can overdesign in any language, but some inner language characteristics of Java lead to it more than other languages do. Copying input to output is a statement, if you think about it in in a logical, human way: "I want you, program, to perform the action of copying this to that". But Java, unlike some other languages forces you to say: "Make a class, make a main function because YOU need it, Java, and only after please do what I really want and copy that input to the outout".
In python, for instance, I'm in control of whether making a StreamCopier class, a copy_stream() function or just get to the core of what i want and write "print(input())".
Generally speaking, in most dynamic languages if I want to access the to_string() method of something passed to a function, I can pass a list, an int, a Duck object and till it has a to_string() function I'm good to go, or I can even monkey patch to_string() and call it a day.
In (too) many cases Java the language forces you to make instances over instances and implementation of interfaces and the like just to access the data you need in the way a framework or a method wants, not you, and often this is frustating because you see your data "just there" and the language fights against you preventing you to acccess it in an easy way. I need to call to_string() of SomeClass but I have an instance of SlightlyDifferentClassStream? Good luck with that, maybe the only possible way is to create a DifferentClassConverterProxy just to have a DifferentClassTranslator, extend TraslatorStream, feed it with my SlightlyDifferentClassStream and have something compatible with SomeClass.
This is not only true to Java, some of these "problems" arise from it being a statically typed pure OO language (a very good thing on my book when it is not implemented in a dumb way) that is put to shame by a cleaner implementation of the same principles like the one seen in C# that, on top of all, also offers a powerful dynamic programming, lambdas and so on.
Also, Java suffers from an enterprisey background. I consider a language environment to be a very relevant part of a language itself, and Java has promoted the proliferation of ridiculous bahamut frameworks with a freaking large number of classes and instances "just in the case someone needs to extend it".
These are facts, not "Har-har-so-many-classes".
Take a sane implementation of a web framework like Django. It is an opensource project born from the needs of a small group of developers. You don't have "so many classes" if you only write those that you really need to solve of your problems, and the project progresses from there to embrace the everyday, real world needs of a larger group of contributors. Most Java frameworks I've worked with really give me the tangible perception of a large group of monkey developers programming them following line by line a technical specification bible of thousands of pages written by a council of architects with business people yelling at them "mooooore, mooooore, we need more of all of this so that we can sell to ANYONE!"
IDE or text editor, OP wants to know where you write the lines of of code that compose your programs.
This is just like claiming that Google Translate is more intelligent that the average American first grader because it can translate from Hebrew to Finnish better.
The enclosure may be of secondary importance to you as a musician, but from a "hand making" point of view, when I buy a synth, I'm buying many hours of work that went into making a solid, good-looking case around the circuit, applying filters and responsive knobs and patches and all sort of inputs and outputs and maybe a keyboard and other kind of controllers.
If we justify that Etsy is entitled to not consider handcraft a hand made synth because the main source of sound may not have been engineered by the seller, tomorrow they can as well ask any seller of knitted wool sweaters to provide pictures of them shearing those sheep whose wool has been used because users say:
"As a wool sweaters aficionado when I buy a sweater, I am buying the wool"
Well, there are a lot of things that your parents tell you "for your interest" when you're young and that you're supposed to understand when you grow up. For example, in high school, I had a fair amount (read: 5 years straight) of ancient Greek and Latin. I thought it was useless, why bother learning stone dead languages at all? The canonical answer was that in the process of studying those "useless" things I'd be acquiring a method for studying and exercise logic.
More than 10 years have passed since I finished high school, and you know what? I call bullshit with much more conviction that 15 years ago when I was first exposed to "agricola agricolae agricolae". If you want my logic to improve, why don't provide programming classes? It's a better exercise in logic and with a "secondary" effect I'm learning a job, and one of the more requested.
I'm a professional programmer, I never had a hard time getting a job, but that's because I self-taught myself how to program (starting way earlier than Latin classes), but it makes me angry nonetheless to think about some of my friends who are unable to get a decent job because, surprisingly, it seems like 2013 companies are not so much in need of people half-fluent in ancient Greek. This also extends to universities, of course, where providing real world skills (at least in most Italian universities) seem not to be an point that raises any interest.
One of our interns, lately, had troubles working on an application we developed with a Python backend, a fairly complex javascript-driven frontend that talked to a node.js server taking some data from a Java API. Turns out all he knows after 4 years of studying programming at the university is a bit of Prolog and some Fortran. He was also unable to ssh to our servers.
1. you have to check if you're in insert mode or not. Or you think you are, you're not, write vf5, press esc, press u to undo, retype vf5. Or you don't know and you press esc before it, so it's actually esc+v5j, and esc is not the easiest reachable key
2. you have to know you want to go down 5 lines. In reality, you know you want to go "a bit" down, so in a real world situation you either count (slow), make a subtraction with line numbers (slow) try to guess a number of lines, check what you've reached, keep retyping. This is all but "cognitive free". What is cognitive free (although requires more keystroke) is just press shift+down+down+down+down+down, for me.
(+ 1 2)
I was thrilled in the moment when I realized that all of the three parts of this banal form can be an arbitrarily complex forms themselves. For example, you can in place substitute "+" with a long code that contacts a web service and in the end, after 100 lines of code, returns "+". This 100 line function is made of forms made of forms made of forms and each can be replaced by the code that you might need. It's the beauty of the conciseness of the ternary operator in other language (a = b? 1 : 2) taken to a possibly infinite extreme.
This can sometimes be achieved in other languages with the use of temporary variables, one-shot functions if the language doesn't have lambdas (or multi-line lambdas like Python) and in the end litter your soul with the use of "eval"
This also leads to the other wow moment, when using Lisp makes it appear other languages' syntax so inelegant and cumbersome. At its core everything in Lisp is just like this:
(FUNCTION argument1 argument2 …)
When it clicks, it really hits you with the beauty of its perfect mathematical purity and you wonder how can you feel so comfortable with the average C-like language, where for has a syntax that is different from while, switch case is a beast of its own, sometimes you use curly brackets, sometimes square, sometimes regular or even angular, you don't have to forget commas and semicolons, you use colons and dots and question marks and myriads of keywords each with its own syntax and some things are functions and other operators and equal means something different from the double equals and so on.