schedule Sep 11th 11:30 AM - 12:15 PM place Grand Ballroom 2

Testing business logic quickly becomes tricky, as applications grow and scale. Example based unit and integration tests, and exploratory tests become poor choices to check and verify a large state space. Also such methods are not  well-suited to clearly describe the state space / transitions we want to test. 

Since we use Clojure to write test suites and tools at Helpshift, we tried experimenting with DSLs to express some of our testing problems. We've found that mini DSLs can indeed become useful to describe and test fairly complicated business logic.

In this talk I will cover some of the mini-DSL approaches we've tried, demonstrate one of them by example, and discuss the benefits and drawbacks based on current experience.

 
19 favorite thumb_down thumb_up 2 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist
 

Outline/structure of the Session

We'll have the session in 7 parts.

Part 1) What makes business logic hard to test? (3 minutes)

We'll talk about how business logic tends to be a lot like defining a state machine for a system. And how enumerating all possible combinations using standard example based testing can get quickly out of hand.

Part 2) Example of a real world problem to test by various methods. (7 minutes)

We'll take a real example of a feature we were building at Helpshift which had a lot of combinations to test thus making it hard to enumerate all of them.
We'll briefly give an overview of testing this feature via:

  • Example based testing and how its cumbersome.
  • Using a DSL to enumerate example based testing but expected output is hardcoded inside the test.
  • DSL to not only used to write the test but to also generate the expected output and validate.
  • And finally leveraging DSLs to specify the state machine of the system and write a function to generate tests for us and verify.

Part 3) Demo of the actual code + How to write it : (15 minutes)

In this part we'll see the actual code for the above. And we'll discuss how one goes about writing DSLs using multimethods in Clojure.

Part 4) How other features at Helpshift were also tested using DSLs (5 minutes)

Next we'll see other features we have tested using the same ideas of writing DSLs with a demo.

Part 5) Advantages of writing DSLs for testing (7 minutes)

We mainly noticed two kinds of advantages:

  1. Discovering very hard to find bugs, for example we found:
    • Duplicate issue messages being rendered only if the number of messages were "just right".
    • Finding ordering bugs.
  2. Increase in developer/tester productivity
    • To be able to take a ticket filed by our customer and see if it is reproducible quickly using our DSL.
    • Instead of telling the developer "Do this, then do this" in a ticket, write the bug in DSL.
      And share the snippet of code to reproduce the bug.
      This was a great win while developing.
      Developers knew exactly how to reproduce the bug.


Part 6) Disadvantages of writing DSL for testing. (3 minutes)

Of course there are some down sides too. This includes:

  • Cost of maintaining DSLs is high.
  • If your DSL is just data being evaluated at run time,
    changes in feature code will not throw any compile time errors like
    function parameters being changed in DSL code.
  • You have to educate your team members to learn your
    specific DSL for that feature to be able to understand the tests.

Part 7) Conclusion & QA Session (5 mins)

Finally we'll conclude this talk and leave the remaining time for Q&A.

Learning Outcome

  • How to design and implement a mini DSL to describe testing problems
  • How to model business logic as an FSM and use that to generate tests
  • Benefits and tradeoffs of this approach to testing

Target Audience

QA, Clojurists, Testers, Engineers, Have you had to write hairy business logic lately? :)

schedule Submitted 2 years ago

Comments Subscribe to Comments

comment Comment on this Proposal
  • Kishore
    By Kishore  ~  2 years ago
    reply Reply

    Hey.

    Testing is a hot area.  Cool DSL with Clojure .  

    But what are you going talk that is functional in this conference ? I don't see your abstract reflecting the same.

    I verified the Clojure multimethods, and it appears like Type constructors in scala/haskell (or) Duck typing.  

    Would you elaborate what is it someone can gain functionally from the talk, as opposed to providing information on "How good a DSL based testing can be/can't be ?"

     

     

    • Mayank Jain
      By Mayank Jain  ~  2 years ago
      reply Reply

      Hi Kishor,

      The talk will be mainly about how one can implement a similar DSL and what all approaches one can talk.

      I'll be taking a real example we tested using this idea. And what all problems/benefits we felt there is using this idea.

      So in a nutshell, if you like the idea of DSLs but are not sure how one would go about implementing it for a real world testing this talk will be useful to you.


  • Liked Morten Kromberg
    keyboard_arrow_down

    Morten Kromberg - Parallel Programming in Dyalog using Futures and Isolates

    Morten Kromberg
    Morten Kromberg
    CXO
    Dyalog
    schedule 2 years ago
    Sold Out!
    45 Mins
    Keynote
    Beginner

    Dyalog is an array first multi-paradigm language based on an APL language kernel. In APL, it is common for the application of primitive functions to arrays of conforming shape to imply a map; the function is applied item-wise to corresponding elements of the arguments, producing a result of the same shape. APL also provides a variety of explicit operators that provide different mappings of user-defined functions, or more generally functional compositions, to multi-dimensional and nested arrays.

    One might expect that such language features would provide a complete framework for parallel programming. In practice, writing programs that can be efficiently executed in parallel on current hardware is extremely difficult, if implicit or explicit maps are the only parallel language feature available and an interpreter or compiler needs to deduce where to introduce the asynchronicity that is required in order to take advantage of the hardware.

    This talk will present Futures and Isolates, and related parallel operators constructed upon them, which were added to Dyalog version 14.0 in 2014. The goal has been to provide explicit forms of deterministic asynchronous execution, designed to be very familiar to APL users, and continue to allow them to view the language as an executable mathematical notation, while taking advantage of parallel hardware that is now readily available.

  • Liked Viral B. Shah
    keyboard_arrow_down

    Viral B. Shah - Why Julia?

    60 Mins
    Keynote
    Beginner

    In this talk, I will talk about our motivation for creating Julia. Julia is a high-level, high-performance dynamic programming language. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. Julia’s Base library, largely written in Julia itself, also integrates mature, best-of-breed open source C and Fortran libraries for linear algebra, random number generation, signal processing, and string processing. In addition, the Julia developer community is contributing a number of external packages through Julia’s built-in package manager at a rapid pace. This is why Julia is seeing rapid adoption in universities for teaching and research, as well as in businesses.

    I will discuss what makes Julia fast. Julia's ability to combine these levels of performance and productivity in a single language stems from the choice of a number of features that work well with each other:

    1. An expressive parametric type system, allowing optional type annotations;
    2. Multiple dispatch using those types to select implementations;
    3. A dynamic dataflow type inference algorithm allowing types of most expressions to be inferred;
    4. Aggressive code specialization against run-time types;
    5. Metaprogramming;
    6. Just-In-Time compilation using the LLVM compiler framework; and
    7. Careful design of the language and standard library to be amenable to type analysis;

    I will also touch upon how the language design has made it possible to explore many parallel programming models in Julia, completely within the language.

    See: http://www.julialang.org/

  • Liked Morten Kromberg
    keyboard_arrow_down

    Morten Kromberg / Jay Foad - Array Oriented Functional Programming with Dyalog

    Morten Kromberg
    Morten Kromberg
    CXO
    Dyalog
    Jay Foad
    Jay Foad
    Software Developer
    Dyalog Ltd
    schedule 2 years ago
    Sold Out!
    480 Mins
    Workshop
    Beginner

    Dyalog is a modern, array-first, multi-paradigm programming language, which supports functional, object-oriented and imperative programming based on an APL language kernel. During the morning and early afternoon, Dyalog's functional language guru John Scholes will introduce the fundamentals of functional programming in APL. At the end of the day, Dyalog CTO Morten Kromberg will round off with an application development session, showing how a simple web application with a HTML5/JS front-end and a RESTful web service can be used to deliver the power of APL to end users, or as embeddable components for other application tools. The "hands on" sections of the workshop can be followed under Mac OS X, Linux, or Microsoft Windows.

  • Liked Shantanu Kumar
    keyboard_arrow_down

    Shantanu Kumar - Production Clojure: An Experience Report

    Shantanu Kumar
    Shantanu Kumar
    Principal Engineer
    Concur
    schedule 2 years ago
    Sold Out!
    45 Mins
    Experience Report
    Intermediate

    This talk is about our experience of using Clojure in production at Concur for building a SaaS platform.

    To set the perspective, Concur is a 22 years old, USD 8.3 billion enterprise, now a part of SAP. More than 70% of Fortune 500 companies use Concur for travel and expense solutions. Concur's SaaS platform serves 25,000 customers with 25 million users. The Concur SaaS platform was reaching its limits and needed "re-architecting". This talk is about why we chose Clojure at Concur and how we are building one of the world's largest B2B SaaS platforms in Clojure.

    We will discuss the practices we established, experiments we did and the lessons learnt. We have now built a platform that follows open standards, is rigorously tested, tolerates failure and performs well. We will go over how we reached there, how we deployed the code to production and how we monitor those today.

    If you are considering using Clojure in production or even simply interested in Clojure, you may get useful insights to take away from this talk.

  • Liked Tanmai Gopal
    keyboard_arrow_down

    Tanmai Gopal - Haskell In Production

    Tanmai Gopal
    Tanmai Gopal
    Engineering Head, Founder
    34 Cross
    schedule 2 years ago
    Sold Out!
    45 Mins
    Experience Report
    Intermediate

    From the perspective of one of the few companies in the country using Haskell in production (hasura.io), we will talk about the journey of using Haskell as a programming language to build and maintain real world software.
    From the burden of choosing a language that probably has a single digit number of active developers in the country, to
    the joys of a small team churning out code that just keeps on working.

    We'll go over how we created a team, organized work ("software development practices"), architecting code, tooling up, testing, performance tweaking and finally deploying a Haskell codebase. We hope that Haskell developers with some prior experience will be able to take away
    something new about the Haskell ecosystem, and those interested in just functional programming will see tangible value in how certain features unique to Haskell have an impact.

    Expect a case study, a review of some cutting-edge tools and how to use them, and some Haskell code samples that will make you grunt in geeky approval.

  • Liked Shashi Gowda
    keyboard_arrow_down

    Shashi Gowda / Viral B. Shah - Julia - A Lisp for Fast Number Crunching

    240 Mins
    Workshop
    Beginner

    Julia is a programming language for data science and numerical computing. Julia is a high-level, high-performance dynamic language, it uses just-in-time compilation to provide fast machine code - dynamic code runs at about half the speed of C, and orders of magnitude faster than traditional numerical computing tools.

    Julia borrows two main ideas from Lisp lore:

    1. Multiple-dispatch: a method is identified by a name and the types of all of its arguments (traditional OOP only uses the type of a single argument) multiple-dispatch allows for a natural programming model suitable for mathematics and general purpose programming. Interestingly, the same feature is responsible for Julia's ability to generate really fast machine code.
    2. Macros: Julia has syntax that is familiar to users of other technical computing environments, however, Julia expressions are homoiconic -- Julia code can be represented as Julia data structures, and transformed from one form to another via hygienic macros. There are some very interesting uses of macros to create domain-specific languages for effective programming. 

    (I will be presenting this workshop along with Viral B Shah - co-creator of Julia)

  • Liked John Thomas
    keyboard_arrow_down

    John Thomas / Shyam Sundar - A Introduction to Functional Design Patterns in scala

    90 Mins
    Workshop
    Beginner

    First notorious word, every functional programming encounter (without mathematical background ) during initial days  is "Category theory " . Our aim is to introduce the very minimum concept a functional developer should know in category theorem .

    The goal is to introduce basics of category theory and develop a small prototype library to validate and process data  , out a few principles from category theory.

    We will also be introducing and implementing representations of Functors, SemiGroup, Applicative, Monoid and Monad. We also make use of some interesting Scala features like ADT - Algebraic data type , Implicit conversion, Types . 

     

     

     

  • Liked Ravi Mohan
    keyboard_arrow_down

    Ravi Mohan - Building a General Game Playing Engine with OCaml and Erlang

    Ravi Mohan
    Ravi Mohan
    CEO
    AxiomChoice
    schedule 2 years ago
    Sold Out!
    90 Mins
    Experience Report
    Beginner

    "General Game Playing  is the design of artificial intelligence programs that play more than one game"  Wikipedia [1]

    In other words, one program has to be able to play (and win!) multiple games ( Chess, checkers, Go, Othello etc).

    Summary: This experience report is about my  "Forever Project" [2,3,4] to build such a system in OCaml, and the problems (theoretical and practical) and will include a demo of the program, warts and all.

    Detail: GGP is an active CS research area [5]Annual competitions are held every year where  ggp programs compete against each other[6], playing games which they have never seen before (the rules are supplied as an input file for the system to consume five minutes before the match begins).

    Over the last year, in my non-existent spare time, I've been building a GGP engine to compete in a GGP competition.

    Most such engines are written in Java, C++  etc.. I'm using OCaml for the game playing agent, and Manoj is building the backend in Erlang.

    As mentioned above this is our "Forever Project"  We've made some decent progress.

    Come, see, laugh, jeer!

  • Liked Nivedita Priyadarshini
    keyboard_arrow_down

    Nivedita Priyadarshini / Srihari Sriraman - Building an Experimentation Platform in Clojure

    45 Mins
    Experience Report
    Intermediate

    Here's a markdown version of this proposal: https://gist.github.com/ssrihari/1cad915e7ef22ce61b54

    Over the last year and half at Staples SparX, we built a multivariate testing platform as a service. It satisfies an SLA of 10ms at 99.9th percentile, services all of Staples' experimentation from a single machine, is simulation tested, and is written in Clojure.

    We'll give an introduction to the Experimentation domain, design of experiments and our battle in attaining statistical significance with constrained traffic. We will share our experiences in loading and reporting over months of data in Datomic, using Clojure to grow a resilient postgres cluster, using a homegrown jdbc driver, interesting anecdotes, and OLAP solutions with ETL built in Clojure using core.async. Expect to see references to google white papers, latency and network graphs, histograms, comparison tables and an eyeful of clojure code.

  • Liked Srihari Sriraman
    keyboard_arrow_down

    Srihari Sriraman - Carnatic music synthesis in Clojure

    Srihari Sriraman
    Srihari Sriraman
    Partner, Engineer
    nilenso
    schedule 2 years ago
    Sold Out!
    45 Mins
    Demonstration
    Beginner

    Here's a markdown version of this proposal: https://gist.github.com/ssrihari/b25ddda331ec220663de

    I'm building a carnatic music (south indian classical music) synthesizer using Clojure and Overtone. Here's the library I'm building.

    Carnatic music is different fundamentally in the movements of pitch ('Gamakams'), and needs to be modelled differently than most MIDI music out there today. The library now, can understand prescriptive carnatic music notation, build finer abstractions from that, and play back a not-so-terrible synth version with a plethora of configurable inputs.

    The concept of 'Gamakam' (the transitions between notes) is central, so I'll go into it's guts and show how the library piggybacks on recent work on PASR (pitch-attack-sustain-release) and Dual-PASR ('stage' and 'dance' PASR components) transcriptions. I'll also put forth a path I see for fully synthetic carnatic music based on machine learning 'Ragams' (melodic modes).

    I'll give a detailed demo of the synthetic music on the repl through the talk, and do a live voice vs synth comparison in the end.

  • Liked Bhasker Kode
    keyboard_arrow_down

    Bhasker Kode - Workshop: Erlang by example

    Bhasker Kode
    Bhasker Kode
    Building stuff
    Helpshift
    schedule 2 years ago
    Sold Out!
    480 Mins
    Workshop
    Beginner

    From fundamentals to deploying Erlang micro-service.

  • Liked Dhaval Trivedi
    keyboard_arrow_down

    Dhaval Trivedi - Little JavaScripter

    Dhaval Trivedi
    Dhaval Trivedi
    Web Development Engineer
    Amazon
    schedule 2 years ago
    Sold Out!
    45 Mins
    Talk
    Beginner

    If you think this is going to be a talk on JavaScript, you’re wrong.
    If you think this is going to be a talk on Scheme/Functional Programming, you’re wrong.
    If you think you know what this talk is going to be about, you’re probably wrong.

    Remember when you watched Inception? Or Interstellar? You’ll have to empty your mind, relax the day before and then come attend this talk. See you there.