<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0cEQng4cCp7ImA9WhBWF0g.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185</id><updated>2013-04-12T10:23:23.638+02:00</updated><category term="Node.J" /><category term="Software Engineering" /><category term="Performance" /><category term="Freedom Languages" /><category term="Prime Numbers" /><category term="C" /><category term="Sieve" /><category term="Clojure" /><category term="Pointless" /><category term="Geometry" /><category term="Windows" /><category term="Prolog" /><category term="presentation" /><category term="Web" /><category term="Testing" /><category term="System Programming" /><category term="Productivity" /><category term="Perforce" /><category term="git" /><category term="AI" /><category term="itertools" /><category term="TextMate" /><category term="Mac" /><category term="Mac OS X" /><category term="Laziness" /><category term="vim" /><category term="Mac Dev" /><category term="Social Choice Theory" /><category term="SCM" /><category term="Computer Science" /><category term="CSS" /><category term="Java Epic Failure" /><category term="Javascript" /><category term="Pointless programming" /><category term="Closures" /><category term="Land of Lisp" /><category term="Social Networks" /><category term="Latex" /><category term="Metaprogramming" /><category term="misc" /><category term="Computability" /><category term="Haskell" /><category term="Atkin Sieve" /><category term="leiningen" /><category term="xUnit" /><category term="editor" /><category term="Programming Languages" /><category term="PostgreSQL" /><category term="string concatenation" /><category term="Django" /><category term="Game Of Life" /><category term="DB" /><category term="Build Systems" /><category term="Fixtures" /><category term="Emacs" /><category term="Bash" /><category term="Object Oriented Programming" /><category term="Templates/Generics" /><category term="Io" /><category term="call/cc" /><category term="Optimization" /><category term="Python" /><category term="Zsh" /><category term="Gambit" /><category term="Logic" /><category term="Real Basic" /><category term="Security" /><category term="Lisp" /><category term="IDE" /><category term="Unfold" /><category term="Programming" /><category term="C++" /><category term="LLVM" /><category term="Shell" /><category term="Node.js" /><category term="Artificial Intelligence" /><category term="Scala" /><category term="Function Composition" /><category term="Conti" /><category term="Software" /><category term="Common Lisp" /><category term="Anamorphism" /><category term="Design Patterns" /><category term="Scheme" /><category term="Unit Testing" /><category term="Social Network Analysis" /><category term="Pointfree" /><category term="Book Review" /><category term="quicksort" /><category term="Declarative Programming" /><category term="Y Combinator" /><category term="Office" /><category term="PyCharm" /><category term="sorting" /><category term="Applescript" /><category term="Java" /><category term="Fun" /><category term="Algorithms" /><category term="jedit" /><category term="Racket" /><category term="nosetests" /><category term="ePublishing" /><category term="Network Analysis" /><category term="Maths" /><category term="Game Theory" /><category term="IntelliJ" /><category term="Functional Programming" /><category term="Ruby" /><category term="PageRank" /><category term="Maven" /><category term="unix" /><category term="Linux" /><category term="Continuations" /><category term="Cocoa" /><category term="Hardware" /><category term="Rant" /><category term="Ubuntu" /><category term="Game Programming" /><category term="Pointfree programming" /><category term="Macros" /><category term="Complex Networks" /><category term="mercurial" /><category term="Erlang" /><title>RiK0 Tech Temple</title><subtitle type="html">Computing, Maths, Science
[from Enrico Franchi]</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.enrico-franchi.org/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>297</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Rik0TechTemple" /><feedburner:info uri="rik0techtemple" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;A0cHQnw_fyp7ImA9WhJVGU8.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-8190344571223143022</id><published>2012-09-06T12:57:00.002+02:00</published><updated>2012-09-06T12:57:13.247+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-06T12:57:13.247+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Latex" /><category scheme="http://www.blogger.com/atom/ns#" term="unix" /><title>Unix lover: snippet 1.</title><content type="html">I love Unix so much... I had this latex file and I wrote the names of the files of the intended chapters to be included in the mainfile. Then I realized that I had to basically write all the filenames or do some crappy copy and paste.&lt;br /&gt;
&lt;br /&gt;
However... &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;cat &amp;lt;&amp;lt;EOF | sed -e's/\\input{\(.*\)}/\1.tex/' | xargs touch
\input{intro}
\input{cha1}          
\input{cha2} 
\input{cha3}
\input{cha4}  
\input{cha5}
\input{conclusions}
EOF
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/6Tp-DDBeZDU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/8190344571223143022/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=8190344571223143022" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8190344571223143022?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8190344571223143022?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/6Tp-DDBeZDU/unix-lover-snippet-1.html" title="Unix lover: snippet 1." /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/09/unix-lover-snippet-1.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MNQHoyfCp7ImA9WhJVGEs.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-820367535617238894</id><published>2012-09-05T18:39:00.001+02:00</published><updated>2012-09-05T19:18:11.494+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-05T19:18:11.494+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Rant" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Haskell" /><title>Models of human skills: gaussian, bimodal or power-law?</title><content type="html">&lt;p&gt;The first thing I have to say is that this post actually contains my own reflections. I have not found clear scientific facts that actually prove these ideas wrong or right. On the other hand, if you have evidence (in both directions) I'd be glad to have it.&lt;/p&gt;
&lt;p&gt;On of my first contacts with probability distributions was probably around 7-8th grade. My maths teacher was trying to explain to us the concept of gaussian distribution, and as an example, he took the grade distribution. He claimed that most of the students get average results and that comparatively fewer students got better or worse grades (and the more "extreme" grades were reserved for a few).&lt;/p&gt;
&lt;p&gt;I heard similar claims from many teachers of different subjects and I have not been surprised. It looks reasonable that most people are "average" with fewer exceptionally good or exceptionally bad exemplars. The same applies to lots of different features (height, for example).&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src="http://farm9.staticflickr.com/8445/7938085710_8cdd5c9e0b.jpg" width="381" height="253" alt="201209051915.jpg" style="border:1px #000000 solid;" /&gt;&lt;/p&gt;
&lt;p&gt;Lots of years later, I read a very &lt;a href="http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf"&gt;interesting paper&lt;/a&gt; claiming that, instead the distribution of programming results usually has two humps. For me, the paper was sort of an epiphany. In fact, my own experience goes in that direction (but here, I may be biased because I have not collected data). The paper itself comes with quite lot of data and examples, though.&lt;/p&gt;
&lt;p&gt;So apparently there are two models to explain the distribution of human skills: the bell and the camel. My intuition is that for very simple abilities, the distribution is expected to be a gaussian. Few people have motivation to become exceptionally good, but the thing is simple enough that few remain exceptionally bad either. On the other hand, sometimes there is simply some kind of learning barrier. It's like a big step that not everybody is able to make. This is common for non-entirely trivial matters.&lt;/p&gt;
&lt;p&gt;In this case, the camel is easily explained. There are people who climbed the step and people who did not. Both groups are internally gaussian distributed. Another example could be an introductory calculus exam. If the concepts of limit and continuity are not clear, everything is just black magic. However, some person may still get decent marks because of luck or a lower level form of intuition. Among those that have the fundamental concepts clear there is the usual gaussian distribution.&lt;/p&gt;
&lt;p&gt;However, both models essentially assume that the maximum amount of skill is fixed. In fact, they are used to fit grades, that have, by definition, a maximum and a minimum value. Not every human skill has such property. Not every human skill is "graded" or examined in a school like environment. And even for those that actually are, usually grades are coarse grained. There is probably a big difference between a programming genius (like some FOSS super stars) and a regular excellent student. Or between, say, Feynman and an excellent student taking full marks. The same thing may be even more visible for things usually perceived as artistic. Of course, it is hard to devise a metric that can actually rank such skills.&lt;/p&gt;
&lt;p&gt;My idea is that for very hard skills, the distribution is more like a power law (at least in the tail). Very few people are good, most people are not even comparable to those and the probability to find someone twice as good as a very good candidate is just a fraction.&lt;/p&gt;
&lt;p&gt;Just to conclude, I believe that for very simple skills most of the time we have a gaussian. If we have "learning steps" or some distinctive non-continuous feature that is related, then we have multi-modal distributions (like the camel for programming: those that are able to build mental models of the programs are successful, those that only use trial and error until the programs "compile" are unsuccessful). Eventually, for skills related to exceptionally hard (and challenging and gratifying) tasks we have power-law distributions. May we even use such distributions to classify the skills and the tasks? And in those cases, a gaussian distribution is a good thing or not?&lt;/p&gt;
&lt;p&gt;So that, given someone that is able to make mental models of programs, maybe Haskell programming remains multi-modal, because there are some conceptual steps that go beyond basic programming, while Basic is truly gaussian? Is OOP gaussian? And FP?&lt;/p&gt;
&lt;p&gt;And in OOP languages, what about static typing? Maybe dynamic typing is a camel (no, not because of Perl) because those that write tests and usually know what they are doing fall in the higher hump, while those that just mess around fall in the lower hump. Ideas?&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/M4n3ZbD7PhQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/820367535617238894/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=820367535617238894" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/820367535617238894?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/820367535617238894?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/M4n3ZbD7PhQ/models-of-human-skills-gaussian-bimodal.html" title="Models of human skills: gaussian, bimodal or power-law?" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/09/models-of-human-skills-gaussian-bimodal.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8GSH45eip7ImA9WhJVEE0.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-8904277560841703940</id><published>2012-08-26T19:48:00.001+02:00</published><updated>2012-08-26T19:57:09.022+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-26T19:57:09.022+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Scheme" /><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Closures" /><category scheme="http://www.blogger.com/atom/ns#" term="Common Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="Freedom Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Declarative Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><category scheme="http://www.blogger.com/atom/ns#" term="Erlang" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><title>Does Object-Oriented Programming really suck?</title><content type="html">&lt;p&gt;I recently read Armstrong essay on &lt;a href="http://harmful.cat-v.org/software/OO_programming/why_oo_sucks" title="Armstrong on OOP"&gt;how much OOP sucks&lt;/a&gt;. While such opinions would probably have considered pure blasphemy a few years ago, nowadays they are becoming more popular. So, what’s the matter with OOP?&lt;/p&gt;
&lt;p&gt;The first thing that comes to mind is that OOP promised too much. As already occurred to other paradigms and ideas (e.g., Logic Programming and Artificial Intelligence) sometimes researchers promise too much and then they (or the industry) cannot stay true to their promises.&lt;/p&gt;
&lt;p&gt;OOP promised better modularity, better code-reuse [0], better “whatever”. Problem is, bad developers write crap with every single programming paradigm out there. With crap I really mean “utter crap”. A good programmer using structured programming and a bad programmer using OOP, is that the good programmer’s structured program would probably look “more object oriented” than the other one.&lt;/p&gt;
&lt;p&gt;Another problem occurred in the OOP community: OOP “done right” was about message-passing. Information Hiding, Encapsulation and the other buzz-words are a consequence of the approach (because object communicate with messages, their internal state is opaque) not a goal of OOP. Objects are naturally “dynamic” and the way we reason about code is separating concerns in objects having related concerns and having the objects communicate in order to achieve the task at hand. And I’m a bit afraid of talking about “OOP done right”: I really just have my vision. OOP is very under-specified, so that it becomes very hard to criticize (or defend) the approach.&lt;/p&gt;
&lt;p&gt;However, OOP becomes “data + functions”. To me data is simply *not* part of OOP. It’s an implementation detail of how objects maintain state. As a consequence, I do not really see data-driven applications as good candidates to OOP. Once again, OOP was sold as universal. It is not. Consider the successes that functional programming is achieving (performance and concept-wise) in this area.&lt;/p&gt;
&lt;p&gt;This “data + functions” comes from C++ being the first commercially successful OOP platform. The great advantage was that the transition from structured programming to OOP was quite more easier, that programs could be far more efficient (read “less runtime”) than message passing dynamic OOP systems, at least back in the day. However, there was so much missing from the original idea!&lt;/p&gt;
&lt;p&gt;Since back then classes were considered good (and C++ had — and has — no separate concept of interface) + static typing and a relatively verbose language with no introspection, it became rather natural to focus on inheritance. Which later was proved to be a bad strategy. Consequently, there is less experience in building OO software than one would think, considering that for a large part of its history OOP was dominated by sub-optimal practices.&lt;/p&gt;
&lt;p&gt;So, what is really bad with OOP? Following Armstrong:&lt;/p&gt;
&lt;h2 style="color: #0066CC; background-color: #FFFFFF; font-size: 16px; font-weight: bold; margin: 2em 0px 0px; padding: 0.5ex 0px 0.5ex 0.6ex; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #0066CC; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"&gt;Data structure and functions should not be bound together&lt;/h2&gt;
&lt;p&gt;Agreed! But I believe that Data Structures are not *truly* part of OOP. Let me explain.&lt;/p&gt;
&lt;p&gt;Data is laid out in some way. There is a “physical layout”, for example. You can express that very precisely in C with extensions, to the point of exactly specifying the offsets of the various datas. A phyisical layout also exists in high level languages such as Python. However, it is not part of the Python model. Of course with the struct module or ctypes you can fiddle with it (but they are libraries), however, for the most part, it is just outside the conceptual language used to describe the problem.&lt;/p&gt;
&lt;p&gt;Data is also laid out in logical ways. Computer Science defined many data structures and algorithms over them. You can use OOP to express such structures and such algorithms. Still they are not “part” of OOP, they are just expressed in an object oriented way (or maybe not, and remain at structured programming level).&lt;/p&gt;
&lt;p&gt;One very good practice in OOP is not using together in the same body of code objects reasoning at different levels. So, for example, you have your low level business logic code that is expressed in terms of data structures, high level business logic expressed in terms of low level business code… and that’s it. Functions is not really together with data. You don’t have “data”. You have some layers of objects.&lt;/p&gt;
&lt;p&gt;The point is that OOP is about creating languages at semantic level (you usually do not get to change the syntax). That’s it. If the language is good, well… good. If the language is bad, ok, we’ve got a problem.&lt;/p&gt;
&lt;p&gt;Is this suboptimal? In a way, &lt;i&gt;yes&lt;/i&gt;. All the indirection may be very expensive. And since abstractions, well… abstract, you may find yourself with a language that is not expressive enough (at least not at the expenses of additional performance costs). Still functions and data structure is &lt;i&gt;not&lt;/i&gt; bound together. You just have objects and messages. No “functions” and no “data”. Please notice: this may not be the right thing to do. Still, the problem is not with data + functions, is just related to applying OOP to a specific domain that is ill suited for the approach. OOP is not for every task in the world. But the same objections applies to every system that is built as a stack of layered abstractions.&lt;/p&gt;
&lt;p&gt;Please also consider the &lt;a href="http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html"&gt;Qc Na story&lt;/a&gt;! Objects are not necessarily opposed to functional programming (you can see them as closures that make different actions available). Objects are just about state + behavior + identity.&lt;/p&gt;
&lt;h2 style="color: #0066CC; background-color: #FFFFFF; font-size: 16px; font-weight: bold; margin: 2em 0px 0px; padding: 0.5ex 0px 0.5ex 0.6ex; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #0066CC; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"&gt;Everything has to be an object&lt;/h2&gt;
&lt;p&gt;And this is something that I don’t think is a problem. It is like saying that Scheme is bad because “everything is a list” (which, strictly speaking, is not true, there are atoms and lambdas etc). If you do not want to program OO, then don’t. If you want, you probably want that everything is an object.&lt;/p&gt;
&lt;p&gt;The only issue with everything is an object is, sometimes, performance. From a variety of points of view, such strategy may kill performance. Objects usually have indirections (read pointer). 64 bit pointer for every integer is &lt;i&gt;bad&lt;/i&gt;. So we have hybrid stuff like Java and then we have to deal with boxing (either manually in the past or automatically right now). Performance issues can be somewhat “fixed” using proper JIT systems or other optimization techniques. Or providing libraries that do the right thing (see Numpy, for example).&lt;/p&gt;
&lt;p&gt;Other than that, I prefer objections in the line of “this thing that should be an object is something else” than those requesting that something that is an object really is. So, I can favorably consider an objection that says that, in Python, “if” is not an object (true). Even though I’m convinced that having if as a statement is not bad either.&lt;/p&gt;
&lt;p&gt;And the whole objections with “time”… well, time (and dates) are a bitch to handle. But I find that Python datetime module gets as close to perfection as humanely possible. I really can’t see describing time with a bunch of enums + some structures as an improvement. On the other hand, it looks to me as one of the cases where it is *easy* to see that the OO approach works better.&lt;/p&gt;
&lt;p&gt;Consider the related problem of representing a date in a locale. If you introduce a new representation of time, you need either to modify the original function or create a new function (maybe one that works with both things). Creating an interface, on the other hand makes it very easy to introduce new representations of time.&lt;/p&gt;
&lt;h2 style="color: #0066CC; background-color: #FFFFFF; font-size: 16px; font-weight: bold; margin: 2em 0px 0px; padding: 0.5ex 0px 0.5ex 0.6ex; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #0066CC; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"&gt;Objection 3 - In an OOPL data type definitions are spread out all over the place&lt;/h2&gt;&lt;br /&gt;
And once again, in OOPL languages data type definitions are &lt;i&gt;not&lt;/i&gt; spread out all over the place. They are in C++ and perhaps in Java. And even in Java, if things are done properly, you reason in terms of interface, i.e., in terms of typed messages, not in terms of data structure.&lt;br /&gt;
“”“&lt;span style="color: #000000; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none;"&gt;In an OOPL I have to choose some base object in which I will define the ubiquitous data structure, all other objects that want to use this data structure must inherit this object. Suppose now I want to create some “time” object, where does this belong and in which object…&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #000000; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none;"&gt;””“&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #000000; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none;"&gt;Here it is pretty clear what he has in mind. I think that it is clear that, conceptually, time is an interface and that there is really no need for it to define “data structure”. And if your language is duck typed, the interface is implicit and you have finished before you started.&lt;/span&gt;&lt;br /&gt;
&lt;h2 style="color: #0066CC; background-color: #FFFFFF; font-size: 16px; font-weight: bold; margin: 2em 0px 0px; padding: 0.5ex 0px 0.5ex 0.6ex; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #0066CC; font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 20.149999618530273px; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"&gt;Objection 4 - Objects have private state&lt;/h2&gt;&lt;br /&gt;
And here I have to agree: state is the root of all evil. Problem is that entirely stateless systems are simply unpractical. We reason in terms of state. We can describe lots of things as stateless, but somewhat we have state. We have files. We have documents. We want them saved and retrieved.&lt;br /&gt;
So, we have to deal with state. Agreed. But: 1. imperative programming is about state2. object oriented programming is not, strictly speaking&lt;br /&gt;
You can use a “functional” style in OOP, for example. Most of the times, you don’t do it because the code becomes harder to write. But in many situations, on the contrary, you do it because it makes it easier. Often I write immutable objects that cannot be modified: they are not more stateful than a parameter in a function.&lt;br /&gt;
Sometimes this is not practical. Ok. And surely using a very stateful style of programming is bad. State in OOP is expressed as behavior. That’s it. Sometimes is done properly, sometimes it is not. Some strategy to deal with state are extremely nice (STM, as an example). Others are not. Also consider how “modern” functional languages really merge concepts from OOP (without being OOP) and how “modern” OOP languages merge concepts from FP (without being functional).&lt;br /&gt;
Examples: Python from the OOP side, using generators, lazy evaluation, list comprehensions, closures, etc etc etc.Clojure from the FP side… and all the features it has to express what resembles interfaces, STM and so on…

&lt;p&gt;——&lt;/p&gt;
&lt;p&gt;[0] someone once told me they feel lucky when they can actually &lt;i&gt;use&lt;/i&gt; the code effectively once, let alone &lt;i&gt;reusing&lt;/i&gt; it.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/42eBkFOqtes" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/8904277560841703940/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=8904277560841703940" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8904277560841703940?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8904277560841703940?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/42eBkFOqtes/does-object-oriented-programming-really.html" title="Does Object-Oriented Programming really suck?" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/08/does-object-oriented-programming-really.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcFRH8_eSp7ImA9WhJWE0s.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-1076398160966569480</id><published>2012-08-19T09:40:00.001+02:00</published><updated>2012-08-19T09:40:15.141+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-19T09:40:15.141+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X" /><title>Java 7 for Mac OS X</title><content type="html">And it was about time...&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1637588.html"&gt;Download Page&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Luckily now Java for OS X should not lag to much behind.&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/9s7OOWd93zI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/1076398160966569480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=1076398160966569480" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/1076398160966569480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/1076398160966569480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/9s7OOWd93zI/java-7-for-mac-os-x.html" title="Java 7 for Mac OS X" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/08/java-7-for-mac-os-x.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMGSHwzcSp7ImA9WhJQFEU.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-30522527405694870</id><published>2012-07-28T16:56:00.001+02:00</published><updated>2012-07-28T16:57:09.289+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-28T16:57:09.289+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="IDE" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><title>Orwell Dev-C++: Dev-C++ 5.2.0.3 Released</title><content type="html">Not a big fan of Windows C++ IDEs.... well I'm not a big fan of Windows, I'm not a big fan of IDEs and I don't particularly like C++ either. As far as I'm concerned, if you really need a C++ IDE for Windows you should have started using CodeBlocks or Eclipse. However, if you really want to stick with Dev-C++, at least grab this new version.&lt;br /&gt;
&lt;br /&gt;
The importance of using a modern C++ compiler should not be overlooked.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://orwelldevcpp.blogspot.com/2012/06/dev-c-5203-released.html?spref=bl"&gt;Orwell Dev-C++: Dev-C++ 5.2.0.3 Released&lt;/a&gt;: Time for another pile of bug fixes. I've also added a few features, like an updated set of built in compiler options and full file path hint...&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/cFnlCc6-n4I" height="1" width="1"/&gt;</content><link rel="related" href="http://orwelldevcpp.blogspot.com/2012/06/dev-c-5203-released.html?spref=bl" title="Orwell Dev-C++: Dev-C++ 5.2.0.3 Released" /><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/30522527405694870/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=30522527405694870" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/30522527405694870?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/30522527405694870?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/cFnlCc6-n4I/orwell-dev-c-dev-c-5203-released.html" title="Orwell Dev-C++: Dev-C++ 5.2.0.3 Released" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/07/orwell-dev-c-dev-c-5203-released.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUENRH85fSp7ImA9WhJREkU.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-497037382514861688</id><published>2012-07-14T18:34:00.002+02:00</published><updated>2012-07-14T18:34:55.125+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-14T18:34:55.125+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Social Networks" /><category scheme="http://www.blogger.com/atom/ns#" term="Social Network Analysis" /><category scheme="http://www.blogger.com/atom/ns#" term="Complex Networks" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="presentation" /><title>Complex and Social Network Analysis (europython 2012)</title><content type="html">&lt;div style="width:425px" id="__ss_13639769"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/rik0/complex-and-social-network-analysis-in-python" title="Complex and Social Network Analysis in Python"&gt;Complex and Social Network Analysis in Python&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse13639769" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=csnap-120714113205-phpapp01&amp;stripped_title=complex-and-social-network-analysis-in-python&amp;userName=rik0" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="wmode" value="transparent"/&gt;&lt;embed name="__sse13639769" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=csnap-120714113205-phpapp01&amp;stripped_title=complex-and-social-network-analysis-in-python&amp;userName=rik0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rik0"&gt;rik0&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/bCHWa0m0GdM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/497037382514861688/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=497037382514861688" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/497037382514861688?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/497037382514861688?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/bCHWa0m0GdM/complex-and-social-network-analysis.html" title="Complex and Social Network Analysis (europython 2012)" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/07/complex-and-social-network-analysis.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAESXs8fyp7ImA9WhJSGEg.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-126297105797083791</id><published>2012-07-09T19:08:00.000+02:00</published><updated>2012-07-09T19:08:28.577+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-09T19:08:28.577+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rant" /><title>On language level</title><content type="html">When historians started to name periods of time, they roughly divided human history in three main periods: Ancient History, Middle Ages and Modern History. Although there is not general consensus on the actual subdivision (I remember something about Burdach and Burckhardt), that is the general idea.&lt;br /&gt;
&lt;br /&gt;
Modern history essentially starts with the 15th century (again, this is debated) and goes on. Then there is the idea of contemporary history, which is a moving target and regards the last 80 years. I somewhat believe that perhaps we need a better name to refer to what happened in the 20th century that is going to last after it is not contemporary anymore. Still, it is not my job.&lt;br /&gt;
&lt;br /&gt;
Something similar occurred with Art History, where Modern Art goes from 1860 to 1970. Then we have Contemporary or PostModern. So in a few years, a new name will be needed... like Post^2Modern. Don't care.&lt;br /&gt;
&lt;br /&gt;
And we basically have the same trouble. In 1960 Fortran was a high level language. So every non machine level language is a high level language. And we call some languages very high level.&lt;br /&gt;
In a few years will we have "overwhelmingly high level languages"?&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/c3_Xp4j24dc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/126297105797083791/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=126297105797083791" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/126297105797083791?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/126297105797083791?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/c3_Xp4j24dc/on-language-level.html" title="On language level" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/07/on-language-level.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8HSH07fSp7ImA9WhVbGE4.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-3969871668003929398</id><published>2012-06-04T19:27:00.000+02:00</published><updated>2012-06-04T19:27:19.305+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-04T19:27:19.305+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Game Theory" /><title>Game Theory Slides</title><content type="html">&lt;div style="width:425px" id="__ss_13195390"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/rik0/game-theory-13195390" title="Game theory"&gt;Game theory&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse13195390" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=game-theory-120604121557-phpapp01&amp;stripped_title=game-theory-13195390&amp;userName=rik0" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="wmode" value="transparent"/&gt;&lt;embed name="__sse13195390" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=game-theory-120604121557-phpapp01&amp;stripped_title=game-theory-13195390&amp;userName=rik0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rik0"&gt;rik0&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/5iimZZATokQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/3969871668003929398/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=3969871668003929398" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/3969871668003929398?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/3969871668003929398?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/5iimZZATokQ/game-theory-slides.html" title="Game Theory Slides" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/06/game-theory-slides.html</feedburner:origLink><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="enclosure" href="http://feedproxy.google.com/~r/Rik0TechTemple/~5/gDy_AVF-9Ug/game-theory-13195390" length="0" type="text/html" /><feedburner:origEnclosureLink>http://www.slideshare.net/rik0/game-theory-13195390</feedburner:origEnclosureLink></entry><entry gd:etag="W/&quot;C0AESHo8eyp7ImA9WhVUFk4.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-286010371368306904</id><published>2012-05-21T22:21:00.002+02:00</published><updated>2012-05-21T22:21:49.473+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-21T22:21:49.473+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Game Theory" /><category scheme="http://www.blogger.com/atom/ns#" term="Social Choice Theory" /><title>Social Choice Theory Slides</title><content type="html">&lt;div style="width:425px" id="__ss_13018112"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/rik0/social-choice" title="Social choice" target="_blank"&gt;Social choice&lt;/a&gt;&lt;/strong&gt; &lt;iframe src="http://www.slideshare.net/slideshow/embed_code/13018112" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"&gt;&lt;/iframe&gt; &lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/" target="_blank"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rik0" target="_blank"&gt;rik0&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/ss9v_Bgsa5w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/286010371368306904/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=286010371368306904" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/286010371368306904?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/286010371368306904?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/ss9v_Bgsa5w/social-choice-theory-slides.html" title="Social Choice Theory Slides" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/05/social-choice-theory-slides.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04ASHw_cSp7ImA9WhVUFkw.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-1075084107237763239</id><published>2012-05-21T19:05:00.001+02:00</published><updated>2012-05-21T19:05:49.249+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-21T19:05:49.249+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Network Analysis" /><title>Worst bug ever: random and concurrent software, but the bug was
somewhere else!</title><content type="html">&lt;p&gt;Today I finally pinpointed the worst bug I ever met. The bug itself manifested perhaps a week ago when I decided to plot the distribution of a given attribute in a simulator. Essentially, the distribution should have been a power-law but a different behavior occurred. Varying some parameters changed the shape of the curve, but not the fact that it was not a power law.&lt;img src="http://farm8.staticflickr.com/7224/7242819116_81f361f5bf.jpg" width="480" height="360" alt="ccdf.png" /&gt;&lt;/p&gt;
&lt;p&gt;Here, in red the "expected curve", while the other three colors are the plots of the distributions I found (blue the original one, green and cyan variants with different parameters). The essential problem is that finding the exact cause of this was a hell. This kind of bugs is typically not found with unit-testing. In fact, the very problem is randomized and even mocking the random number generator does not really help. In fact, each individual event occurred apparently "right" and only the whole process showed a wrong behavior.&lt;/p&gt;
&lt;p&gt;Since the simulation is concurrent, I spent the first days analyzing if the actual order of execution did somehow cause the problem (the red curve is obtained with a non concurrent model). Turns out that I did things right: event order did not influence the problem.&lt;/p&gt;
&lt;p&gt;Eventually, I reviewed the drawing code (in the sense of urns, not in the sense of painting!). After a couple of days I figured out that perhaps I &lt;i&gt;should&lt;/i&gt; have mathematically proved that the code implementing the draw had the same distribution of the "red" variant. My wrong assumption was that sampling a graph edge and taking one end-point was equivalent to an extraction from an urn where each node is placed n times, where n is its degree. Essentially the question is that even though the graph was undirected, the computer did ordered the edges end-points.&lt;/p&gt;
&lt;p&gt;This is the distribution obtained taking the other endpoint:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src="http://farm8.staticflickr.com/7215/7242818304_21e2754637.jpg" width="480" height="360" alt="ccdf.png" /&gt;&lt;/p&gt;
&lt;p&gt;And here, eventually, what we got when I randomize between the two endpoints:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://farm6.staticflickr.com/5312/7242820572_d94bc731bc.jpg" width="480" height="360" alt="ccdf.png" /&gt;&lt;/p&gt;
&lt;p&gt;I just have to rewrite the code implementing the drawing. And I also have to make it fast (my former procedure was quite fast, given the fact that the whole graph is distributed).&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/OECrYBZdnZw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/1075084107237763239/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=1075084107237763239" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/1075084107237763239?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/1075084107237763239?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/OECrYBZdnZw/worst-bug-ever-random-and-concurrent.html" title="Worst bug ever: random and concurrent software, but the bug was&#xA;somewhere else!" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/05/worst-bug-ever-random-and-concurrent.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAMQXc5eyp7ImA9WhVVGEk.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-7855066932802034161</id><published>2012-05-12T19:16:00.000+02:00</published><updated>2012-05-12T19:29:40.923+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-12T19:29:40.923+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><title>About doing other people homework (funny functional programming in Python)...</title><content type="html">Some time ago there was a kid who asked us to perform his homework. The assignment was to write a program that took 10 numbers from the user and print sum and average. It was a matter of utmost urgency, according to him.&lt;br /&gt;
&lt;br /&gt;
Unfortunately enough, back then I decided that doing his homework was bad. I think it would have been far funnier if he would give his teacher this program:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;(lambda it, sys: (
    lambda n: (
        lambda F, nxt: nxt(
            map(
                lambda dummy: (F(int) * F(raw_input))(),
                it.takewhile(lambda m: m &lt; n, it.count()))
            ))(
                type('F+', (object, ), {
                    '__init__' : lambda self, f: setattr(self, 'f', f),
                    '__mul__': lambda self, g:
                        type(self)(lambda *stuff: self.f(g(*stuff))),
                    '__call__': lambda self, *stuff: self.f(*stuff)}),
                lambda seq: sys.stdout.write(
                    "%d %f" % (
                        sum(seq),
                        sum(seq)/float(len(seq))))))(10))(
                                __import__('itertools'),
                                __import__('sys'))
&lt;/pre&gt;
&lt;br /&gt;
Next time, I will surely do this sort of things. By the way, what about Python not being functional enough?&lt;br /&gt;
Yeah... it is not really PEP compliant. Don't think it matters, though.&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/1-L0BEVk11Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/7855066932802034161/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=7855066932802034161" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/7855066932802034161?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/7855066932802034161?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/1-L0BEVk11Y/about-doing-other-people-homework-funny.html" title="About doing other people homework (funny functional programming in Python)..." /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/05/about-doing-other-people-homework-funny.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIBRHo4eip7ImA9WhNbGEo.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-193833790147158767</id><published>2012-05-11T00:38:00.000+02:00</published><updated>2013-01-22T18:09:15.432+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-22T18:09:15.432+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rant" /><category scheme="http://www.blogger.com/atom/ns#" term="Software Engineering" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Software developers are not carpenters: on "Why do web sites andsoftware take so long to build? And why is it so hard?"</title><content type="html">This evening it happened to me to read &lt;a href="http://www.scottporad.com/2012/05/06/why-do-web-sites-and-software-take-so-long-to-build-and-why-is-it-so-hard/"&gt;this quite interesting article&lt;/a&gt; about why software is so hard to write. In the article, if you don't care or do not want to read it, the blogger reports the decision of a friend of his quitting his (probably highly paid) job as software developer because he got tired of it. The motivation he (the one who quit) suggested are that software is complex to build and is the only large-scale human artifact that is mostly built by hand. Hand-made stuff, he argues, is more fragile and error prone that machine-made stuff. He also points out that good software developers do not agree on the right way to do things, etc. Eventually, he arguments that in civil engineering architects (or engineers) design stuff, politicians and administrators regulate it and carpenters build it. That thing is not possible with software. &lt;br /&gt;
&lt;br /&gt;
So I have to say that: I'M FUCKING TIRED OF PEOPLE COMPARING BUILDING SOFTWARE TO BUILDING HOUSES. It is not the same thing. Moreover, I believe that comparisons with other forms of engineering has been detrimental for software development and lots of wrong practices and costly mistakes came from this illusion. I also think that people who really believe that building software is like building houses should be building other stuff. Neither software or houses (not houses I'm going to live in). Am I saying Rational F*cking Unified Process?  &lt;br /&gt;
&lt;br /&gt;
Humans have been building houses and bridges for millennia (yeah) and software since 50 years. It is quite natural that techniques have been developed. Software engineering is young. Really. So please, have patience. We will surely agree on the principle. That will happen earlier if people realize that no matter the process, unskilled developers are not going to build a working and maintainable piece of software.  &lt;br /&gt;
&lt;br /&gt;
Regarding the objection of software development being too manual, last time I checked, gcc and javac are exactly machine building software, not a bunch of underpaid third world workers. So, we do have machines building software. Compilers, build systems... testing infrastructures. We have lots of machines that help to build software, much in the same way that we use machines to build other things. We do not use machines to design most non trivial stuff. &lt;br /&gt;
&lt;br /&gt;
And we continuously create new kind of machines doing stuff for us.   Moreover, in the last 50 years we have been rising the abstraction level: since CPUs basically compute the same stuff, it means that we have more "machines" at work. People do not write opcodes. We write Python (Lisp? Clojure? Ruby?) code that is compiled and/or interpreted by a machine that runs on a machine called operating system that offers uses the services provided by a machine called kernel that uses relatively high-level services provided by the hardware. I don't tell the computer to write a 0 in some position of the hard disk!  &lt;br /&gt;
&lt;br /&gt;
Of course, we don't have machines that convert pointed-haired-boss-level babbling and unclear requirements to executable software. In other words, software developers are not skilled in divination. Perhaps haruspicy [0] or augury should be added to CS curricula. The problem is people do not even know exactly what they want. The best we can do is to keep them involved in the development process and use continuos feedback to deliver the product they expect.  &lt;br /&gt;
&lt;br /&gt;
"Name one other thing in the world, he said, that is used by so many people and which is created entirely by hand"  &lt;br /&gt;
&lt;br /&gt;
Well, many things come to my mind. Books. Laws. Theorems. You don't have machine writing books (well, in fact IA tried to build machines performing some limited "artistic" tasks, with mixed results -- the more constrained the piece of art, the better the chances --). I do not think we have machines writing laws.  Human have been creating laws for millennia. We *wrote* them down. And still, there is not consensus on what is right. Laws are bugged and there are people exploiting bugs in them (and that is not even closely illegal: it is the highly paid profession of the lawyer). We don't have nor want machines writing laws for us. Experts do not agree in what is a right law. Laws are continuously changed, modified, patched, deployed (in Italy we have the concept of "decreto attuativo" which I'm not even sure it has a clear translation in English -- the idea is that the law is so vague that you need some "lower level" laws to actually explain how the law should be implemented). Laws are unjust. And nobody fucking complains that the Romans could build bridges lasting millennia (I could have a roman bridge right under my feet right now) and we can't have unambiguous laws. Well, romans were pretty good to write laws as well...  &lt;br /&gt;
&lt;br /&gt;
So essentially the point is that some people think that software should be like houses, because it is a product. I think that software should be like poetry, because it is an idea.     &lt;br /&gt;
&lt;br /&gt;
---- &lt;br /&gt;
[0] The problem is that if you believe write requirements based on sheep guts then maybe you should start the noble profession of PHB. &lt;br /&gt;
[1] [0]s/sheep guts/birds flight/&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/hinhJFO9v5E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/193833790147158767/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=193833790147158767" title="16 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/193833790147158767?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/193833790147158767?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/hinhJFO9v5E/software-developers-are-not-carpenters.html" title="Software developers are not carpenters: on &amp;quot;Why do web sites andsoftware take so long to build? And why is it so hard?&amp;quot;" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>16</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/05/software-developers-are-not-carpenters.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EASH8-eyp7ImA9WhRaF0s.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-3944370961037348548</id><published>2012-02-20T20:20:00.001+01:00</published><updated>2012-02-20T20:20:49.153+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-20T20:20:49.153+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X" /><title>Lion, brew and gcc</title><content type="html">&lt;p&gt;For me, the transition to lion was relatively painless. Painless here basically means that I patched up the couple of things that gave me problems . In the specific situation, the issue is that Apple's new developer's tools do not include regular gcc anymore. Instead there is a version working with llvm backend which is great but has some issues with some packages that have not been updated yet.&lt;/p&gt;
&lt;p&gt;Another problem is that is closely related is that I had a Python 2.7 installed with Python main website package. I did this because older OS Xs did not have Python 2.7. That Python was built with the older gcc-4.0 apple shipped with SL. Thus, new libraries I install with pip still want that compiler, which apple moved in /Developers-3.2.x/... Thus, I lived so far adding that directory to the PATH and happily compiling.&lt;/p&gt;
&lt;p&gt;What I should have done was getting rid of my beloved python and either use EPD or Apple built-in 2.7 (shipping with Lion) or use a brew-ed python or see if Python.org distributes a Python compiled with the new compiler (which, as far as I know, is perfectly capable of building Python). The question is: are there any python extension I need that need the older gcc? But this is not something I'm going to discuss here: not yet ready to make the transition.&lt;/p&gt;
&lt;p&gt;I just want to point out that I installed the old gcc from homebrew-alt, and now I can just brew install --use-gcc for packages that need the old gcc compiler. This is easy to use and nice. I also removed the old Developers and hope everything's fine.&lt;/p&gt;
&lt;pre&gt;
% git clone https://github.com/adamv/homebrew-alt.git /usr/local/LibraryAlt
% brew install /usr/local/LibraryAlt/duplicates/apple-gcc42.rb
&lt;/pre&gt;
&lt;p&gt;An older version of gfortran I installed conflicted, but the commands above worked like a charm after removing it.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/E0qxL-hM0Y0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/3944370961037348548/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=3944370961037348548" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/3944370961037348548?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/3944370961037348548?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/E0qxL-hM0Y0/lion-brew-and-gcc.html" title="Lion, brew and gcc" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/02/lion-brew-and-gcc.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08CQX4-cCp7ImA9WhRbFUQ.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-2338684135142784227</id><published>2012-02-07T08:31:00.000+01:00</published><updated>2012-02-07T08:31:00.058+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-07T08:31:00.058+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Java Epic Failure" /><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Continuations" /><title>Clojure: writing tail recursive functions without using recur</title><content type="html">&lt;p&gt;Once upon a time, in the land of the Clojure, there was a brilliant student who enquired the nature of things and he for that he was greatly loved and appreciated by his teachers, for he was brilliant and asked about the nature of things and they could explain him the world. He learned about macros and first order functions and actors and software transactional memory and he was happy. But then he began to focus on the nature of recur and he felt that something was amiss and the way trampolines and functions interact made him wonder.&lt;/p&gt;
&lt;p&gt;During a short holiday he was in Schemeland, and he saw that they did not use recur. They named the functions and called them with their name in tail position and that was the way they did. And he felt it was good. So he asked his Master:&lt;/p&gt;
&lt;p&gt;"Why can the schemers call the functions in tail position and their stacks never end?"&lt;/p&gt;
&lt;p&gt;And the Master told him that it was because their soil is fertile, while the land of the Clojure is just an oasis in the wastes of Javaland.&lt;/p&gt;
&lt;p&gt;"We are lucky," he added, "for our land still gives us food spontaneously and the air does not drives us mad. And our spring is natural and not a framework. And if you do not like recur, you can always map, for or loop. Higher order functions and macros can help you to hide what you do not like, for you are the master of your own language."&lt;/p&gt;
&lt;p&gt;For a while the student was content, still he had a recurring thought: functions can do everything and in Church he did not find recur but only functions. And so he learned Y. But Y is a demanding beast, for it requires functions to be defined awkwardly. And the student wanted to simply write:&lt;/p&gt;
&lt;pre&gt;
(defn factorial [n acc]
  (if (= n 0)
    acc
    (factorial (- n 1) (* n acc))))
&lt;/pre&gt;
&lt;p&gt;His Master saw him troubled and in pain, and one day a big application they were creating exploded with a StackOverflowError and he knew that unless the student was cured he could not be writing code with the others. So one evening, he told his student that if he really wanted to learn the secrets to make tail-call recursive functions run with constant stack usage, he shall go to the Land of Snakes, where they eat only Spam and Eggs, to look for some &lt;a href="http://code.activestate.com/recipes/496691/"&gt;wise men&lt;/a&gt; and have them teach the secrets of creating tail recursion at language level. And he warned the student that the travel was dangerous.&lt;/p&gt;
&lt;p&gt;The young student was frightened, because the Land of Snake is far away and he was barely aware of the perils that lurked in the shadow. However, his resolve was strong and he packed his things, an editor and few jars to survive the wastes of Javaland, and ventured forth. He travelled through the dull wastes where everything is private or protected and he has to ask things to do things for him. But as most people grew up in the land of Clojure, he knew that objects are but closure in disguise and he new how to bind them to his will with the power of the dot form.&lt;/p&gt;
&lt;p&gt;After three days and three nights he eventually reached the Mines of Ruby and where massive gates blocked his way. He spoke the words as his master instructed (password: mellon), but the gate remained closed, for someone monkey-patched it and the door now spoke english, but the student did not know it and with failure in his heart he left the place, because he was trained in the ways of Lambda and could not cope with such a stateful abomination.&lt;/p&gt;
&lt;p&gt;After months of wandering, he eventually reached Schemeland, where he at least could tail recur without recur. He spent another month drowning his pain into first class continuations and losing hope to ever come back to the land of Clojure, until one day he overhead the men telling tales at the tavern about a pythonista adventuring to Schemeland. The student sought the pythonista and eventually he found him and he asked him about the secrets of recursion and the pythonista &lt;a href="http://micheles.googlecode.com/hg/decorator/documentation.html"&gt;showed him code&lt;/a&gt; and the student was happy because he knew classes are another word for closures and he was a master of closures. But he also understood that state was the missing element and he was saddened, because he also knew that state is treacherous.&lt;/p&gt;
&lt;p&gt;Nonetheless, he felt he had come to far to be stopped by the formal purity of stateless programming and he eventually wrote the code. Little is known of what happened afterwards. Some claim he finally found his way to the lend of the Snake, after having extendedly monkey-wrenched the monkey patcher, other say that he went back to the Land of the Clojure.&lt;/p&gt;
&lt;p&gt;I, your humble narrator, do not know the truth. I tried nonetheless to follow the student's step and implement myself the function that makes tail recursive calls without using recur. Ugly it is, and is indeed but an illusion, for recur lies inside the implementation. Still, it does the trick:&lt;/p&gt;
&lt;pre&gt;
&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;defrec factorial &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;n acc&lt;/span&gt;&lt;span class="s0"&gt;] 
&lt;a name="l28"&gt;  (&lt;/span&gt;&lt;span class="s1"&gt;if &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;= n &lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="s0"&gt;) 
&lt;a name="l29"&gt;    &lt;/span&gt;&lt;span class="s1"&gt;acc&lt;/span&gt;&lt;span class="s0"&gt; 
&lt;a name="l30"&gt;    (&lt;/span&gt;&lt;span class="s1"&gt;factorial &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;- n &lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="s0"&gt;) (&lt;/span&gt;&lt;span class="s1"&gt;* n acc&lt;/span&gt;&lt;span class="s0"&gt;))))&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;And here the code:&lt;/p&gt;
&lt;pre&gt;
&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;defn uuid &lt;/span&gt;&lt;span class="s0"&gt;[] (&lt;/span&gt;&lt;span class="s1"&gt;str &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;java.util.UUID/randomUUID&lt;/span&gt;&lt;span class="s0"&gt;))) 
&lt;a name="l3"&gt; 
&lt;a name="l4"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;defn tail-recursive &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;f&lt;/span&gt;&lt;span class="s0"&gt;] 
&lt;a name="l5"&gt;  (&lt;/span&gt;&lt;span class="s1"&gt;let &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;state &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;ref &lt;/span&gt;&lt;span class="s0"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;:func &lt;/span&gt;&lt;span class="s1"&gt;f &lt;/span&gt;&lt;span class="s2"&gt;:first-call &lt;/span&gt;&lt;span class="s3"&gt;true &lt;/span&gt;&lt;span class="s2"&gt;:continue &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;uuid&lt;/span&gt;&lt;span class="s0"&gt;)})] 
&lt;a name="l6"&gt;    (&lt;/span&gt;&lt;span class="s1"&gt;fn &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;amp; args&lt;/span&gt;&lt;span class="s0"&gt;] 
&lt;a name="l7"&gt;      (&lt;/span&gt;&lt;span class="s1"&gt;let &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;cont &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;:continue &lt;/span&gt;&lt;span class="s0"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;state&lt;/span&gt;&lt;span class="s0"&gt;)] 
&lt;a name="l8"&gt;        (&lt;/span&gt;&lt;span class="s1"&gt;if &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;:first-call &lt;/span&gt;&lt;span class="s0"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;state&lt;/span&gt;&lt;span class="s0"&gt;) 
&lt;a name="l9"&gt;          (&lt;/span&gt;&lt;span class="s1"&gt;let &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;fnc &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;:func &lt;/span&gt;&lt;span class="s0"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;state&lt;/span&gt;&lt;span class="s0"&gt;)] 
&lt;a name="l10"&gt;            (&lt;/span&gt;&lt;span class="s1"&gt;dosync&lt;/span&gt;&lt;span class="s0"&gt; 
&lt;a name="l11"&gt;              (&lt;/span&gt;&lt;span class="s1"&gt;alter state assoc &lt;/span&gt;&lt;span class="s2"&gt;:first-call &lt;/span&gt;&lt;span class="s3"&gt;false&lt;/span&gt;&lt;span class="s0"&gt;)) 
&lt;a name="l12"&gt;            (&lt;/span&gt;&lt;span class="s1"&gt;try&lt;/span&gt;&lt;span class="s0"&gt; 
&lt;a name="l13"&gt;              (&lt;/span&gt;&lt;span class="s1"&gt;loop &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;targs args&lt;/span&gt;&lt;span class="s0"&gt;] 
&lt;a name="l14"&gt;                (&lt;/span&gt;&lt;span class="s1"&gt;let &lt;/span&gt;&lt;span class="s0"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;result &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;apply fnc targs&lt;/span&gt;&lt;span class="s0"&gt;)] 
&lt;a name="l15"&gt;                  (&lt;/span&gt;&lt;span class="s1"&gt;if &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;= result cont&lt;/span&gt;&lt;span class="s0"&gt;) 
&lt;a name="l16"&gt;                    (&lt;/span&gt;&lt;span class="s1"&gt;recur &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;:args &lt;/span&gt;&lt;span class="s0"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;state&lt;/span&gt;&lt;span class="s0"&gt;)) 
&lt;a name="l17"&gt;                    &lt;/span&gt;&lt;span class="s1"&gt;result&lt;/span&gt;&lt;span class="s0"&gt;))) 
&lt;a name="l18"&gt;              (&lt;/span&gt;&lt;span class="s1"&gt;finally&lt;/span&gt;&lt;span class="s0"&gt; 
&lt;a name="l19"&gt;                (&lt;/span&gt;&lt;span class="s1"&gt;dosync &lt;/span&gt;&lt;span class="s0"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;alter state assoc &lt;/span&gt;&lt;span class="s2"&gt;:first-call &lt;/span&gt;&lt;span class="s3"&gt;true&lt;/span&gt;&lt;span class="s0"&gt;))))) 
&lt;a name="l20"&gt;          (&lt;/span&gt;&lt;span class="s1"&gt;dosync&lt;/span&gt;&lt;span class="s0"&gt; 
&lt;a name="l21"&gt;            (&lt;/span&gt;&lt;span class="s1"&gt;alter state assoc &lt;/span&gt;&lt;span class="s2"&gt;:args &lt;/span&gt;&lt;span class="s1"&gt;args&lt;/span&gt;&lt;span class="s0"&gt;) 
&lt;a name="l22"&gt;            &lt;/span&gt;&lt;span class="s1"&gt;cont&lt;/span&gt;&lt;span class="s0"&gt;))))))&lt;/span&gt;&lt;/pre&gt;
&lt;script src="https://gist.github.com/1753119.js"&gt; &lt;/script&gt;
&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/5RoEJ2g1DD0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/2338684135142784227/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=2338684135142784227" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2338684135142784227?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2338684135142784227?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/5RoEJ2g1DD0/clojure-writing-tail-recursive.html" title="Clojure: writing tail recursive functions without using recur" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/02/clojure-writing-tail-recursive.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMMSXY6fip7ImA9WhRbEk0.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-9057276020219972555</id><published>2012-02-02T18:08:00.001+01:00</published><updated>2012-02-02T18:08:08.816+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-02T18:08:08.816+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="IntelliJ" /><category scheme="http://www.blogger.com/atom/ns#" term="leiningen" /><category scheme="http://www.blogger.com/atom/ns#" term="Maven" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Geek automation: Maven, Ant and other things</title><content type="html">&lt;p&gt;About automation, I'm definitely a geek. And I totally agree with the famous graph:&lt;/p&gt;&lt;img src="http://jonudell.net/images/geeks-win-eventually.png" /&gt;
&lt;p&gt;And I was working to a Java project with an unusual deployment. Part of the problem is that the actual application for which I was writing the plugin wasn't available as a maven repository. Moreover, running the whole thing needed some fiddling with long command line options, plus a non-trivial class-path.&lt;/p&gt;
&lt;p&gt;I started appreciating maven with leiningen, and then by itself. Moreover, it solves one of the worse problems I have with IDEs. I hate to version IDE files (after all, people may use a different environment, something many eclipse users do not even consider). And I hate to recreate them every time (especially when they are not trivial). Eventually, I hate to depend from a GUI program to actually build a project (where a command line should suffice).&lt;/p&gt;
&lt;p&gt;Then there is another problem related to libraries, i.e., I find it annoying all the solution regarding jars:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;place the jars in a system wide directory akin to /usr/local/lib&lt;/li&gt;

  &lt;li&gt;download the jars every time and manually add them to the project&lt;/li&gt;

  &lt;li&gt;create a script that downloads the jars (and curse the first time you develop on windows)&lt;/li&gt;

  &lt;li&gt;do not use external dependencies&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Maven solves all these problems together. I just name the jars in the pom and everything is taken care of. I loved the thing so much with Clojure and Leiningen that even with the despicable xml syntax things work smoothly.&lt;/p&gt;
&lt;p&gt;But I had this very important jar that ain't versioned nowhere. So maven was out of question, I thought: moreover. The idea of manually downloading the jar and then adding it to maven's repository (and doing it on the 2-3-4 computer I use) really looked unacceptable.&lt;/p&gt;
&lt;p&gt;So I dig into ant most advanced stuff and built an ant script that actually downloaded the jar for me and put it in a lib directory inside the project (packaging jars with the project is not acceptable). But I still wanted to use maven… so I learned the terribly documented ant plugin to get the dependencies from maven… and since that was not installed by default, I also wrote the code to go and get the jar.&lt;/p&gt;
&lt;p&gt;So I basically had this ant script that did everything for me… and was some hundred lines long. Eventually, I also wrote some targets to generate scripts to execute the project (I told about complex command lines).&lt;/p&gt;
&lt;p&gt;Of course, this also meant that maven was under-used. But then I realized… I have maven. I have a plugin that creates the scripts for me (not part of maven, but maven can easily get it). I only need ant to get the ant-maven bridge (which I wouldn't need anymore) and to get the missing jar. So I'm maintaining a very complex system for basically nothing: it is so much simpler to wget the jar, install it in the local maven repository and go on.&lt;/p&gt;
&lt;p&gt;Fun that in order not to write to lines a couple of times I wrote a one hundred lines script.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/SSbL6yvn5tY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/9057276020219972555/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=9057276020219972555" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/9057276020219972555?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/9057276020219972555?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/SSbL6yvn5tY/geek-automation-maven-ant-and-other.html" title="Geek automation: Maven, Ant and other things" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/02/geek-automation-maven-ant-and-other.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QFQ3g-eCp7ImA9WhRUFUo.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-5144449796774766103</id><published>2012-01-26T10:48:00.001+01:00</published><updated>2012-01-26T10:48:32.650+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-26T10:48:32.650+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Freedom Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Declarative Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Handle this! (views, const, state in Clojure, Java, C++ and Python)</title><content type="html">&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;The original vision Alan Key had on object oriented programming was about separate entities communicating through message passing. A logical consequence is that the global programming state is the sum of the individual states of these entities (called &lt;i&gt;objects&lt;/i&gt;). State of such objects is naturally hidden from the outside and state modifications occur only as a consequence of the exchanged messages.&lt;/p&gt;
&lt;p&gt;I would like to mention that in this model the "privacy" of internal variables is not exactly simply a matter of a keyword, but a consequence of a programming philosophy. This is not the kind of limitation you get in Java classes or C++, where the field is there, you just cannot access it. It somewhat more similar to calling a black-box with a state that is its own business; there are &lt;i&gt;no fields&lt;/i&gt;and if there are, they are just an implementation detail. Or even more so, private variables are not accessed in the same sense that the physical address of an object in Java is not part of the programming model.&lt;/p&gt;
&lt;p&gt;Such objects do not necessarily have their own thread of execution (in the sense that they are concurrently in control). However, if they had, the logical model would not be overly different. But back to the objects…&lt;/p&gt;
&lt;p&gt;I somewhat believe that objects are an overloaded metaphor. In fact, there are at least two &lt;a href="http://www.enrico-franchi.org/2012/01/java-and-clojure-how-data-structures.html"&gt;types of objects&lt;/a&gt;. And while the object oriented message only metaphor well applies for domain specific objects, I somewhat feel that it is not appropriate for some data structures. Sometimes, it is a nice property that "similar structures" have a common interface so that, for example, switching from an array to a linked-list is a painless transition, because it eases experimentation with different trade-offs regarding computational efficiency (although such problems are better solved with pen and paper).&lt;/p&gt;
&lt;p&gt;However, in other situations, accessing the internals of some complex structure is plainly the "right thing to do". It is a walking-horror from the object oriented point of view, but it plainly makes sense for computational reasons. I often have to deal with graphs with billions of nodes, and more often than not I feel that usual OO laws are too restrictive.&lt;/p&gt;
&lt;h4&gt;Graph example&lt;/h4&gt;
&lt;p&gt;A clear example here is the design of networkx.Graph: I have nothing against the design, by the way. I believe they do the right thing. Here the idea is that they have implemented their Graph internals in some way (does not matter how, right now). However, you may want to get a list of all the nodes in the graph. Now, how to do this? The first issue, is that the nodes may not be memorized in a way which is easier to return. This is actually the case: nodes are a dictionary keys, under the hood. So essentially there is no easy way to return them without calling some dict member which returns a &lt;b&gt;new&lt;/b&gt;structure holding the nodes.&lt;/p&gt;
&lt;h3&gt;State and "Static" OOP&lt;/h3&gt;
&lt;p&gt;OOP is all about state change. Perhaps just local state change, if done correctly. And hopefully the state's effect do not propagate too far from where the state is hidden. About C++, I found no other very mainstream OO language that makes it clear what you shall change and what you shall not.&lt;/p&gt;
&lt;p&gt;The C++ pragmatics is really precise on consting whatever you can const. And to solve issues where it is not practical to have a logically const object which actually mutates something inside, you can use the mutable modifier to support the idea that the object &lt;i&gt;real&lt;/i&gt;state did not change while some irrelevant parts of it indeed changed. Examples are forms of caching, counting stuff, logging to a logger we hold a reference to.&lt;/p&gt;
&lt;p&gt;Another important aspect of C++ is that it quite distinguishes between a const pointer (a pointer that cannot change) and a pointer to a const object (the pointed object cannot change). As always all this leads to additional complexity. However, declaring stuff const is good: first it is a rather strong safety guarantee, second it really leads to optimizations otherwise impossible. Still, it is tragically inadequate wrt. plainly immutable objects.&lt;/p&gt;
&lt;p&gt;Moreover, although many other languages do not have pointer arithmetics, they do have references. In Java it is possible, for example, to mark such a reference final, which essentially means it will always refer to a given object. However, there is no way to state that the actual object could not be mutated by accesses through that specific reference.&lt;/p&gt;
&lt;p&gt;In Java, the only way to achieve that goal is not providing methods that mutate the state. In fact this approach makes sense. Somewhat you make the language simpler without really losing much. And C++ newbies really do not get the whole constness thing very well.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;img src="http://farm8.staticflickr.com/7151/6764758181_45a496e761.jpg" width="480" height="476" alt="mutable-immutable.png" /&gt;&lt;/p&gt;
&lt;p&gt;Essentially, in Java you do not have the possibility to have a mutable object that some clients cannot mutate. There are options, however. For example, in Figure 1) we have two interfaces, one mutable and one immutable. We have the mutable interface extend the immutable one and the appropriate base classes.&lt;/p&gt;
&lt;p&gt;Immutability at class level can be obtained both (a) with a true immutable implementation implementing the immutable interface and a mutable implementation implementing the mutable one; or (b) with just a mutable implementation: clients that should not mutate the object will use the immutable interface. This is quite similar to the const in C++ in the sense that a const_cast is usually possible (and in this case we could just cast to the mutable interface). Such things somewhat break the whole immutability thing, but sometimes have their uses.&lt;/p&gt;
&lt;p&gt;And what is the big deal with immutability? Basically, in this context immutable stuff can be shared with no fear. And copying huge datasets is too inefficient to be considered.&lt;/p&gt;
&lt;h3&gt;Dynamic OOP&lt;/h3&gt;
&lt;p&gt;The essential problem here is that the OO language we have discussed so far are built around the idea that your co-workers will screw the project if they can do stuff. So the objective is not letting them do it. Constness shall be &lt;i&gt;enforced&lt;/i&gt;by the language (you had the opinion that I was happy about C++ const, did you?) because otherwise someone will foobar the project.&lt;/p&gt;
&lt;p&gt;On the other hand in languages such as Python you may well do everything to every object and consequently the const-enforcement does not fare very well. A bit more could be done (formally) in Ruby. Still, even then you could always hack the objects to let you do whatever you want. And believe me, you could do that also in C++ and Java, provided you have sufficient control of the environment where the program is going to be run. It is just way harder.&lt;/p&gt;
&lt;p&gt;In fact, I believe approaches where good policies about code isolation can be also (easily) implemented in Python. Good API design is of paramount importance. A C++ wise advise (from Meyers) was "Avoid returning Handles to object internals" (Item 28, Effective C++, 3rd ed, Scott Meyers, Addison-Wesley).&lt;/p&gt;
&lt;p&gt;Essentially the idea is never to let your object guts exposed and never ever let someone mess with it. This is not about trust. This is about such handles are just a sure way to break your object constraints (why I'm talking like a static programmer anyway?). The point is that such handles change state independently by the core object and this is probably going to be bad, because the corruption of the state will be revealed in a place and time extremely distant from when and where it actually happen.&lt;/p&gt;
&lt;p&gt;So, we have to carefully design our APIs, even (shall I say, especially?) if we are dynamic programmers. For example, we can return views on our object internals. Since our languages are very dynamic, such views can be easily constructed: they just have to quack like the original objects. When it makes sense, it is probably just better place the functionality in the "large" object and to delegate to the attribute (delegation is so trivial to implement in dynamic languages!). Notice that strongly interface based languages such as Java could make this approach even more natural, provided that formally specified interfaces make sense for the specific case.&lt;/p&gt;
&lt;p&gt;Sometimes it makes also sense to return object which can mutate and where their mutation influences the state of the object from which they come from. However, in this situations such objects shall be built in a way that they do not break the behavior of the object from which they were gotten. Essentially here we are just obeying principle like SRP (single responsibility principle) and design things to work together. In fact, they are not handles to the object internals at all. We are not exposing the implementation of the object: we are just exposing an interface to a part of the object state (perhaps even state that cannot be changed through the main object interface).&lt;/p&gt;
&lt;p&gt;What are the problems with this approach? As long as things are not modified, copying is fine. A view is a good thing, because it may be as efficient as possible for reading, while being completely safe. The problem essentially arises when we want to mutate the objects state: internals handles are bad, so we have to:&lt;/p&gt;
&lt;p&gt;1. carefully craft the object interface to allow modifications efficiently and that make sense to the problem at hand, without making it excessively general (because it clashes with efficiency) or excessively big (because it clashes with almost every good property OOP tries to give to programs)&lt;/p&gt;
&lt;p&gt;2. Perhaps create special objects that are able to perform controlled modifications on the original object. This may give lot of generality, in a sense, but also complicates the class hierarchy significantly.&lt;/p&gt;
&lt;h4&gt;Graph example&lt;/h4&gt;
&lt;p&gt;Back to our example… we may have many solutions. Suppose that this "get the list of nodes" operation is frequent enough. It may make sense to memorize such list separately from the dictionary. If node removal and addition is not too frequent, the additional memory may well be worth it (well, perhaps not, if we really have lots of nodes). Even if such operations are frequent, we double the cost of the addition and make deletion O(N)… but if instead of a list we use a set, we have both operation O(1) simply with an increased multiplicative constant. Of course a language could offer a dict implementation which essentially offers an efficient view over the set of keys, so that separate memorization is not needed.&lt;/p&gt;
&lt;p&gt;We could use a mutable datatype to hold the list, but then we should make a copy before returning it (this what actually happens with networkx). Not making a copy has the same problems of returning an internal handle. If we make a copy, then we could return something immutable or mutable. Essentially returning something immutable has not a lot of sense, as modifications would not affect the graph &lt;i&gt;and&lt;/i&gt;modifications to the graph are not reflected in the node-list. The simplest thing to do is plainly return a list of nodes.&lt;/p&gt;
&lt;p&gt;The true solution would be that dictionary supported a "true" view object which is able to modify the original dictionary. And actually Python 2.7 and Python 3 have it. At this point we could just return such thing and have both efficiency and functionality… were it not for a simple issue: a networkx graph has more than one internal structure holding the nodes. Thus a higher level view would need to be created which could work across the different point were the same information is memorized inside a Graph. And we are back to the "complicating the class hierarchy thing".&lt;/p&gt;
&lt;h3&gt;Immutable by default&lt;/h3&gt;
&lt;p&gt;The thing is that actually having to specify things to be const, is a bit a pain. And perhaps it is just me... but consider the Java solutions (this apply to things which roughly work like Java): we are talking about having two class and two interfaces (or just one class and two interfaces) for lots of objects. In my opinion, this is not practical. And if we want to create "well-behaved handles" things become even more complex.&lt;/p&gt;
&lt;p&gt;In fact, this is probably why it is not done (most of the times). Probably it should be sufficient to limit such strategies for things where it really matters. Think about the collections framework.&lt;/p&gt;
&lt;p&gt;On the other hand... think about a world where most things are just immutable. I think it is just a safer mind model of programming. It is not about limiting your colleagues (or yourself) on not doing things which are licit in the model and that we want to restrict.&lt;/p&gt;
&lt;p&gt;If we &lt;i&gt;think&lt;/i&gt;immutable, things are just easier. But then we are definitely moving towards the functional side of things. I'm not claiming that functional languages have &lt;i&gt;only&lt;/i&gt;immutable stuff. Even though many functional languages (Clojure, Haskell) have mostly immutable stuff. However, reasoning in terms of flows of functions and immutable objects is just easier than thinking about immutable immutable objects. At least, it should be, if we were trained to think functionally from the beginning.&lt;/p&gt;
&lt;p&gt;Here we are used to deal with const objects. Sometimes we &lt;i&gt;need&lt;/i&gt;to change the state. Two typical scenarios spring to mind. We aren't doing "Object Oriented Programming": we are just writing an algorithm and the algorithm was conceived for imperative languages. Sometimes there is no clear conversion into the functional world. Not an efficient one, at least. In this case we may want to use some special mutable object (arrays?) to perform our computation efficiently. And this may even generally work.&lt;/p&gt;
&lt;p&gt;In the second case, it is simply not practical to structure the state of the world as some function parameters. In fact most of the times the global state is to big to be wisely represented as a huge set of parameters. In this case we probably want to express the computation as a set of transformations (functions, basically) that shall be executed one after the other on the world. Here I am mostly thinking about Haskell's monads. Though, even different from a syntactical and semantical point of view, we are not far from the realm of refs/agents.&lt;/p&gt;
&lt;p&gt;The issue of efficiency, however, remains. We should still keep in mind that well buried under layers of object orientations there may be lots of hidden costs. Interfaces often get in the way of really efficient implementations, because costs are not part of the interface. The collections framework is beautiful… but sort is still implemented copying everything to an array and sorting the array.&lt;/p&gt;
&lt;h3&gt;Welcome under the sign of the Lambda&lt;/h3&gt;
&lt;p&gt;Not only it is better to have const object by default, that is to say object mutability shall be an opt-in rather than an opt-out. In fact, a part from the &lt;a href="http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html"&gt;famous koan&lt;/a&gt;about objects and closures, we have to avoid returning handles to our objects guts… but I do not see often closures that open up the enclosed state to the world.&lt;/p&gt;
&lt;p&gt;The point is that avoiding all the copy costs may be simply &lt;i&gt;the&lt;/i&gt;thing to do when we have to deal with huge datasets. Restrict mutability where needed (e.g., implementing the algorithms) but mostly use mutable input and outputs from functions. Moreover, functional code is generally flatter, which can also, in the long run, improve efficiency.&lt;/p&gt;
&lt;p&gt;Eventually, with languages such as clojure, even the perceived drawbacks of lists can be avoided using vectors, which support efficiently a different sets of primitives. Lazyness is also extremely helpful: actions that are not performed do not cost.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/LEoJfznaeVI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/5144449796774766103/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=5144449796774766103" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/5144449796774766103?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/5144449796774766103?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/LEoJfznaeVI/handle-this-views-const-state-in.html" title="Handle this! (views, const, state in Clojure, Java, C++ and Python)" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/01/handle-this-views-const-state-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcDSXw8fyp7ImA9WhRUFU0.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-8112653699607242544</id><published>2012-01-25T16:57:00.000+01:00</published><updated>2012-01-25T16:57:58.277+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-25T16:57:58.277+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Social Networks" /><category scheme="http://www.blogger.com/atom/ns#" term="Social Network Analysis" /><category scheme="http://www.blogger.com/atom/ns#" term="Complex Networks" /><category scheme="http://www.blogger.com/atom/ns#" term="Algorithms" /><title>Social Network Analysis</title><content type="html">This is a presentation I gave some days ago.&lt;br /&gt;
It is rather maths heavy and the point of view is more maths than computer science.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder='0' style='width:460px;height:375px;' src='http://public.iwork.com/embed/?d=sna.key&amp;a=p1001694596&amp;h=768&amp;w=1024&amp;sw=458'&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="width:425px" id="__ss_11254350"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/rik0/social-network-analysis-11254350" title="Social Network Analysis"&gt;Social Network Analysis&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse11254350" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=sna-120125090150-phpapp02&amp;stripped_title=social-network-analysis-11254350&amp;userName=rik0" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;param name="wmode" value="transparent"/&gt;&lt;embed name="__sse11254350" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=sna-120125090150-phpapp02&amp;stripped_title=social-network-analysis-11254350&amp;userName=rik0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/rik0"&gt;rik0&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/q2V2msQ7_V0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/8112653699607242544/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=8112653699607242544" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8112653699607242544?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8112653699607242544?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/q2V2msQ7_V0/social-network-analysis.html" title="Social Network Analysis" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/01/social-network-analysis.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYHRHk4eip7ImA9WhRWF0g.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-99099234629732074</id><published>2012-01-05T10:52:00.001+01:00</published><updated>2012-01-05T10:52:15.732+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-05T10:52:15.732+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Common Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="C++" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Java and Clojure - How data structures influence language usage</title><content type="html">&lt;p&gt;One of the essential points is that we are using object for at least two different things: i) data-types and ii) domain objects. Data-types are usually general entities that can make sense in every program and are not particularly related to a specific application. Examples of these objects are numbers and strings, but also vectors, lists, maps. On the other hand domain objects are domain specific and depend on the specific context. Both a payroll system and a web-server have probably some use for a vector class, however web-server probably does not have an employee class.&lt;/p&gt;
&lt;p&gt;The logic level of the objects of the two different kinds is different and code using both should not be written. Essentially, the idea is that low-level code should be encapsulated in methods or functions that work at an higher level, thus making the whole source more details because low level stuff does not clutter the flow of information. Also notice that most standard library code uses low-level abstractions, because it shall be rather domain independent. Thus better data structures mean better code.&lt;/p&gt;
&lt;p&gt;So what are these data-types? Languages differ greatly in their choice of datatypes. C has only integers and arrays, for example (ok, it is not OO, but does not matter right now). C++ inherit this. Strings are a library function, so are more well behaved collections. The interesting thing is that the different parts of the STL do not depend much on each other. So for example streams do not play really well with strings (e.g., file names cannot be strings, but in fact streams do not play well with about everything else) and std::string does not have a method such as&lt;/p&gt;
&lt;pre&gt;
vector&amp;lt;string&amp;gt; string::split(string sep);
&lt;/pre&gt;
&lt;p&gt;or, better:&lt;/p&gt;
&lt;pre&gt;
some_range&amp;lt;String&amp;gt; string::split(string sep);
&lt;/pre&gt;
&lt;p&gt;In Java, we have Strings, but collections were retro-fitted. So for example String#split returns an array of strings. In my opinion, one of the essential problems of many "static" programming languages such as C++ and Java is right here: they have the wrong primitives. Writing low level code, is very cumbersome and unnecessarily imperative (C++ STL somewhat makes an exception as it has a somewhat functional flavor the rest of the language lack).&lt;/p&gt;
&lt;p&gt;I think that having entities that fit a similar role but have very different usage places a heavy conceptual burden. In Java arrays are really different from collections: they have a &lt;s&gt;nice&lt;/s&gt; ugly syntax (but at least they have one) and cannot be used in the same ways collections can. Have different methods, names, facilities. On the other hand, collections lack a literal syntax, which is something that makes them feel "first-class". C++ has basically the very same problem; however, the STL does a great job in normalizing access patterns between STL collections and regular arrays.&lt;/p&gt;
&lt;p&gt;Back to the main subject, I feel that Java actually lacks algorithmic code that eases manipulation of collections. In fact, the only "user-friendly" feature is the "for-each" statement. Other than that, code is very imperative and comparable with C code manipulating the same structures. Plus, Maps are really ugly because a first class tuple data-type is missing.&lt;/p&gt;
&lt;p&gt;Clojure, on the other hand, has plenty of functions to manipulate low level stuff. This is rather relevant as there is a lot of code that works at this level. Being able to write it quicky is very important. Moreover, using the correct abstractions, avoid bugs. Consider for example the map functions? In a col like&lt;/p&gt;
&lt;pre&gt;
(map f coll)
&lt;/pre&gt;
&lt;p&gt;there can be only one single point of failure: what f does on the single elements. There is no explicit looping, no offset problems, nothing. Consider for example the number of things that can go wrong imperatively writing a loop that calls a function on pairs of consecutive elements in a collection. Compare it with its functional equivalent:&lt;/p&gt;
&lt;pre&gt;
(let [coll (range 10)] (map + coll (rest coll)))
&lt;/pre&gt;
&lt;p&gt;Here nothing can go really wrong. It is easier to write and easier to understand (provided you know a bit of clojure). It is worth noting that real high level object oriented languages have almost this kind of abstraction. But hey, they also have FOF and LOL (first order functions and let ovel lambda -- actually, they do not have let, but the name doesn't matter, does it?). Besides, that kind of code may also be easier to parallelize (in the sense that the compiler could do it).&lt;/p&gt;
&lt;p&gt;Then comes class specific code. Object are great, fine. However, sometimes they are just used to group data together. In a sense, it makes sense. In Java there are no tuples, maps are ugly as hell and have the stupid requirement of type uniformity. Which means that either we abuse Object or we can't use them at all.&lt;/p&gt;
&lt;p&gt;As a consequence, many specific classes are created. They have no true purpose, but carrying around pieces of data together. And that is just the task for maps, tuples, vectors. Maps, tuples and vectors have a uniform interface, "do the right thing" regardless of the types (in a decently typed language -- new definition&amp;hellip; both static, e.g., Haskell, and dynamic, e.g., Clojure, Ruby, Python, languages can qualify! ). And there are plenty of functions to manipulate such stuff.&lt;/p&gt;
&lt;p&gt;I think that one of the clearest examples is the Python tuple. A tuple is not magic. Is not clever. It is simple. Still, while in Python functions return only single values, tuples in fact allow to simulate multiple return values. And that is something which is overly useful in many different situations. In Clojure vectors can be used with a similar meaning (in fact, Clojure vectors are quite similar to Python tuples). And the destructuring syntax is amazing (once again, both in Python and in Clojure).&lt;/p&gt;
&lt;pre&gt;
for k, v in some_map:
    do_something_with(k, v)
&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;
(for [[k v] some-map] (do-something-with k v))
(doseq [[k v] some-map] (do-something-with k v))
&lt;/pre&gt;
&lt;p&gt;
Amazingly enough, the set of orthogonal language features used in both languages is roughly the same. Consider that with using a
 Set[Map.Entry[K,V]] Map#getEntrySet method... here we have this new Entry class. And perhaps somewhere else we have a Pair class which basically does the same thing, but it is a separate type, with different methods and different usage patterns. In dynamic languages at least, as long as the signature of the methods is compatible, something could be saved... but in statically typed object oriented languages, good luck with that.
&lt;/p&gt;
&lt;p&gt;
I think these are some of the reasons I find especially pleasing writing algorithmic code in Python or Clojure and rather despise the very same thing in Java.
&lt;/p&gt;


&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/1GpIh-F9R4s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/99099234629732074/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=99099234629732074" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/99099234629732074?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/99099234629732074?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/1GpIh-F9R4s/java-and-clojure-how-data-structures.html" title="Java and Clojure - How data structures influence language usage" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2012/01/java-and-clojure-how-data-structures.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUHQnkzeyp7ImA9WhRXFk4.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-4474424759830355266</id><published>2011-12-23T10:23:00.000+01:00</published><updated>2011-12-23T10:23:53.783+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-23T10:23:53.783+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Common Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Algorithms" /><title>Does Clojure fix "Fundamental problems with the Common Lisp language (citation)"?</title><content type="html">I was looking for some Common Lisp libraries to implement an idea of mine. For lots of reasons I was considering not using Python or Clojure and going directly with Common Lisp (in fact, I think it is going to be Scheme... but it is hard to tell).&lt;br /&gt;
&lt;br /&gt;
As it often happens when following semi-random links on Google, I stumbled on something quite interesting:&lt;br /&gt;
&lt;a href="http://ilc2009.scheming.org/node/7" target="_blank"&gt;Fundamental problems with the Common Lisp language&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Nothing extremely new, indeed. The only point that really surprised me was the "hard to compile efficiently" thing. I would have said that in general SBCL is a pretty fast environment. Not as fast as C++, perhaps not even as Java (but I believe that this depends from the specific benchmarks used), but still fast.&lt;br /&gt;
&lt;br /&gt;
However I was mostly interested in the other claimed problems:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Too many concepts; irregular&lt;/li&gt;
&lt;li&gt;Hard to compile efficiently&lt;/li&gt;
&lt;li&gt;Too much memory&lt;/li&gt;
&lt;li&gt;Unimportant features that are hard to implement&lt;/li&gt;
&lt;li&gt;Not portable&lt;/li&gt;
&lt;li&gt;Archaic naming&lt;/li&gt;
&lt;li&gt;Not uniformly object-oriented&lt;/li&gt;
&lt;/ol&gt;
May seem like a lame argument... but I think that clojure actually addresses all the problems but number 2 and 3. Please notice that I'm not claiming that clojure is a memory hog or that it is slow. Simply put, right now my impression is that common lisp is still faster than clojure. I believe that this is due to Clojure being an additional layer over Java. Java is itself probably marginally faster than SBCL (though your mileage may vary). With marginally faster I mean that really depends on what you are doing and one or the other may result faster.&lt;br /&gt;
&lt;br /&gt;
Alioth benchmarks are, like all benchmarks, not extremely relevant. Still, this is my general impression. SBCL does a wonderful job, in that CL is much higher level than Java and there are many more engineers optimizing the JVM. However, Clojure takes its toll, in that, according to my tests (and to alioth as well) there is quite a lot of work to do to make it catch up with Java.&lt;br /&gt;
&lt;br /&gt;
Probably for high level stuff or specific problems (where in Java there would be essentially some part of clojure runtime/libraries to be re-implemented) they are on par.&lt;br /&gt;
&lt;br /&gt;
About the memory, my feeling is that JVM is a rather memory intensive business, and Clojure can't do much about it. E.g., Python programs usually run using much less memory when confronted with similar data-sets.&lt;br /&gt;
&lt;br /&gt;
I'm not saying that we should drop CL and switch to clojure. However, I believe that clojure addressed some of the problem that many (some?) in the CL community feel CL has.&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/VzjDyMnA8T4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/4474424759830355266/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=4474424759830355266" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/4474424759830355266?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/4474424759830355266?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/VzjDyMnA8T4/fundamental-problems-with-common-lisp.html" title="Does Clojure fix &quot;Fundamental problems with the Common Lisp language (citation)&quot;?" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/12/fundamental-problems-with-common-lisp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MERXk_cSp7ImA9WhRQGUk.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-8250500985302874531</id><published>2011-12-15T10:30:00.000+01:00</published><updated>2011-12-15T10:30:04.749+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-15T10:30:04.749+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="IntelliJ" /><category scheme="http://www.blogger.com/atom/ns#" term="PyCharm" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Better toys for us programmers</title><content type="html">Today PyCharm 2.0 is out. A couple of days ago, the last version of IntelliJ (11) was released as well.&lt;br /&gt;
&lt;br /&gt;
I'm somewhat reluctant to discuss the matter here; I'm not a free software integralist by any means (like for example posting from a beautiful MacBook Air, with OS X), still when discussing commercial software I feel a vague sense of guilt because I feel like I am doing advertisement. This is especially true as most of the times there it does not involve only reporting &lt;i&gt;facts&lt;/i&gt;&amp;nbsp;(which would be acceptable, as the truth tends to be true, even if in favor of a commercial entity) but &lt;i&gt;impressions&lt;/i&gt;, which could make me seem biased.&lt;br /&gt;
&lt;br /&gt;
These are the most interesting improvements I found in PyCharm/IntelliJ (it should be clear when stuff applies only to one of the two -- and amazingly enough, the what's new page on PyCharm is more detailed):&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Support for pypy (this is going to be immensely important for me, as I'm planning to move part of my development environment on pypy)&lt;/li&gt;
&lt;li&gt;Support for ipython (more on this later)&lt;/li&gt;
&lt;li&gt;Cython support (which may be something I'll be using soon enough)&lt;/li&gt;
&lt;li&gt;Git graphs (been a bit of a PITA lately to remember the proper log options to have them in the console, my memory ain't what it used to be)&lt;/li&gt;
&lt;li&gt;Gist support (I love that)&lt;/li&gt;
&lt;/ul&gt;
There is more. I did not even realize that before it was not there... but for example now PyCharm completes the keyword arguments in Python stuff. Which is extremely nice, in my opinion. And also the refactorings seem to work more accurately.&lt;br /&gt;
&lt;br /&gt;
Eventually, I want to point out a feature I was sorely missing in all environments I tried, i.e., choosing the method to step into when debugging. First, I'm not the kind of guy that spends lots of time in the debugger (see., that would be a clear smell on the quality of my unit tests). But when I do, I often feel rather boring having to walk step by step irrelevant code.&lt;br /&gt;
&lt;br /&gt;
Consider this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;my_object.that_is_some_method(
    ILuvDIP(...), self.that_is_interesting(), self.may_be_a_property)
&lt;/pre&gt;
&lt;br /&gt;
and suppose that I feel the bug is in that_is_interesting. Now, it may well be that my Python debugging skills are not excellent. Afterall only recently I stopped instrumenting my code with prints and always use a proper debugger. Before that I relied almost only on unittests and prints.&lt;br /&gt;
&lt;br /&gt;
Before PyCharm 2, it was hard to step into that_is_interesting and not in ILuvDIP. I believe that the same logic also applies to Java and IntelliJ and hopefully to Clojure. Then, back to us.&lt;br /&gt;
&lt;br /&gt;
I really ain't lots of problems with IntelliJ. I feel that an IDE is a very valuable asset when developing Java. In fact, I would say it is a PITA to do without. Perhaps with Emacs and some modules like JDEE. Still, I don't know... I try to avoid Emacs these days (as I'm finding vi more and more natural to me).&lt;br /&gt;
&lt;br /&gt;
The question is more interesting regarding Clojure and Python (and Ruby...). Probably if I would use Django a lot, PyCharm would be a clear winner. Support is awesome and you have to work in a frameworkish way in any case. There is nothing wrong with that, of course.&lt;br /&gt;
&lt;br /&gt;
These days I'm mostly writing library/algorithmic code in Python. And I feel like ipython+vim is a great tool here. It's got an almost Mathematica/Matlab vibe that is nice for what I'm doing. I also try using that approach with Clojure more often than not. Tests as documentation and specification, REPL as an integrated development environment. It is possible that with ipython builtin in PyCharm I could just move that workflow to PyCharm itself.&lt;br /&gt;
&lt;br /&gt;
There is however, the issue of code complete. Emacs fares pretty well to complete Clojure, but as far as I remember is not so good regarding completing Java (perhaps I should have installed JDEE). As a consequence, I used IntelliJ a lot even with Clojure.&lt;br /&gt;
&lt;br /&gt;
Recently, I started exploring Clojure+vim too. And it is a wonderful world. I have most of what I need and it is extremely lightweight. I have to investigate the issues further. However, IntelliJ remains a solid environment for Clojure development.&lt;br /&gt;
&lt;br /&gt;
Now the essential question is... I quite need IntelliJ for Java. And having it working with Clojure is a big plus (even if maybe not a strict necessity). But should I buy a separate PyCharm or just rely on IntelliJ plugin?&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/nmhJdthVYBs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/8250500985302874531/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=8250500985302874531" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8250500985302874531?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8250500985302874531?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/nmhJdthVYBs/better-toys-for-us-programmers.html" title="Better toys for us programmers" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/12/better-toys-for-us-programmers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4GRnY5cSp7ImA9WhRQFkQ.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-8113165400561193441</id><published>2011-12-12T14:52:00.001+01:00</published><updated>2011-12-12T14:52:07.829+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-12T14:52:07.829+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Object Oriented Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Functional Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Freedom Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Common Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="Declarative Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Lisp" /><category scheme="http://www.blogger.com/atom/ns#" term="Erlang" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Haskell" /><title>Erlang and OTP in Action (review)</title><content type="html">&lt;p&gt;First time I got into Erlang, it was with &lt;a href="http://www.amazon.com/Programming-Erlang-Software-Concurrent-World/dp/193435600X%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D193435600X"&gt;"Programming Erlang: Software for a Concurrent World" (Joe Armstrong)&lt;/a&gt;. It is a very nice book, in my opinion, and I enjoyed immensely reading it. That was like 4 years ago or something. Back then, the functional revolution was just at the beginning: no widespread Scala, no Clojure at all, essentially no F#. Back then it looked like OO was going to rule the industry for years and years, with no contender of sort. Rails was fresh, Django was fresher (back then the APress book was just being released).&lt;/p&gt;
&lt;p&gt;I bought the book because I wanted to see this "brand new" technology (20 year old, but just going to make it through in the circles I did frequent). And really, the language looked like 20 years old. Full of Prolog legacy, Unicode who's that guy? and so on. However, it no other piece of software I knew could as easily. Massive concurrency, hot swapping code. Wow.&lt;/p&gt;
&lt;p&gt;The language, I did not especially like. The runtime… WOW! As a language, I love Python or Clojure because the way apparently distant functionalities work together and create something even more beautiful. Erlang does not have that at language level. It has at a framework level.&lt;/p&gt;
&lt;p&gt;Think about hot swapping code in an object oriented software. First, I somewhat believe that object oriented modules are somewhat more tangled that functional equivalents. Partly because of the object reuse OO promotes (that can really be against you if you want to swap code). Then, there is the whole problem of references vs. addresses. Addresses have an additional level of indirection that makes it far easier to swap a process than it is to swap an object.&lt;/p&gt;
&lt;p&gt;But the very idea that state is in the function parameters and that process linking and easy restarting thing are at the very root of how easy it is to swap code in Erlang. But then… back to the books.&lt;/p&gt;
&lt;p&gt;The essential problem was that after seeing a bit of Erlang, I thought OTP was not a big deal. Yes, it is easier to use. But also plain Erlang is. And I convinced myself that should I need Erlang, I could just use plain Erlang. Than things changed: I read some OTP using code and I understood not so much of it. That was this year. What I understood, was that it could be helpful. I had to write a concurrent prototype and I welcomed the idea not to write as much code as possible.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;In the meantime, I forgot many things about Erlang. In this situations, instead of reading the same book twice, I buy another book to gain perspective. So I decided to buy another book. One of the candidates was &lt;a href="http://www.amazon.com/ERLANG-Programming-Francesco-Cesarini/dp/0596518188%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596518188"&gt;"ERLANG Programming" (Francesco Cesarini, Simon Thompson)&lt;/a&gt;. It also had excellent reviews. Essentially I believe it contains more material than Armstrong's book and is also a bit more recent. However, as far as I understand, is still a bit terse on OTP.&lt;/p&gt;
&lt;p&gt;As a consequence, I bought &lt;a href="http://www.amazon.com/Erlang-OTP-Action-Martin-Logan/dp/1933988789%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1933988789"&gt;"Erlang and OTP in Action" (Martin Logan, Eric Merritt, Richard Carlsson)&lt;/a&gt; instead. And I'm very happy of this choice. It complements Armstrong's book well and extensively covers OTP. In fact, I also believe that the approach is very interesting. Introduce OTP first and learn to use it, then when you know what it can do, you are going just to use that. Then, learn plain Erlang in order to extend OTP when your use case is not covered. And a nice plus was a detailed description of JInterface, which I could need as well.&lt;/p&gt;
&lt;p&gt;In fact, I do think that as it may make sense to introduce objects as early as possible in a book on an object oriented language, starting with OTP is a very big plus from a learning perspective. Then perhaps the point is that I did not need to get into a functional mindset (which I think Armstrong book does with more attention.&lt;/p&gt;
&lt;p&gt;If the question is however just "learn to think functionally" I believe that &lt;a href="http://www.amazon.com/Joy-Clojure-Thinking-Way/dp/1935182641%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1935182641"&gt;"The Joy of Clojure: Thinking the Clojure Way" (Michael Fogus, Chris Houser)&lt;/a&gt;, &lt;a href="http://www.enrico-franchi.org/2011/08/excellent-learn-you-haskell-for-greater.html"&gt;LYHFGG&lt;/a&gt; or &lt;a href="http://www.enrico-franchi.org/2010/12/land-of-lisp-part-1.html"&gt;Land of Lisp&lt;/a&gt; are probably better alternatives. Another interesting one is &lt;a href="http://www.amazon.com/Functional-Programming-Java-Developers-Concurrency/dp/1449311032%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1449311032"&gt;"Functional Programming for Java Developers: Tools for Better Concurrency, Abstraction, and Agility" (Dean Wampler)&lt;/a&gt;, even if it has a whole different perspective.&lt;/p&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/bfKDu9Jq4oI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/8113165400561193441/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=8113165400561193441" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8113165400561193441?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/8113165400561193441?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/bfKDu9Jq4oI/erlang-and-otp-in-action-review.html" title="Erlang and OTP in Action (review)" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/12/erlang-and-otp-in-action-review.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YBRXsyfip7ImA9WhRQFU0.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-549212680052598718</id><published>2011-12-07T10:00:00.000+01:00</published><updated>2011-12-10T10:25:54.596+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T10:25:54.596+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scala" /><category scheme="http://www.blogger.com/atom/ns#" term="xUnit" /><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="IntelliJ" /><category scheme="http://www.blogger.com/atom/ns#" term="Ruby" /><category scheme="http://www.blogger.com/atom/ns#" term="LLVM" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Good and not so good reasons to learn Java (or any other language) [part 2.5]</title><content type="html">So this is the third part after the &lt;a href="http://www.enrico-franchi.org/2011/11/good-and-not-so-good-reasons-to-learn.html" target="_blank"&gt;not so good reasons to learn Java&lt;/a&gt; and the &lt;a href="http://www.enrico-franchi.org/2011/12/good-and-not-so-good-reasons-to-learn.html" target="_blank"&gt;other good reasons&lt;/a&gt; to do it.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Java could be fun&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Really. There is some stuff that is really nicely done. I like Akka, for example. And I find the idea of hacking with assertion really funny. It is a totally different approach to meta-programming that I really liked. I also like Antlr... after that every other library for imperative/oo-languages to build parsers seemed primitive.&lt;br /&gt;
&lt;br /&gt;
There is some nice stuff in the Python world as well (and yeah, in Lisp you have Lisp and Haskell has wonderful stuff to). But I can tell: implement a language in Java and in C++. In Java you will be finished so much earlier... of course, other languages are faster too. But your team may not include other Haskell hackers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Libraries, libraries, libraries&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In Java there is a library for everything. Quite often, they are very well done, even if somewhat over-engineered. Probably my idea of over-engineering is a bit extreme (it comes from having seen lots of lean languages). But really, they are robust and well tested.&lt;br /&gt;
&lt;br /&gt;
Moreover, Java is usually efficient enough to be a decent contendant for more demanding tasks.. Maybe C/C++ can be avoided for your application (and Java libraries are usually easier to use than C++ ones).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Java as an intermediate level platform&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Say you are interested in language design. As far as I can see, you have few choices.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Write your own runtime, vm, etc. That was the "old" approach (Python, Ruby)&lt;/li&gt;
&lt;li&gt;Implement your language on the top of a Lisp[0] or Prolog[1] interpreter&lt;/li&gt;
&lt;li&gt;Use LLVM&lt;/li&gt;
&lt;li&gt;Use JVM&lt;/li&gt;
&lt;li&gt;Use CLR/Mono&lt;/li&gt;
&lt;/ul&gt;
I would rule out the latter, because I don't do any windows. Between LLVM and JVM as far as I understand it may depend on the language. JVM has a few quirks (who said lack of TCO?), but has plenty of available documentation, real world examples (Scala &amp;amp; Clojure),&amp;nbsp;&lt;a href="http://www.enrico-franchi.org/2011/02/java-epic-fail.html" target="_blank"&gt;a large number of developers working for the well-being of the plarform&lt;/a&gt;, and a huge amount of libraries, libraries, libraries you may want to use.&lt;br /&gt;
&lt;br /&gt;
LLVM is probably going to be faster, though. And has lots of optimizations and stuff for static languages. In any case, to make an informed choice, you need to know Java&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tools (IDEs, Maven, Ant)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
IDEs are the bless and the curse of Java. After having used for sometime IntelliJ I really feel that the amount of functionality that IDEs for other languages offer is puny. The possible exception is Emacs for Lisps.&lt;br /&gt;
&lt;br /&gt;
The funny thing is that I'm not an IDE gui. However, really, when you do refactoring (even simple stuff like moving functions and files around) it is an invaluable time-saver. I miss vim as a text manipulating programming language, but still... for Java IDEs are almost necessary.&amp;nbsp;&lt;i&gt;And&lt;/i&gt;&amp;nbsp;not only bridge part of the gap with other languages, they have lots of useful stuff.&lt;br /&gt;
&lt;br /&gt;
Regarding Maven... well, I just like it. I also like the fact that I'm able to build IntelliJ projects from Maven scripts is wonderful. And also Ant is a very good tool (although rather over-engineered). My humble opinion is that Ant is far easier to use than the whole autotools company. This may also have something to do with the fact that the whole Java deploy process is easier.&lt;br /&gt;
&lt;br /&gt;
In any case, the point here is not how cool is Maven. Developers from other platform may want to know what is boiling up in Java-land. Sometimes we have sub-par tools and we do not even know it. Of course quite often Java tools fix "Java problems" that are different from the ones we have in other languages. Sometimes not.&lt;br /&gt;
&lt;br /&gt;
E.g., the design of Maven could inspire similar tools for the other platform. Both for its strengths and for its weaknesses (to avoid them, of course).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Learn "classical" threads&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ah, this is weak. However, other languages have a "threading" module that is heavily inspired by the way Java does threading. I don't particularly like it, but being familiar with it may be a very good idea. As far as I can tell, is also what most people have in mind when thinking about threading. Who am I to say that they are wrong? I can just tell them there is better stuff.&lt;br /&gt;
&lt;br /&gt;
And yes, pthreads are even more a PITA.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Find Java in other languages. Sometimes.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is basically the extended version of the older argument. Java is hugely popular. Many "new" things are created in Javaland, and then are ported to other platforms. Or perhaps are not &lt;i&gt;created&lt;/i&gt;&amp;nbsp;but became first popular inside the Java community.&lt;br /&gt;
&lt;br /&gt;
For example, xUnit libraries are available everywhere, but I think that most people first started working with it in Java. Some of the authors of the original Smalltalk library actively work on JUnit, etc etc etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
I do not think that Java is particularly good. Not particularly bad, either. It is not the kind of enlightening language Scheme is. It is not easy to use and predictable like Python. However, its popularity may make it unwise not to learn it. Especially for communication reasons:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Books&lt;/li&gt;
&lt;li&gt;Other developers (talking about OOP, libraries)&lt;/li&gt;
&lt;li&gt;New ideas brewed in Javaland&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
wow... that's it. ;)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
[0] Scheme, Clojure, Common Lisp...&lt;br /&gt;
[1] Erlang was created this way, even if now it has its own (wonderful) runtime&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/sNd2iGFsZeM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/549212680052598718/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=549212680052598718" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/549212680052598718?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/549212680052598718?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/sNd2iGFsZeM/good-and-not-so-good-reasons-to-learn_07.html" title="Good &lt;s&gt;and not so good&lt;/s&gt; reasons to learn Java (or any other language) [part 2.5]" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/12/good-and-not-so-good-reasons-to-learn_07.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cBR30_fCp7ImA9WhRQFU0.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-2131399293716582364</id><published>2011-12-03T10:00:00.000+01:00</published><updated>2011-12-10T10:24:16.344+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-10T10:24:16.344+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Scala" /><category scheme="http://www.blogger.com/atom/ns#" term="Object Oriented Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Ruby" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><title>Good and not so good reasons to learn Java (or any other language)[part 2]</title><content type="html">So this is basically the second part of "&lt;a href="http://www.enrico-franchi.org/2011/11/good-and-not-so-good-reasons-to-learn.html" target="_blank"&gt;Good and not so good reasons to learn Java&lt;/a&gt;".&lt;br /&gt;
&lt;br /&gt;
And here I will discuss the &lt;i&gt;good&lt;/i&gt; reasons to learn Java. Some of them...&lt;br /&gt;
I decided to split this in two posts. The &lt;a href="http://www.enrico-franchi.org/2011/12/good-and-not-so-good-reasons-to-learn_07.html" target="_blank"&gt;next one&lt;/a&gt; will be published in a few days.&lt;br /&gt;
&lt;br /&gt;
If you know me a bit, you probably know that I do not like Java particularly. In fact I found out that the essential problem is with Java being presented as something modern or "superior". It is not. However, it did something very good in the software environment (a part from electing over-engineering as a form of art): many technology that were outside the mainstream and was dubbed slow (garbage collector) are now widely accepted and that is partly because of Java. This is no reason to learn Java, though.&lt;br /&gt;
&lt;br /&gt;
Moreover, my opinion is that Java is not a good first language. It is not a good second language either. However, after learning a high level language like Python or Ruby, a couple of functional languages (maybe Clojure and Haskell or Scheme and Scala) and something lower level, such as C, well... learning Java it could be a very good idea.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Lots of interesting stuff runs on the JVM&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Yes... I'm talking about Clojure and Scala. And perhaps JRuby too. Sometimes understanding the underlying platform helps understanding some design choices. Moreover, there is stuff (e.g., in Clojure) that has not yet a fully clojurized variant and we have to use Java stuff.&lt;br /&gt;
&lt;br /&gt;
Knowing Java is a plus, of course.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Lots of interesting books deal with Java&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I'm not talking here about the wonderful Effective Java or Java Puzzles. They are great Java books, of course. And some suggestions may also apply to other languages. Still, if you are not interested into Java, you may miss them.&lt;br /&gt;
&lt;br /&gt;
No, I'm talking about other great books...&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0132350882"&gt;Clean Code&lt;/a&gt; and &lt;a href="http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0135974445"&gt;Agile Software Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0131495054"&gt;xUnit Test Patterns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/Analysis-Patterns-Reusable-Object-Models/dp/0201895420%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0201895420"&gt;Analysis Patterns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0201485672"&gt;Refactoring&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321127420"&gt;Patterns of Enterprise Application Architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596007124"&gt;Head First Design Patterns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.amazon.com/Functional-Programming-Java-Developers-Concurrency/dp/1449311032%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Drik-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1449311032"&gt;Functional Programming for Java Developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;li&gt;Here the list could be really long...&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Some of them are not entirely in Java and some have non-Java alternatives. Still &lt;i&gt;reading&lt;/i&gt; Java is a huge plus in reading those books. I believe part of the reason is that:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Java is like a common-denominator object oriented language&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Forget the Java platform. Consider just the language. Essentially Java is really a common-denominator of other object oriented language. Other languages typically offer &lt;i&gt;more&lt;/i&gt;. Are more dynamic, offer more powerful type-systems, more expressive constructs.&lt;br /&gt;
&lt;br /&gt;
Just thing about the OOP building blocks. Here we are talking about the mis-interpreted OOP as a matter of types vs. a matter of messages. That is what most people think about when referring to OOP. Unfortunately, as I said.&lt;br /&gt;
&lt;br /&gt;
Java has those. But does not have much more. If you want to design OO stuff, Java gives you the building block, but does not stand above offering higher level construct. Think about Python or Ruby or Lisp... their OO facilities are so superior (plus they typically offer stuff outside the OOP model -- well, Lisp is so much more than an OO language...) that you are probably going to design stuff differently. Probably you are not going to over-engineer stuff.&lt;br /&gt;
&lt;br /&gt;
Modifications are cheap. Abstractions are easy. And of course you can go outside the OO model when it makes sense.&lt;br /&gt;
&lt;br /&gt;
On the other hand in Java you cannot. You can just get back at a procedural level, which is clearly inferior. The best thing you can do in Java is try to be as OO as possible: other choices usually do not pay.&lt;br /&gt;
&lt;br /&gt;
As a consequence:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Java is a great language to expose those "ill-conceived OOP" concepts that are used in every other language where ill-conceived OOP techniques are used.&lt;/li&gt;
&lt;li&gt;Java is a great language to truly learn to program like an object-oriented zealot&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
Please notice that I consider the latter a very good thing. It is a very good exercise that lets you understand the merits and the drawbacks of the paradigm. Probably when you think that something really sucks in Java, you hit a limit of OOP in a static language. Other languages may make that easier, but the wall is still there.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Java is good to learn "good OOP" too&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Yes! As I already said there is a lot of smart people working with Java. They have already discovered and taught how to do "good" OOP in Java. You should learn it too.&lt;br /&gt;
&lt;br /&gt;
Then, when using a different language things could only be easier. Some of the techniques you learned may be useless, because the language offers better abstractions. Still you will have a pretty clear understanding of what such abstractions are doing and perhaps you may develop a feeling for when not to use them.&lt;br /&gt;
&lt;br /&gt;
As a matter of fact, too much magic is bad, even if it may seem cool. While sticking too much to simple things may actually complicate the design in the long run (meta-programming leads to code that you do not write and that is the only kind of code that needs no debugging or testing or maintenance, as it does not exist), too much magic has the same effect at the opposite position of the spectrum.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Avoid writing Java in other languages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you know Java, at a certain point you may discover you would be writing much the same code if you were using Java. If the language you are using is C++, you probably have done something wise: chosen a restricted subset of C++ and used that one (than we may argue if you actually left out good stuff).&lt;br /&gt;
&lt;br /&gt;
However, if you are using Python or Ruby, or, worse, Clojure, then you are writing awful code. $x code is not meant to be structured like Java. If it does, you are not using the language well. This is basically a side effect of "&lt;i&gt;Java is like a common-denominator object oriented language&lt;/i&gt;".&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/wLGZnIrJQYI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/2131399293716582364/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=2131399293716582364" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2131399293716582364?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2131399293716582364?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/wLGZnIrJQYI/good-and-not-so-good-reasons-to-learn.html" title="Good and not so good reasons to learn Java (or any other language)[part 2]" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/12/good-and-not-so-good-reasons-to-learn.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEGQ3Yzeip7ImA9WhRRGU8.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-2089304051938765570</id><published>2011-11-26T21:03:00.001+01:00</published><updated>2011-12-03T16:53:42.882+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-03T16:53:42.882+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Object Oriented Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Java" /><category scheme="http://www.blogger.com/atom/ns#" term="Django" /><category scheme="http://www.blogger.com/atom/ns#" term="Freedom Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Ruby" /><category scheme="http://www.blogger.com/atom/ns#" term="Erlang" /><category scheme="http://www.blogger.com/atom/ns#" term="Python" /><category scheme="http://www.blogger.com/atom/ns#" term="Clojure" /><category scheme="http://www.blogger.com/atom/ns#" term="Haskell" /><title>Good and not so good reasons to learn Java (or any other language)</title><content type="html">The first thing to consider is there is really not such a thing like a reason &lt;i&gt;not to learn&lt;/i&gt;&amp;nbsp;a programming language. Or better, there is only one reason: lack of time. Learning a language is a tricky business[0]. Learning to use a whole platform is way trickier.&lt;br /&gt;
&lt;br /&gt;
Please notice that some of the reasons presented here are general enough to be applied to &lt;i&gt;any&lt;/i&gt;&amp;nbsp;programming language (especially the bad reasons to learn a language). Others are specific of Java (especially the reasons to learn it).&lt;br /&gt;
&lt;br /&gt;
Also keep in mind that the &lt;i&gt;good&lt;/i&gt;&amp;nbsp;reasons to learn Java will be presented in &lt;a href="http://www.enrico-franchi.org/2011/12/good-and-not-so-good-reasons-to-learn.html" target="_blank"&gt;another post&lt;/a&gt; because this one is becoming far to long to be readable in the few minutes I feel entitled to ask you, dear reader. So believe me... you probably &lt;i&gt;should&lt;/i&gt;&amp;nbsp;learn Java. Still, not for the reasons I list here.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Not so good reasons to learn Java&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is widespread&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You may be lead to think that since Java is a very widespread language, it is easier to find jobs if you know it. In the case of Java there is the question that I am convinced that it is not a bad thing to know Java and that can have pleasant effect on finding jobs (more on that later), still I would not consider it a &lt;i&gt;good&lt;/i&gt;&amp;nbsp;reason to learn Java.&lt;br /&gt;
&lt;br /&gt;
Learning a widespread language means more jobs and more applicants. What really matters is the ratio between jobs demand and offer. And usually for very widespread languages it is not always very high. Skilled, experienced and "famous" developers do not care much. The others should.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is object oriented&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This and the variant "it is &lt;i&gt;more&lt;/i&gt;&amp;nbsp;object oriented" are clearly wrong reasons. There is plenty of good object oriented languages. And it is rather hard to decide which is &lt;i&gt;more&lt;/i&gt;&amp;nbsp;object oriented (lacking function looks more like a wrong design decision than a clue of being &lt;i&gt;more&lt;/i&gt;&amp;nbsp;object oriented).&lt;br /&gt;
&lt;br /&gt;
Besides, I'm not even sure that being &lt;i&gt;more&lt;/i&gt;&amp;nbsp;object oriented is good (or bad for what matters). Well... not sure that being object oriented is inherently good either. Maybe in ten years the dominant paradigm will be another. Maybe in two. Three years ago "functional programming" was murmured in closed circles and outsiders trembled in fear at its very sound.&lt;br /&gt;
&lt;br /&gt;
No, joking. Most people thought that "functional" meant having functions (and possibly no objects) and thought about C or Pascal. They did not know it was about &lt;i&gt;not having crappy functions&lt;/i&gt;. Yeah, more than that, of course, but that's a start.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is a good functional language&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Just checking if you were reading carefully...&lt;br /&gt;
That is a bad reason because it is not true!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is fast/slow&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Oh, come on! Java implementations are decently fast, faster than most other language implementations out there and usually slower than implementations of languages such as C, C++, Fortran. Still, for some specific things it may be nearly as fast or faster. Sometimes it is not only CPU efficiency that matters.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is good for concurrency&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The "classic" Java threading model sucks. It's &lt;i&gt;old&lt;/i&gt;. Nowadays other ways of doing concurrency are better (more efficient, easier to use).&lt;br /&gt;
&lt;br /&gt;
Such more efficient easier to use methods are built-in in languages such as Clojure (or Scala, or Erlang). Still, Java is probably the most supported platform in the world. Such concurrency models are not &lt;i&gt;inside&lt;/i&gt;&amp;nbsp;the language, but you may have them using libraries.&lt;br /&gt;
&lt;br /&gt;
Sometimes this is a real PITA (language support is a great thing, because the syntax is closer to the semantics).&lt;br /&gt;
&lt;br /&gt;
Moreover having the "older" concurrency model visible may be a problem with the newer stuff. And some other libraries and frameworks may just assume you want to do things the old way.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It is good for the web&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ok... most people do not even know how widespread is Java on the web. In fact, it is. But is it &lt;i&gt;really good?&lt;/i&gt;&amp;nbsp;I do not really think so. There is lots of good stuff in Java world for the web, of course. The point is that there is also for other platforms. Here Rails and Django spring to mind.&lt;br /&gt;
&lt;br /&gt;
Moreover, there is loads of extremely cool stuff coming from the functional world. Erlang and Haskell have some terrific platforms. Scala and Clojure also have some extremely interesting stuff &lt;i&gt;and &lt;/i&gt;can leverage mature Java stuff but make it really easier to use.&lt;br /&gt;
&lt;br /&gt;
Grails (web framwork) may seem on the same wavelength, still I think there is a very important difference.&amp;nbsp;First, I don't like Groovy at all. In fact Groovy very author says that he would not have created it if he knew Scala. And of course since I do not like Groovy, I do not see why I should be using Grails, which, as far as I know, does not offer killer features over Rails or Django.&lt;br /&gt;
&lt;br /&gt;
Scala and Clojure are different. They are not just "easier" than Java. They teach a different way of thinking and approaching development. And of couse, they are great for the web also.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;I already know it a bit&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is quite an interesting point. Why, if you know a language a little, shouldn't you learn it well? This essentially makes it clear the difference between a &lt;i&gt;not so good reason&lt;/i&gt;&amp;nbsp;to learn something and a reason &lt;i&gt;not to learn it&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
The point is simple: if you are interested in learning Java (for the good reasons), do it. But from knowing a language "a bit" and knowing it "well" there is quite the same distance that from not knowing it and knowing it well. So don't do it because you think your prior experience may be extremely relevant.&lt;br /&gt;
&lt;br /&gt;
There are languages which are just easier to master (where easier means that to learn them from scratch it takes less time that to become as proficient in Java as you would learning those languages -- yeah, Python, Ruby, [1]...)&lt;br /&gt;
&lt;br /&gt;
Besides, I feel that the second step in Java is rather hard. I think that Java is very easy to learn for experienced developers (it is not a joke). The very first step in Java is relatively easy (a part from lots of useless crap like having to declare a class to put there a static main method and overly complicated streams). The step just after that, the one that takes you from writing elementary useless programs to writing elementary useful programs is quite harder, since lots of useful stuff in Java requires to understand OO principles quite well to be used without too many surprises.&lt;br /&gt;
&lt;br /&gt;
So, you may have learnt Java at the college. Still, if you to hack something and "grow" there are languages that let you do it faster (Python or Ruby).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;I have to&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is the worse possible reason because I don't see the spark in it. You have to. You probably are an experienced developers that got bored to death reading this post, you did not know Java and you have to learn it. Maybe your boss wants you to do some Java.&lt;br /&gt;
&lt;br /&gt;
I'm sorry for you. Java is not easy to learn (especially to learn it at the point you can work with it). Mostly because everybody has been doing Java in the last fifteen years. Smart people and dumb people.&lt;br /&gt;
&lt;br /&gt;
As a consequence there are truly spectacular pieces of software it is a pleasure to work with and worthless pieces of over-engineered crap. I truly hope that you are going to work with the great stuff.&lt;br /&gt;
&lt;br /&gt;
Still I consider a "bad reason" to learn a language, because you are probably not going to enjoy the learning process. If you were, you would have used a different sentece... like "I want to".&lt;br /&gt;
And perhaps the thing would have been "My boss gives me the opportunity to increase my professional assets learning this new technology, Java".&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;It was easier to download/find a book/my cousin knows it.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most popular reasons people pick up a language is because they find it installed on their system. That is not usually the case for Java, in the sense that usually the JDK is &lt;i&gt;not&lt;/i&gt;&amp;nbsp;installed, even if the VM is. Variants of this argument are a friend proficient in the language or, more frequently, availability of books at the local bookstores. This kind of arguments usually apply for complete programming beginners or people who had prior experience that has not been refreshed for years (e.g., old Basic programmers).&lt;br /&gt;
&lt;br /&gt;
It is true that it is easy to find manuals for Java. The point is that not every manual is a good starting point. Specifically, this kind of user really needs a manual targeted at a true beginner. Unfortunately, that is the category of books where more craps piles. First beginners usually do not really understand if the manual they are using is crap.&lt;br /&gt;
&lt;br /&gt;
If their learning process is too slow (supposed that they see it) they usually blame: (i) programming in general, (ii) the language or, worse (iii) themselves. Well, the language may have its faults (especially in the case of Java, still C++ is worse for a beginner), but it is important to understand that the culprit is usually the manual.&lt;br /&gt;
&lt;br /&gt;
The funny thing is that the people who know how to tell apart a good manual from a bad one are usually the ones that do not really need an introductory book, are probably not going to buy it and more often than not are not enquired about a good manual. So unless their cousin is actually a skilled programmer, beginners are really risking buying a bad manual. And please, notice that even skilled programmers are susceptible to a similar argument: if you are interested in a new language and you read a terrible manual you may build a wrong opinion on the language (and perhaps you are not interested in spending another 40 gold coins to convince you that the language is really bad).&lt;br /&gt;
&lt;br /&gt;
So please: read reviews on Amazon (or similar site -- notice that I'm not going to suggest to buy from Amazon, even if I often do &lt;i&gt;and&lt;/i&gt;&amp;nbsp;I am an associate -- here I'm just saying that the amount of reviews on books on Amazon -- com -- is usually large enough to make an idea). Find people that are experts &lt;i&gt;and&lt;/i&gt;&amp;nbsp;have teaching experience: their reviews are probably the one to base the judgment upon. Then buy the book from whatever source you want.&lt;br /&gt;
&lt;br /&gt;
So do not buy a Java book because you can find books on Java and not on Clojure[2]/Python/Ruby/Whatever[3]. Choose the language (this is hard), choose the book (this is easier), buy, read it, study it, code code code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;ol start="0"&gt;
&lt;li&gt;I kind of found out that for people really convinced that learning a language is easy one or more of the following apply: &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;have an unmotivatedly high opinion of their knowledge of the languages they claim to have learned&lt;/li&gt;
&lt;li&gt;have a very inclusive definition of "learning" a language (e.g., writing hello world in it)&lt;/li&gt;
&lt;li&gt;only know and learn very similar languages (really, if you know C++ it's gonna be relatively easy to pick up Java, if you know Scheme probably Clojure is not going to be a big deal, etc.)&lt;/li&gt;
&lt;li&gt;and tend to write "blurb" in every language they know (so for example they write Python as if it was C++ -- and usually are very surprised when things go badly)&lt;/li&gt;
&lt;/ol&gt;
Of course there is also a lucky minority for which learning languages is very easy.&lt;/li&gt;
&lt;li&gt;It is funny that I am suggesting to learn only "object oriented dynamic" languages such as Python or Ruby. I understand that many advocates of functional programming may disagree. But I somewhat think that while some kind of people greatly benefit from learning a functional language as the first language they truly master, many others are just not fit for functional programming because it is too abstract and working imperatively may be easier for them. As a consequence, languages such as Python or Ruby may naturally lead you towards functional programming if it is the kind of stuff you like, but are still usable if you are not that kind of person. I have seen things...&lt;br /&gt;
And yes... if you are the kind of person that likes functional programming, you will get into functional programming sooner or later. This is just a bit later.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Notice Clojure here...&lt;/li&gt;
&lt;li&gt;Whatever is not a language. Still, it would be a great name for a language. Maybe not.&lt;/li&gt;
&lt;/ol&gt;&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/i490AISRy0s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/2089304051938765570/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=2089304051938765570" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2089304051938765570?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/2089304051938765570?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/i490AISRy0s/good-and-not-so-good-reasons-to-learn.html" title="&lt;s&gt;Good and&lt;/s&gt; not so good reasons to learn Java (or any other language)" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/11/good-and-not-so-good-reasons-to-learn.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUMSH0_cSp7ImA9WhRREkw.&quot;"><id>tag:blogger.com,1999:blog-6082788733343957185.post-6000495856265172916</id><published>2011-11-25T11:18:00.001+01:00</published><updated>2011-11-25T11:18:09.349+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-25T11:18:09.349+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Programming" /><category scheme="http://www.blogger.com/atom/ns#" term="Programming Languages" /><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X" /><category scheme="http://www.blogger.com/atom/ns#" term="Computer Science" /><title>Brief morning delusion…</title><content type="html">&lt;p&gt;So basically it's a couple of days I try to use a given piece of software. And for some unfathomable reason the thing does not do a specific thing which I need and it shall do. I'm not going to be more specific, because I do not want to point fingers.&lt;/p&gt;
&lt;p&gt;The point is that it does not give any clues on why it is failing or what is exactly trying to do (thus "how" it is failing). Since the project is open source I decided to take the sources and hack my way to the problem. I have a rather good understanding on the domain that I'm going to solve (it's related to unix processes -- though in OS X environment --). I'm familiar with both.&lt;/p&gt;
&lt;p&gt;It's been a while since I last wrote some Objective-C, but this time I should just look at the sources, perhaps set a couple of breakpoints and find out what is happening. My plan is that after that I could fix the source so that:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;It logs what is doing&lt;/li&gt;

  &lt;li&gt;It logs any errors that occur&lt;/li&gt;

  &lt;li&gt;Perhaps I fix the specific problem in the code&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first bad piece of new is that I spot some obvious software engineering mistakes in the software. Unfortunately it is stuff that needs more than a casual hacking to be fixed (specifically, I'm talking about configuration stuff hardcoded in the sources). Still, it is not probably a big issue. It may even make sense in some contexts… well, not really. But anyway. Some wrong data-structures… but everything is basically fine: the code, a part from that, is well written and rather clear.&lt;/p&gt;
&lt;p&gt;So I localize the piece of code that fails. It does a bloody lot of magic, in my opinion. My guts tell me that some of it is just unnecessary, some better design could lead to much simpler and less magic code. The only problem is that sometimes such kludges are just a consequence of unorthogonal design of the underlying systems (in this case OS X). But that is something I would do later on, after simply adding the code that logs possible errors (I think that is of paramount importance for the semi-technical users of the software, in the sense that they could better understand what is going awry when they customize it).&lt;/p&gt;
&lt;p&gt;Then a thought strikes me: compile the whole thing just before making modifications. The svn repo &lt;i&gt;should&lt;/i&gt; have been left in compilable state… but no. It is not. So I should have to find the last point where it can be compiled. Which I could do… well, another time.&lt;/p&gt;&lt;br /&gt;

&lt;img src="http://feeds.feedburner.com/~r/Rik0TechTemple/~4/CibVOosv8cY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.enrico-franchi.org/feeds/6000495856265172916/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6082788733343957185&amp;postID=6000495856265172916" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/6000495856265172916?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6082788733343957185/posts/default/6000495856265172916?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Rik0TechTemple/~3/CibVOosv8cY/brief-morning-delusion.html" title="Brief morning delusion…" /><author><name>enrico franchi</name><uri>https://plus.google.com/112243281728981403168</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh5.googleusercontent.com/-qLCWd3s-YF0/AAAAAAAAAAI/AAAAAAAAAjQ/BLPVHGZ-U_I/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.enrico-franchi.org/2011/11/brief-morning-delusion.html</feedburner:origLink></entry></feed>
