Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Why another language?

No description

Mark Ramm

on 9 August 2016

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Why another language?

But, see also Theodore Sturgeon:
Why another language?

My Jorney Pythonista to Gopher
Juju was prototyped/written in Python, and rewritten in go.
Ok, Back to the story
So, what happens if we keep Juju in Python?
Switch to Go
Things we learned
People who are used to dynamic languages need to learn new stuff to use Go well. But the language isn't one of them.
3 problems, concurency, concurency and concurency
C and all it's decendants were designed around creating a "virtual machine" to replace asembly code -- and that virtual machine was always conceved as having a single, sequential execution engine.
Golang to the Rescue
A new bried of language designed for a concurrent world.
No need to choose between fast for developers and fast for compilers.
Most importantly -- BORING!
Things we love about Golang
Go is very good at lots of things

High-level code when you want

Low-level code when you want

Start high, profile, go low-level when needed

Static typing without too much keyboard typing
"Dynamic Languages"
Statically Typed Languages

"Functonal" languages
Dynamic Languages
Fast & Fun for programmers
But they have trouble with concurrency.

Global interpreter locks, threads are heavyweight, callback hell.
Staticly typed languages
Fast (and fun?) for compilers
No global interpreter locks here.

But they too have trouble with either threads or callback hell.

Functional Programming
No fun for anybody
It might be conceptually beautiful, but it's not easy.

More problematic -- it's just not realistic for most problems.

Definitely not for Juju
Go Routines
easier to write
easier to read
easier to maintain
Channels are pointers to a set of values
Unbuffered channels are syncronous
Buffered channels are queues

ci := make(chan int)

unbuffered channel of integers

cs := make(chan *os.File, 100)
buffered channel of pointers to Files
gofmt is
Just add go to the front of a regular function to run it as a "gorutine"

go list.Sort()

Concurrency here means "multiplexed across OS level threads" by golang .

Native easy to use concurrency primitives

Fast execution

Single, statically linked binary

Canonical wants to develop strong go competency
It's a rewrite -- and rewrites are always bad

We need to write lots of libraries for YAML, MongoDB, etc

Go developers are hard to find
Patterns from Java land
akaDependency Injection

Error handling is *special* aka DIY

Assertions are special too

Other stuff
No generics

As previously mentioned DIY Errors and Assertions

Not many go programmers out there, but those that exist are great

Roll forward philosophy is awesome and also tough
Writing server in go is easy
for {
conn, err := listener.Accept()
// check err
go serve(conn)
Golang is "90% perfect 100% of the time"
Based on Jim Harvey's speech structures
(Now ergopoint)
Crazy files
Poorly formatted code
Hey wait, I'm a network administrator
ASP Consultants (2) gave up on it
The Curious tale of Doctor Strange bug
Or how I learned to stop worrying and love significant whitespace
$10,000 bug -- web survey broke if more than one person used it
3 working days and 1 weekend to fix
Code abandoned by contractors we had never seen
Concurency is hard
Left holding the bag

Threads and MySQL
"Optimistic" locks
Callback Hell
"Somebody added a 'defered' somewhere -- but where?
Ok, Processes
Processes require an explicit communication channel

And now we are back to the MySQL example
"I repeat Sturgeon’s Revelation, which was wrung out of me after twenty years of wearying defense of science fiction against attacks of people who used the worst examples of the field for ammunition, and whose conclusion was that ninety percent of SF is crud.

Using the same standards that categorize 90% of science fiction as trash, crud, or crap, it can be argued that 90% of film, literature, consumer goods, etc. are crap. In other words, the claim (or fact) that 90% of science fiction is crap is ultimately uninformative, because science fiction conforms to the same trends of quality as all other artforms."

Python has lots of libraries already

We have a fairly large codebase with good tests

Lots of python developers out there
Twenty thosand lines of "twisted" code
What if we do a rewrite?
Full transcript