Monday, April 20, 2015

Alan Kay, TDD and FP

One of my favorite Alan Kay quotes is "A change in perspective is worth 80 IQ points".
Regardless if he ever measured it or not, he did capture an important aspect of complicated problem solving - problems have many axis. Each perspective by itself only explores part of a problem's axis, and any additional perspective explores more axis, en-route towards a comprehensive solution.
This is where the power of TDD (test driven development) and FP (functional programming) comes from.

When you do TDD, you explore axis which do not directly target the question of "how do I solve the problem", but rather the question "How to detect a wrong solution". By following these axis, alongside with exploring using the regular problem solving mechanisms (as we try to change perspective, not just use one different perspective), the chances of reaching a more comprehensive solution are increased. The side-effect of this approach is having the tests later on to allow ongoing verification of the consistent behaviour of the software.

When you do FP, you explore axis which do target the question of "how do I solve the problem", but via different axis, as the industry standard is doing it the OO way. This means different model of the problem, different abstractions, different computation mechanisms. Again, by exploring additional routes to solve the problem (this time they target the question directly), you increase your chances of finding a comprehensive solution to the problem. The side-effect of using this approach is a larger set of simply solvable problems, as there are problems that are entry-level on the FP axis, while being advanced when projected onto the OO axis (and one of the benefits of simple solutions is that they are very easy to test).

In the same way that novelists are not in the business of books writing, but rather in the business of story telling deployed via books, software engineers are not in the business of writing software, but rather in the business of problem solving deployed via software . This is why using the extra perspective(s) is so important.




Saturday, September 8, 2012

The axis of a software person

There are several axis for the skill that a software person should (must) have
  1. Software engineering skills - these are the skills that allow a software person to transform a description of a system to a system and a project that can be controlled and maintained. These skills are:
    • Distilling requirements from the needs of the client. This is a phase where a semantic description of a system is reduced to a syntactic description. Engineers need syntax, as it is possible to build tools that understand and analyze syntactic description of a system.
    • Designing the system - both low and high level design
    • Understanding regulations related to software (e.g., privacy constraints or accessibility rules)
    • Knowledge of development processes - agile or not agile, TDD or testing at the end of each development phase
  2. Software coding skills - these are the skills that allow developers to take a description of  a system and develop something that executes on a computer, these skills are:
    • Programming language(s) - The vehicle that translates neural signals in the developer's brain to operations on the CPU. It is crucial to know at least one, but it is rarely enough. The fact that it is possible to use a certain language to code doesn't mean that it is the right language to choose, Turing completeness is not everything. Be versatile, know static and dynamic language, declarative and imperative, functional and OO ...
    • Development tools - understand what your IDE can give you. Know all the features of your debugger, also all of its blind-spots (concurrency...)
    • Development ecosystem - know the libraries, toolkits, and basically everything that is already done, correct and useful
    • Problems avoiding - understand code smells. In my first course on software development the lecturer said "code that is written twice is written once too many" - follow this rule, learn to love refactoring and strive for code reusability
  3. Expertise in a technical domain - knowledge beyond coding. It can be machine learning or information retrieval, usability or DB design, security or concurrent programming. A software person must be knowledgeable in a technical domain, this what separates software person from a code monkey
  4. Understanding of a client's domain - this can be anything - from spacecraft aeronautics to medical devices, it is crucial to understand the client's domain in order to be able to provide a product that solves the client's problem. This knowledge is utilized throughout all the software construction life-cycle. From properly understanding the client's requirement, through giving proper names to variables all the way to building a system that is exactly what the client needs. 
Only by having a proper combination of skills along these axis, a software person is able to solve the tough problems that the client is facing and provide a solution that works the way that the client needs (and not just the technical problems that the client doesn't really cares about).

Saturday, August 25, 2012

What's next for Samsung

The court decided that Samsung had infringed several of Apple's patents, mostly design / user interface / user interaction related ones.

That's good, because shameless copying without acknowledging should be discouraged.

So what's Samsung to do next? as I see it, they can choose one of two paths:

1) The easy way - make the users pay for the infringement by keep on using these patents, raise the devices' price and just give that money to Apple as royalties. As a consequence, there would not be a need to innovate as basically, the problem (how to do good design / user interface / user interaction) is solved, just more expensive to the users.

2) The hard way - make themselves temporary pay for the infringement by investing in innovation. Create better, innovative, brilliant designs / user interfaces and user interaction schemes. Ones that are both better than Apple's and are patentable. This means investment in research, ideation and development, without any promise of success, but with a promise that in case of success, they'll be bigger than Apple (and that's a lot).

Which path will they choose ?

Thursday, May 31, 2012

Big data 2.0

One of the hottest fields in the software industry today is big data. It seems that everywhere you go you hear about it.

In the past, what constrained big data from being a reality was low capacity storage (or the price of storing large quantities of data), once this obstacle was removed, and Moore's law kept on ticking, extremely powerful machines were at reach for everyone, and hardware was no longer an issue.

Once hardware stopped being the bottleneck, it was time for software to stop acting as such. This was addressed by designing and implementing better and stronger analysis algorithms (think of the fields of machine learning and data mining) as well as finding and inventing new visualization mechanisms. These solutions are aiming at taking data and extracting information out of it, either by analytically detecting a signal in the data or by rendering the data in ways that it is easy for the mind to grasp and perform its own analysis.

The problem with these solutions is that they are at best when there is a definite answer to a well defined question. Still, more than often, that answer is relatively flat and abstracts out the complexity of both the answer and the question.

There is a need to find a new mechanism, something that would tell the story of the solution, that would deliver the idea that captures the complexity of the question and the complexity of the answer. This is not something that is found in nowadays computer science - it is not a combination of CS and math (to yield better algorithms) or CS and cognitive psychology / neuroscience (the forebearers of the information visualization and HCI fields).

My  guess is that it would be a new field, some sort of an hybrid of CS and philosophy. I specifically think that philosophy is the field from which answers would come since one of the key aspects of philosophy is the ability to tell an idea, a real idea,  not just a story (this is the focus of literature) or express a feeling.

When this field is established - it would be big data 2.0

Saturday, April 21, 2012

Trying out Twitter

I'm trying out twitter - look me up at http://twitter.com/yoavrubin

Monday, March 19, 2012

The most courageous code comment ever

This screen capture (taken from here), is part of the code that put Apollo 11 and 12 on the moon. More specifically, it is part of the landing guidance code, so these lines were responsible for the 'put' in the phrase 'put a man on the moon'. I will never write such a mission critical code, I don't know of anyone who will. 

Still, look at the comments in lines 179 and 180... someone really hoped for it to work...

Tuesday, February 21, 2012

At the end of the rainbow

Took this picture a few days ago, I guess that someone found a few leprechaun gold pots on his porch.

Tuesday, February 7, 2012

My book is now published

The book, called "Looking inside a Neural Network", is based on my thesis. It is now published and available, see it here: http://www.amazon.com/Looking-Inside-Neural-Network-Microscopy/dp/3847378686/

Tuesday, September 13, 2011

The Joy of Clojure - a short book review

I'm currently reading the book "The Joy of Clojure". This is a rare kind of book - the kind you don't want to end. It explains Clojure - but not in a "do this to get that" kind of a way, which is the way most technical books are. It does it differently, by almost telling a story that reveals Clojure layer after layer. It does so while keeping the Clojure motto of "no unneeded overhead" - exactly what's needed, no more no less.

Still, if it was just for that, I wouldn't rush to write this short review - there's something else in the way that this book is written, its style is some sort of a combination between an Arthur Conan Doyle novel in the way that it glues you to the page, and a late night show monologue that provides you fun every 30 seconds.

A must read for every software developer - regardless if you ever plan to write a single line of Clojure code, it would just make you think clearer about code in general and specifically about your code.

Saturday, September 3, 2011

A function, JavaScript engine and the single var pattern to declare variables walk into a pub

Addy Osmani had published a very nice post that summarizes various problems found when doing JavaScript code review. Most of the points there worth paying attention to. However, there is one point there that he got completely wrong. When he discussed the problem of variables declared all over the place within a function scope, he suggested to use the "single var pattern to declare variables", basically write the variables declarations like this:

var someData = "testing",
     otherData = "data1",
     moreData = "data2";

This kind of coding will get you into trouble. Try to find the difference between the code above and the code below:


var someData = "testing"
     otherData = "data1",
     moreData = "data2";

Found?

let's add to the first snippet the scope of each variable:

var someData = "testing", // local within the function
     otherData = "data1", // local within the function
     moreData = "data2"; // local within the function

Now let's do the same for the second snippet:

var someData = "testing" // local within the function
     otherData = "data1", // global
     moreData = "data2"; // global

Big difference, but why?.

Answer: Take a look at the "testing" string. In the first snippet  it is followed by a comma, whereas it is not there in the second snippet. That's all, one comma.

Both snippets are valid JavaScript code, it just happens that even though JavaScript has a C like syntax, it does not require to have a semi-colon at the end of each line, the JavaScript engine will add it if missing.

So the second snippet is actually:


var someData = "testing"; // local within the function
     otherData = "data1", // global
     moreData = "data2"; // global

(note the semi-colon after the "testing").

One more thing to know about JavaScript: when declaring a variable inside a function without the var keyword, it is defined as a global variable.

Now go and find that little comma somewhere in your code, at 1:00 am , a few hours before delivery.

I prefer the simpler approach to define variables, and do the following:


var someData = "testing"; // local within the function
var otherData = "data1"; // local within the function
var moreData = "data2"; // local within the function

You can say that it is less elegant, but it is much less error prone, much more descriptive of what you want, can save hours of looking for a comma and simply put, it is just a simpler code. Just remember that beauty is in the eyes of the beholder, and to me, in code, simplicity is beauty .

Thursday, August 18, 2011

What's next in the mobile arena

Apple has complete control  both on the software and the hardware of their mobile devices. Moreover, they have a huge client base (all the iPXXXX people)
Google  now also has complete control both on the software and the hardware of their mobile device (assuming that the deal with Motorola Mobility is approved). Moreover, they have a huge client base (all the android people)

RIM has complete control both on the software and the hardware of their devices, but nobody buys their products and they are loosing their share in the mobile market.

Microsoft controls its software and wants to increase their share in this market.

When will Microsoft buy RIM?

Saturday, August 13, 2011

The effects of the software patents war

There's a software patents war raging. It is fought between all the players, big and small: Google, Apple, Microsoft, Oracle and IBM are just a few names in the list of the war participants.

It is all over the news now, Google buys more then a 1000 patents from IBM and fails to buy 6000 other patents, of Nortel. These 6000 patents were bought by Apple, Microsoft and Ericsson. The undertaker of silicon valley claims that nowadays, what's left of a company that is closing down is the IP (whereas during the 2000 bubble bust servers were what a dying company could sell).

This leads me to ask about the effect of this war on the recruitment process. I guess that companies in the high-tec industry will start looking for people who know to develop software (transform innovation into code) as well as know how to develop IP (transform innovation into patents).
Would an ad for a software developer include not only the set of technologies / domains that a possible candidate should know, but also how many patents are on the candidate's belt?

Update
The patents war is now going to the next level - Google bought Motorola Mobility and its portfolio of about 17,000 patents. Now Google has a patent arsenal which can be used to really fight the rest of the big players.

Wednesday, July 27, 2011

Programming and softwaring

Programming is creating functional components from code atoms (such as a programming language keywords or library calls). It is structuring a code molecule with defined input and output.

Softwaring is the composition of code units (atoms and molecules), functional components and other software to create an entity that has code organs (such as UI or communication layer), processes and life cycle.

Programming is chemistry.

Softwaring is biology.

Tuesday, June 28, 2011

A different, simpler, approach to visually design business processes

About a year ago, I co-authored a paper called "What You See And Do Is What You Get: A Human-Centric Design Approach to Human-Centric process". It was accepted and presented at the BPD  workshop (BPD here stands for "Business Process Design") which was part of the BPM conference (BPM here stands for "Business Process Management").

The paper describes a new way to design processes. The key idea there was to reuse the WYSIWYG ("what you see is what you get") design approach (which is used usually for user interface design) in process design, where static page design is not sufficient, but there's also a need to design the dynamic nature of the process.

I just noticed that the proceedings are now published, so it is possible to read the paper here.
Section 2 there describes in more details the WYSADIWYG approach.

Sunday, June 26, 2011

Comparing programming languages to boats

See here, a nice comparison of programming languages to types of boats. Very funny, some of it even makes sense (even though I'd say that Java is the Titanic rather then a cargo ship...)





Monday, June 13, 2011

Brain-mapping the Dallas Mavericks

Dallas Mavericks just won the NBA title. Watching them was a true enjoyment due to the diversity of the playing styles that this team showed.
When combining together all these playing styles it is easy to see the resemblance of this team to another remarkable machine - the brain. Here is a short list of the key players and their role / playing style as if they are regions in the brain:

Jason Kidd -  Prefrontal Cortex: This region is responsible for planning and decision making (amongst other things). This is the type of basketball that Jason Kidd is playing - very smart and focused on taking the right decisions while planning two moves in advance.

Dirk Nowitzki - Cerebellum. This region is responsible for repetitive motorical tasks, such as climbing stairs all the way to doing calligraphy. Dirk Nowitzki's game is all about doing several things over and over again, regardless of their complexity - jump backward on one leg, re-balance in mid-air and then throw the ball accurately to the hoop. from the outside it seems complicated, it is if you stop and think about every step. It isn't if done automatically.

Jason Terry - Amygdala. This region's key functionality is handling the limbic system, i.e. emotions. Jason Terry's game is all about emotions - if he feels that he needs to shot, he'll shoot, no fear, no stress, it can be a win or loose shot, if he feels it, he'll do it.

Jose Barea - Brainstem - This region is responsible for the basic bodily functions - breathing, temperature control, etc. Jose Barea's game is just as primal as this region- no, thinking, just doing - you are faced with a higher, stronger defender (or two), run into them and throw the ball.

Sean Marion - thalamus - This region is the communication relay system, just in the middle of so many processes. Sean Marion's game is similar, he is everywhere, does not start anything,  may end plays and glues numerous processes together.

Tyson Chandler - Astrocytes - this is the "skeleton" of the brain - it give structure and holds everything in place. Does not do any calculation, but everything would collapse without it.

Wednesday, June 8, 2011

Alan Kay's view on type systems

In here there's a very interesting correspondence with Alan Kay about OOP and his definition of it. Amongst other things, he wrote a short sentence that describes his view in the ongoing debate of static vs. dynamic typing.

Here's the exact quote:

"I'm not against types, but I don't know of any type systems that aren't a complete pain, so I still like dynamic typing"

I couldn't agree more. I don't recall even once that static typing actually helped me in designing software, I can recall numerous times that it just stood in the way, without anything to gain other then detecting errors in compile time, but only the kind of errors that any developer (junior or experienced) must be able to detect easily.

Monday, May 23, 2011

Did Don Giovanni want to be a lumberjack?

Just noticed it. Monty Python's Lumberjack song is really similar to Là ci darem la mano from Mozart's Don Giovanni.

take a look:
Here's the lumberjack song:




And here's Pavarotti doing Là ci darem la mano

Friday, May 20, 2011

Darwinian evolution of programming languages

In evolutionary biology, when the environment changes, the flora and fauna changes, this is done by adapting to the change and fitting the specie to the new constraints and new opportunities. This is the essence of Darwin's The Origin of Species - the survival of the fittest.

Same thing happened in programming languages.

During the early days, computation power and memory were scarce and expensive, thus programming languages in use were as close to the machine as possible, to exploit everything from these resources - think of LISP's car and cdr, which are based on specific registers...

After some time, memory was still expensive, but computation power become more available, therefore a new specie evolved - a language that allows to describe the computations done in a more "human" way (i.e., imperative), but still close monitoring of the memory is available. Think of C.

Computation power kept growing, and new programming paradigm evolved - OO, but still, memory is costly, and there was C++.

During the 90's memory became cheap, tight monitoring of it became unnecessary and more could be done with it. The stage was ready for the next languages to rule the Earth, and the era of virtual machines started - most notably Java and its JVM, but around that time also Python, Ruby and others appeared.

Computation power kept becoming more available, as well as memory. But times have changed. Multi-core processors are here, and are here to stay. More power now means more processors, not a stronger, single processor. New languages are now coming out of the primal ocean and taking their first breaths of fresh air (or doing parallel computations). These languages are the functional languages. They were around before, but just like the dolphins that returned to the ocean with enhanced brains and lungs to rule that habitat, It is now their turn to gain dominance.
It is not clear who will win this new race. Some of these languages have the advantage of being able to interact and co-exist with already running software and libraries - such as Clojure with the JVM, or F# with .Net.

Days will tell who will inherit the planet - exciting times ahead.

Friday, May 13, 2011

Clojure

I've started to write code in Clojure, which is a LISP dialect created for the JVM.

This means that the code has the aesthetics that can only be achieved when doing functional programming, while maintaining the ability to fully interact with existing Java based libraries and code.

More then that, Clojure comes along with a modern (almost futuristic) approach to concurrency, way different then the one Java has.

This is extremely important for a programming language, let me explain why.

A good way to think of concurrency (and especially data concurrency ) in programming  is to think about it as a mine field, where the locations in which the threads are interleaving and handling the same data are mines. Your code is the field.

Java's approach is "I'll give you the ability to place mines and I'll  also give you these small cocktail umbrellas to mark where the mines are". You just have to hope that you placed these little cute umbrellas in the right places and covered with them all the ways to access the mines. This is tough to do right in small scale software (where there are very few developers). Practically impossible to do right in large scale software (where there are too many developers).

Clojure's approach is different. It says "put as many mines as you want, I'll cover it with so much concrete, that it doesn't matter how many users are travelling in the field". The concrete itself is composed of immutable data, actors/agents model and software transaction memory.

(BTW, JavaScript approach can be summed up as "there shell be no mines")

I will not start to explain why concurrency is important, if you don't know, then probably you didn't read all the way up to here...

This is a delightful language to use (higher order function is by far the most beautiful idea in programming). It is powerful, efficient with a "no fluff just stuff" attitude with a potential to take your code to places that OO just can't go.

I guess that this is the reason why one of the first books written about Clojure is called "The Joy of Clojure", not sure that there are such titles about C or Java (a book with a similar title about C++ is probably aimed at the masochist community).

Try it, you will not regret and will not look back.