<p>The main advantage of oTree is that it works for both offline and online experiments. In contrast, zTree must be run offline. So oTree is more flexible. Even if your current experiment will be run in the lab, you might value this flexibility if you think you might run online experiments in the future.</p>
<p>The main disadvantage is that oTree can be harder to learn. Though obviously, this will depend on your current level of Python experience.</p>
<p>Another consideration is whether you know anybody who can help you learn either zTree or oTree. Perhaps I am not a natural programmer, but I would have found learning how to use oTree by myself pretty difficult.</p>

CC BY-SA 4.0
2021-05-20T11:57:05.273Z
2021-05-20T15:01:11.670Z
2021-05-20T15:01:11.670Z
afreelunch
<p>One irreducible advantage of <a href="https://www.otree.org/" rel="nofollow noreferrer">oTree</a> over <a href="https://www.ztree.uzh.ch/en.html" rel="nofollow noreferrer">z-Tree</a> is that you can <em>easily</em> reuse/imply the entire trajectories of results per entity (session/group/player) when doing <a href="https://en.wikipedia.org/wiki/Repeated_game" rel="nofollow noreferrer">repeated games</a>. With z-Tree, it is rather complicated (not to say impossible?) to define dynamically temporal- or individual-based autocorrelated/interdependent/<a href="https://en.wikipedia.org/wiki/Recursion#In_mathematics" rel="nofollow noreferrer">recursive</a> games.</p>
<p>Another <em>notable advantage</em> is that you can also easily run (fully automated) <a href="https://en.wikipedia.org/wiki/Functional_testing" rel="nofollow noreferrer">functional tests</a> with oTree, be them <a href="https://en.wikipedia.org/wiki/Headless_software" rel="nofollow noreferrer">headless</a> or not, with random numbers following the distribution(s) or mechanism(s) you like, up to the generation of the final results, which is at best complicated if I remember well with z-Tree. Moreover, keeping in mind that it is increasingly mandatory to provide (in appendix) all the screenshots of the steps of an experiment, you can easily do so with oTree, using libraries such as <a href="https://selenium-python.readthedocs.io/" rel="nofollow noreferrer">Selenium</a> as soon as something changes.<sup>I remember me doing all that manually, with many <a href="https://stackoverflow.com/questions/59521328/how-can-i-create-a-shortcut-to-zleaf-to-run-experiments-using-ztree">zLeaf</a>s opened, which was cumbersome to say the least. Having 3 screens was not enough...</sup></p>
<p>Finally, learning oTree will strongly initiate your familiarity with a notorious web-framework, <a href="https://www.djangoproject.com/" rel="nofollow noreferrer">Django</a> (not the CMS), which means that learning oTree means learning it as well. Entirely class-based and <a href="https://www.python.org/dev/peps/pep-0008/" rel="nofollow noreferrer">PEP8</a>-compliant, it also means that via oTree, you will learn coding in Python the &quot;right way&quot;. Moreover, if you wanna tweak your <a href="https://en.wikipedia.org/wiki/Front-end_web_development" rel="nofollow noreferrer">frontend</a>, you will also start learning things such as <a href="https://en.wikipedia.org/wiki/CSS" rel="nofollow noreferrer">CSS</a>, <a href="https://en.wikipedia.org/wiki/HTML" rel="nofollow noreferrer">HTML</a> and even <a href="https://en.wikipedia.org/wiki/JavaScript" rel="nofollow noreferrer">JavaScript</a>. oTree's dividends are numerous.<sup>All that with a concrete goal in mind, which (to me) is the best manner to acquire new skills.</sup></p>
<p>That being explained, there is now a new version of z-Tree which I do not know, i.e. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7485551/" rel="nofollow noreferrer">z-Tree unleashed</a> which may be far better than its ancestor.</p>

CC BY-SA 4.0
2022-12-21T09:50:46.443Z
Thanks for the great answer. That point of learning Python and JavaScript the right way while having a concrete goal in mind is a huge benefit in hindsight. Why waste time learning an ugly language that only economists care about...
Papayapap
CC BY-SA 4.0
2021-05-21T05:45:56.197Z
2021-05-21T17:57:01.273Z
2021-05-21T17:57:01.273Z
keepAlive
<p>I need to decide between learning Ztree and Otree. The added cost of complicating the server setup severely should have some benefit. Apart from Ztree being ugly, are there any other advantages of Otree to program experiments?</p>

CC BY-SA 4.0
2021-05-20T11:12:18.263Z
Note that I tried to follow the advice here https://economics.meta.stackexchange.com/questions/120/should-questions-about-personal-experience-be-allowed to frame this rather subjective question more objectively by asking for specific advantages.
Papayapap
<soft-question><software><experimental-economics>
What are the advantages using Otree to progam economic experiments?
Papayapap
# What are the advantages using Otree to progam economic experiments?

(Asked by: username_0 on 2021-05-20)

I need to decide between learning Ztree and Otree. The added cost of complicating the server setup severely should have some benefit. Apart from Ztree being ugly, are there any other advantages of Otree to program experiments?

**Tags:** soft-question, software, experimental-economics
> **Comments:**
> **username_0**: Note that I tried to follow the advice here https://economics.meta.stackexchange.com/questions/120/should-questions-about-personal-experience-be-allowed to frame this rather subjective question more objectively by asking for specific advantages.  

---

## 2 answers

### Answer by username_2 on 2021-05-21. Score: 5 | Accepted answer

One irreducible advantage of [oTree](https://www.otree.org/) over [z-Tree](https://www.ztree.uzh.ch/en.html) is that you can *easily* reuse/imply the entire trajectories of results per entity (session/group/player) when doing [repeated games](https://en.wikipedia.org/wiki/Repeated_game). With z-Tree, it is rather complicated (not to say impossible?) to define dynamically temporal- or individual-based autocorrelated/interdependent/[recursive](https://en.wikipedia.org/wiki/Recursion#In_mathematics) games.

Another *notable advantage* is that you can also easily run (fully automated) [functional tests](https://en.wikipedia.org/wiki/Functional_testing) with oTree, be them [headless](https://en.wikipedia.org/wiki/Headless_software) or not, with random numbers following the distribution(s) or mechanism(s) you like, up to the generation of the final results, which is at best complicated if I remember well with z-Tree. Moreover, keeping in mind that it is increasingly mandatory to provide (in appendix) all the screenshots of the steps of an experiment, you can easily do so with oTree, using libraries such as [Selenium](https://selenium-python.readthedocs.io/) as soon as something changes.I remember me doing all that manually, with many [zLeaf](https://stackoverflow.com/questions/59521328/how-can-i-create-a-shortcut-to-zleaf-to-run-experiments-using-ztree)s opened, which was cumbersome to say the least. Having 3 screens was not enough...

Finally, learning oTree will strongly initiate your familiarity with a notorious web-framework, [Django](https://www.djangoproject.com/) (not the CMS), which means that learning oTree means learning it as well. Entirely class-based and [PEP8](https://www.python.org/dev/peps/pep-0008/)-compliant, it also means that via oTree, you will learn coding in Python the "right way". Moreover, if you wanna tweak your [frontend](https://en.wikipedia.org/wiki/Front-end_web_development), you will also start learning things such as [CSS](https://en.wikipedia.org/wiki/CSS), [HTML](https://en.wikipedia.org/wiki/HTML) and even [JavaScript](https://en.wikipedia.org/wiki/JavaScript). oTree's dividends are numerous.All that with a concrete goal in mind, which (to me) is the best manner to acquire new skills.

That being explained, there is now a new version of z-Tree which I do not know, i.e. [z-Tree unleashed](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7485551/) which may be far better than its ancestor.

> **Comments:**
> **username_0**: Thanks for the great answer. That point of learning Python and JavaScript the right way while having a concrete goal in mind is a huge benefit in hindsight. Why waste time learning an ugly language that only economists care about...  

---

### Answer by username_1 on 2021-05-20. Score: 2

The main advantage of oTree is that it works for both offline and online experiments. In contrast, zTree must be run offline. So oTree is more flexible. Even if your current experiment will be run in the lab, you might value this flexibility if you think you might run online experiments in the future.

The main disadvantage is that oTree can be harder to learn. Though obviously, this will depend on your current level of Python experience.

Another consideration is whether you know anybody who can help you learn either zTree or oTree. Perhaps I am not a natural programmer, but I would have found learning how to use oTree by myself pretty difficult.


---

