Something Same

Language, Expression and Design

Thursday

24

July 2014

representation and reflection

by Chris Zheng,

I've published a little library called korra which is used for jar and maven introspection. This is an extension of what I was working on with iroh in terms of creating utilities that give the developer greater visibility within a live-repl environment. The two libraries can be described as metaprogramming tools - libraries that are used by the developer for interacting with the environment and reasoning about how to go about programming. An example of such tools would be the doc and source functions in the clojure.repl namespace. While iroh provides introspection at the class level, korra introspects at the jar and packaging level. The library was extracted out…

Saturday

14

June 2014

The abstract container pattern

by Chris Zheng,

Clojure has very powerful tooling for working with native java objects and classes. It has numerous ways to take advantage of the java inheritence model. However, one feature that is missing from the language is the ability to define abstract classes. Therefore there is no built-in construct for building multi-tiered class abstraction hierachies in clojure as it is done in java. In my own transititon from thinking in terms of objects to thinking in terms of dataflow, I have not really missed this particular feature that much. However now that I have more experience building bigger and more complex programs using clojure, I have come back to revisit the importance…

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…

comments powered by Disqus