Shared publicly  - 
 
#golang
I thought some folks would be interested to learn about a Go application I've developed and deployed into production at Novartis. It is a web application that allows scientists to order cell lines from an existing inventory system. I won't be giving away any confidential details here, as it's a proprietary application... but a little overview won't hurt anybody.

Scientists can use a web page to search for the cell line they are interested in, place an order (effectively arranging a pickup date), and then arrive at a predetermined location on that day to collect the vials. Scientists can also review all their orders, and cancel if desired. The other persona is the Gatekeeper who owns the freezers the cell lines are in, she marks each order as picked up or "no show" as appropriate using another web page. It's a fairly simple application with only a few web pages and hundreds of users.

Perhaps of interest is that it uses a CQRS architecture for the service layer (all written in Go). All Queries go against an in-memory cache of the inventory data. Commands are executed against the existing database and also update the Query cache. Google for CQRS if you are not familiar with this pattern.

Oracle is the existing database, probably also of interest. I seriously considered writing a Go Oracle driver to interact with the database, but to get it done faster (and with less risk) I ended up with PL/SQL scripts executed from within Go. The scripts do the updates on the database and output JSON strings which Go parses. It's old school, but it works, and it turned out to be a great way to separate concerns.

I did get a little demo running where I was using Oracle OCI and cgo to connect and interact with Oracle from Go, so that's the way to write a Go Oracle driver.

My experience with Go was fantastic. I found the learning curve smooth, the final code very elegant and expressive, and it was lots of fun.

To be honest, I think this application gets swallowed up by larger efforts we have this year and those services are ported to Java to make our codebase more consistent.. but for the time being, Go is being used in production at Novartis.
26
1
Anssi Porttikivi's profile photoDon Dwoske's profile photoErnest Micklei's profile photoFrancisco Souza's profile photo
9 comments
 
Any way you turn this into some open source code for a demo or project?
 
I'd love to be able to open source some of it. I've got mocks setup so it doesn't need to be connected to our internal databases, and I could generate some faked data - but there is some Novartis UI code which shouldn't see the public light - our internal templates, stylesheets, etc. I'll ask some powers that be around here if I can put something out there for the community to see.
 
...or as a Go believer, I would rejoice in knowing that you get Go adopted as a strategic internal tool ;-) 
 
I am interested in your little OCI demo as I am looking for solutions to access our Oracle 11 databases (only way to Go adoption here). What Go package did you use and can you share a bit about how to get a minimal OCI setup?
 
As another followup, I've tried both of the packages listed in that thread : https://github.com/mattn/go-oci8  and http://github.com/tgulacsi/goracle 

Only go-oci8 supports the database/sql package, the other does not (yet).  go-oci8 is a much smaller codebase, and both use Oracle OCI.

I feel neither has been battle-tested, but both seemed to work for my simple query tests.  It was interesting to me that goracle was amazingly faster for the query tests I was doing.  2seconds vs .16 seconds.

I did have a bit of trouble building them, so that's probably worth a post on my part to describe how I did it.
 
Yes, the building part was quite a journey for me too. In particular, creating a packaging config for oci8 was a puzzle. Thought about creating a blogpost about it just to save the list of steps.

Anyway, I got both packages working (i.e. the provided examples) as well on my Ubuntu box. However, I develop on MacOSX so that will be the next challenge before I can really test my requirements against both packages.  

My goal is to have Go use our Oracle packages and exchanges complex custom types in a stable and performant way. 
 
I'm did my coding on OS X - so can verify they both do work.
 
Finally found the time to make it work on OSX too. Symbol links, PATH and DYLD_LIBRARY_PATH changes were needed. Oracle is really making our dev lives harder.
Add a comment...