Saturday, September 17, 2016

Brain Damage : Diagnosis & Treatment

Using software libraries is an important skill, as any professional software developer will attest. However, if software libraries are introduced too soon, they end up forming a wall of abstraction that leave smart people dumbfounded. Here my friend was, thinking she was on the cusp of learning the secret rules that govern computers; but instead, the instructor simply swapped out monolith of user-facing software with the equally opaque abstraction of the client library. Without mastering the language first — and learning how to read the library source code — my friend didn’t have the tools she needed to dig deeper and figure out what was going on at the bottom of the call chain.

The recommendation here is to learn C and move upwards to Python and maybe Lisp. 
There have been a few popular posts about Java not being a good starting point 



Here's a nice example - let's take an array of words like "death_star" and return an array of words like "Death Star", in Javascript, you _can_ do this :

--------------------------------------------------------------------------------------------------------------------

a.split('_').map( function(x) {return x.charAt(0).toUpperCase() + x.slice(1); } ).join(' ');
--------------------------------------------------------------------------------------------------------------------

If your company allows you to use Google Guava, then you can do this in Java:

--------------------------------------------------------------------------------------------------------------------
Function capitalizer = new Function<String,String>(){
                        @Nullable
                        @Override
                        public String apply(String s) {
                            return s.substring(0, 1).toUpperCase() + s.substring(1);
                        }

                    };

Joiner.on(" ") .join( Lists.transform( Splitter.onPattern("_").splitToList(key), capitalizer).toArray(new String[]{}));

--------------------------------------------------------------------------------------------------------------------

Now, one of them's much more readable than the other. And it's not the second one.

Also, the Kingdom of Nouns requires an appointed Noun Officer to be present for every verbing. Hence the "Joiner" and "Splitter" thinggies. Also note the short and succint function creation (Not!!)
Of course, Guava is what the cool kids in Java would use, if by cool kids you mean middle aged balding uncles wearing tee-shirts with collars for whom the words "Hitchhiker's guide to the galaxy" mean nothing.
Some programmers would use Apache's StringUtils, but these used to work in Sun Microsystems, and have now been assimilated by the Oracle machine and had their organs harvested.


And there's the more pedigreed lament by the creator of Shen  and a professor of computer science - Mark Tarver - marktarver.com/professor.html

All these point to what Alan Kay said all along , to paraphrase - any culture that spreads faster than education is a pop culture.  He also said these two following nuggets - from the Wikiquote page -

  • Sun Microsystems had the right people to make Java into a first-class language, and I believe it was the Sun marketing people who rushed the thing out before it should have gotten out.
  • If the pros at Sun had had a chance to fix Java, the world would be a much more pleasant place. This is not secret knowledge. It’s just secret to this pop culture.

So, how to avoid years of Java brain damage - In this case 16 ? 
A parting quote from John Carmack - 
"Low-level programming is good for the programmer's soul."

Still not convinced ? Or you _ARE_ convinced and would like to flog that dead horse some more ?Here's one more of my favorite bloggers who won my admiration by coming up with 
"Organizational Skills Beat Algorithmic Wizardry" , only he's talking about OOP and not Java

Don't Distract New Programmers with OOP
OOP Isn't a Fundamental Particle of Computing
Moving Beyond the OOP Obsession

I'll leave you with this list of dignitaries laying it on thick - if  you're still not convinved, you're in IT  , and not Engineering. The robots will be coming for your job soon

http://www.yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html



The END (?)


Labels:

0 Comments:

Post a Comment

<< Home