↓ Skip to main content

Programming

FinagleCon

·4 mins

FinagleCon was held at TwitterHQ in San Fran­cisco. It is re­fresh­ing to see a nice work­ing at­mo­sphere with free food and drinks. Now for the con­tents.

Notes on the Advanced Akka course

·7 mins

The Ad­vanced Akka course is provided by Typesafe and is aimed at teach­ing ad­vanced us­ages of Akka. The course cov­ers the ba­sics of Akka, Re­mot­ing, Clus­ter­ing, Routers, CRDTs, Cluster Shard­ing and Akka Per­sist­ance. The fol­low­ing post starts with a gen­eral in­tro­duc­tion to Akka and presents the takeaways from the course as we ex­per­i­enced them.

The difference between shallow and deep embedding

Deep and shal­low em­bed­ding are terms as­so­ci­ated with Do­main Spe­cific Lan­guages (DSL). A DSL is a lan­guage geared to­ward a spe­cific do­main. The dot lan­guage is an ex­ample of such a DSL for de­scrib­ing Graphs. Con­cep­tu­ally, a shal­low em­bed­ding cap­tures the se­mantics of the data of the do­main in a data type and provides a fixed in­ter­pret­a­tion of the data, whereas a deep em­bed­ding goes bey­ond this and cap­tures the se­mantics of the op­er­a­tions on the do­main en­abling vari­able in­ter­pret­a­tions.

Combining graphviz (dot) and TikZ with dot2tex

We all want to cre­ate good look­ing doc­u­ments and good look­ing doc­u­ments need good look­ing im­ages. Be­cause we want con­sist­ency and be­cause we are lazy we want to do this as auto­matic as pos­sible. That is why we use LaTeX, it cre­ates beau­ti­fully type­set doc­u­ments without much manual ef­fort.

Why you should switch to declarative programming

·7 mins

We are reach­ing lim­its of what is feas­ible with im­per­at­ive lan­guages and we should move to de­clar­at­ive lan­guages. When ap­plic­a­tions writ­ten in im­per­at­ive lan­guages grow, the code be­comes con­vo­luted. Why? Im­per­at­ively pro­grammed ap­plic­a­tions con­tain state­ments such as if X do Y else do Z. As Y and Z con­tain in­vis­ible side-effects the cor­rect­ness of the pro­gram re­lies on some im­pli­cit in­vari­ant. This in­vari­ant has to be main­tained by the pro­gram­mer or else the code will break. Thus each time a new fea­ture is ad­ded to an ap­plic­a­tion or a bug is fixed the code for the ap­plic­a­tion gets more com­plex as keep­ing the in­vari­ant in­tact be­comes harder. After a while the code be­comes spaghetti-code and bugs are in­tro­duced as the pro­gram­mer fails to main­tain the in­vari­ant. This is go­ing to hap­pen des­pite the best in­ten­tions of the pro­gram­mer to keep things clean. Why is this?