Something Same

Language, Expression and Design

Thursday

03

April 2014

Finding a middle ground

by Chris Zheng,

A Dilemma I've always been happy writing clojure code. The only issue I had was around my dislike of bringing in general purpose utility libraries. clojure.core itself is already quite big. As much as I liked the functionality in libraries like useful, clojure-utils and medley, it just didn't seem right to bring in a who lot of dependencies for a couple of utility functions. It was easier to just copy and paste a couple of functions that I needed. The trouble was, as I started writing more code, I started putting commonly used code into my own general purpose library. In time, I also grew a general purpose utility…

Saturday

01

March 2014

All those who wonder are not lost

by Chris Zheng,

I'm really happy to announce the splitting up of the original purnam language extensions library into purnam, brahmin and gyr. It all started with this innocent question on stackoverflow. I never thought that a simple question like could lead to any substantial nine months down the track. What started off as a questionable way and experimental way to combining javascript and clojurescript syntax along the lines lispyscript and wisp has kept morphing and growing. Now, purnam has outgrown its original repo into a set of six synergistic libraries and workflows for crafting clojurescript applications. Usage In your project file, add [im.chit/purnam "0.4.3"] Documention all in one…

Thursday

13

February 2014

Making the Java Interop More Intuitive

by Chris Zheng,

I have been working at Australia Post now for the past 3 months. We currently have a big, monolithic Java code base (originally a million lines of code) that we are retrofitting with new functionality. It is in desperate need of rewrite. The plan is to reimplement the entire system in Clojure. Most of the team is relatively new to clojure and we still have a huge legacy system to maintain. However, alot of progress has been made and so far, 5 out of 9 developers are coding in clojure, with another 2 about to start clojure related projects this week. Despite the success of clojure infiltration into a big…

Thursday

16

January 2014

Clojure, Dynamic Languages, Creativity and Simplicity

by Chris Zheng,

A while back, I started a little rant about 'proving' why dynamic languages are better on the mailing list here. Me: I'm a little bit miffed over this current craze of types and correctness of programs. It smells to me of the whole object craze of the last two decades. I agree that types (like objects) have their uses, especially in very well defined problems, but they have got me in trouble over and over again when I am working in an area where the goal is unclear and requirements are constantly changing. My experience of programming in clojure has freed me from thinking about types and hierarchies and this…

Friday

03

January 2014

Dynamic reloading of java code in emacs/nrepl

by Chris Zheng,

Following up from the previous article on vinyasa, I'm happy to announce the newest feature in this library. I wrote this as I found that I wasted way to much time when using mixed java/clojure projects. I hated to restart the repl everytime I made a change. Now that I am working in mixed java/clojure projects full time, I decided that this functionality is a MUST. reimport Don't you wish that you could make some changes to your java files and have them instantly loaded into your repl without restarting? Well now you can! For example, in project.clj, you have specified your :java-source-paths (defproject ..... :source-paths ["src/clojure…

Wednesday

01

January 2014

Give your clojure workflow more flow

by Chris Zheng,

My profiles.clj has been steadily growing in size as I pick up little bits and pieces of clojure goodness to add to my development setup. It feels like this file could potentially be as important as your .bashrc file for programmer productivity. Recently, I took some time to refactor my helper functions into a library - vinyasa. This project contains helper functions for better organisation of profiles.clj. Tools for Workflow: When I am working with code, I want to have the following functionality: Quick and Dirty Debugging Import from Clojars without Repl Restart Interacting with Leiningen Functions without Shell Refreshing a Clobbered Namespace without Repl Restart Immediate Pretty…

Tuesday

12

November 2013

Will the real file watcher please stand up?

by Chris Zheng, on random

These days, so many leiningen tools have a watch function - usually for plugins. When I run lein <command> watch, a process is spawned that looks at a directory, sees what files are changed and then does something with them. Most have to do with testing and documentation but tools like these are also slipping into development. This is a really simple pattern and it should be standard but unfortunately it is not. Here are a bunch of implementations when I search for file watch clojure on google. https://github.com/derekchiang/Clojure-Watch https://github.com/marick/lein-midje https://github.com/ibdknox/watchtower https://github.com/klauern/java-watcher…

Tuesday

12

November 2013

You took 3 months to write a mutable array for clojure?

by Chris Zheng, on random, ova, arrays

Yes I did. The library is hosted here. It now also includes very comprehensive documentation. There are in total, 350 lines of code, which makes my average output for that period of time a whopping 3 lines per day. The follow up question would then be: What took so long? Answer: Simplicity From the Documentation An ova represents a mutable array of elements. It has been designed especially for dealing with shared mutable state in multi-threaded applications. Clojure uses refs and atoms off the shelf to resolve this issue but left out methods to deal with arrays of shared elements. ova has been specifically designed for the following use case…

Tuesday

12

November 2013

Why exceptions should cascade like stylesheets

by Chris Zheng, on ribol, application design

I watched The power of abstraction by Barbara Liskov a while back and was most interest in the description of her work on the ARGUS language. She talked about a neat expection handling system that she had come up with whilst designing the language. The mechanism was designed around a couple of observations that she had about exceptions: Some exceptions must terminate the program (system level bugs) Some exceptions should not terminate the program (io/databases connection) Some exceptions require upper level intervention to decide whether to terminate or not (multi-level systems) What she did then was to provide semantics to deal with each class of exceptions. A scan of…

Sunday

10

November 2013

Immutability, time and testable task schedulers

by Chris Zheng, on testing, immutability

Immutability is great. Code written with such a principle are generally much easier to test and much more modular than code that is not. In the Joy of Clojure, immutability over time was compared to an animated flip book. Every page represented an instance of time and it was only by flipping through animations that time was percieved. Datomic showed that immutability was possible even for the database (which was something that we all once thought was impossible to make immutable). What Datomic gave us was the ability to 'time travel' through our data. The ability to go back and forth in time without affecting the present is a superpower…

comments powered by Disqus