Skip to content

whats_new_alfred3

Johannes Brachem edited this page Apr 29, 2019 · 3 revisions

What's new in Alfred 3?

Quite a lot actually. Let's dive in!

New experiment metadata field EXP_AUTHTOR_MAIL

  • In each script.py, you define the expName, expVersion and expType (now called EXP_NAME, EXP_VERSION and EXP_TYPE, see below). In Alfred 3, we added thte field EXP_AUTHOR_MAIL, which is meant to contain the email address of the experiment author. If you do not set this constant, Alfred will throw an error.

Why did we do this?

  • This change is most meaningful if you work with Mortimer to host and manage your experiments: You will only be able to download your experimental data via mortimer, if the EXP_AUTHOR_MAIL is identical to the email address that belongs to your mortimer account. This way, we can make sure that only you can access your experimental data.
  • This change also means, that experiment titles now only need to be unique for each author. Up until now, all experiment titles had to be unique.

Port from Python 2.7 to Python 3

This is a major change. Python 2.7 will retire on January 1, 2020, so we made the change to the future in time. Your Alfred code will now follow the state of the art of Python. Let's take a closer look at what the upgrade to Python 3 means.

  • All strings in Python 3 are unicode by default. In Python 2.7, strings with umlauts like ä, ö or ü needed to be preceded by a u to turn them into unicode-strings: u"Example strüng.". Otherwise, the code would not work. This often lead to unnecessary errors and is not necessary anymore.

  • Printing works a little differently. You used to be able to print output to the console with a command like print "this string". This syntax is now deprecated and will throw errors. From now on, you need to use the print statement like any normal function: print("this string").

  • Integer division works differently. In Python 2.7, if you divided one integer by another, Python would execute modulo division: 3 / 2 = 1. In Python 3, normal integer division will work as expected: 3 / 2 = 1.5. For modulo division, you can use a double slash: 3 // 2 = 1.

  • A more detailed overview can be found here: https://docs.python.org/3.0/whatsnew/3.0.html

Don't worry about having to change all your existing code to be compatible with Python 3.7. We prepared a script for you that automatically updates your old script.py.

Call me by my new name

We completed a major overhaul of our naming system in order to follow the most recent PEP (Python Enhancement Proposal) guidelines and make some important terms more clear (Don't worry about having to change all your existing code. We prepared a script for you that automatically updates your old script.py). The most important changes are these:

  • Question becomes Page. In general, we changed all occurences of Question to Page, because that is a better reflection of how an alfred experiment is structured: A single page can contain multiple elements, which might also be regarded as questions.
  • QuestionGroup/ QG becomes Section. Parallel to the change from Question to Page, we changed QuestionGroup and QG to Section. We think this is a more concise label for the structure of Alfred Experiments.
  • lowerCamelCase becomes underscore_case. The remaining changes reflect our effort to adhere to the Python Enhancement Proposal (PEP - click for more info) by switching from lowerCamelCase (starting a new word in function or variable names with a capital letter) to underscore_case (separating words in function or variable names with an underscore). ATTENTION: This change affects almost every function call!
  • The experiment metadata variables expName, expVersion and expType are now writtten as EXP_NAME, EXP_VERSION and EXP_TYPE in order to reflect their importance and their status as constants.

An overview of all changed names can be found here: Overview of all changed names

New way to deal with browser commands (forward, backward, refresh) in web experiments

In web experiments, subjects used to be able to cause trouble by using the browser controls (forward, backward, refresh) instead of the experiment controls at the bottom of the page to move through an experiment. In some cases, this could render the subject's data unusable. Now, when a subject uses the browser controls, Alfred will always return the current state of the experiment. This way, no more data should be lost.

Fixed a bug in the saving agent

When quickly moving through an experiment, the saving agent sometimes didn't complete it's tasks correctly and basically crashed. This does not happen anymore.

More secure handling of database login data

We implemented a three-step process to access database login data:

  1. Provide encrypted login data in environment variables
  2. Provide encrypted login data in config.conf
  3. Provide raw login data in config.conf (not recommended, use only for testing)

The first two options make it much safer to share your code, e.g. on the OSF, because you don't have to worry about accidentally sharing secrets anymore.

Use SSL to connect to your database

If your databse is correctly equipped with a valid commercial SSL certificate, you can now simply set the option use_ssl = true in the config.conf to enable a secure connection via SSL. You can also use self-signed SSL certificates, if you set the option ca_file_path to the file path of your Certificate Authority (CA) public key file (often a .pem file).

No more pure QT experiments

We completely removed pure QT experiments from the framework. Those have recently seen very little use and have some drawbacks compared to web experiments and qt-webkit (qt-wk) experiments.