Regardless of the level of reproducibility you will need to prepare your environment with the following common steps:
- clone this repo:
git clone https://github.com/sola-st/thinking-like-a-developer.git
- make sure python 3 (we used Python 3.8) is installed, by running:
if not install it with:
python --version
sudo apt install python3.8
- from the main folder, install the dependencies of this analysis by running:
Optional: we encourage you to use a virtual environment if possible: conda or venv;
pip install -r reqs.txt
- download the data and place the unzipped content in the
data
folder of this repo: https://doi.org/10.6084/m9.figshare.14462052 - from the main folder of the repo, launch the Jupyter notebook instance
jupyter notebook
- From the browser page navigate to the notebooks folder which contains important notebooks you will need in the following step.
If you did the common steps in the previous paragraph your environment is ready, and the installation to reproduce the comparative study is completed. Move back to the README.md to reproduce the analysis.
Before starting double check that you completed the previous common steps in the Environment Preparation paragraph above.
The setup to collect human attention relies on three component:
- the web interface of the Human Reasoning Recorder (HRR) (written in NodeJS) that show the 20 method naming tasks to the participants. This interface is hosted on the free application instance from Heroku).
- the database containing the actual collected data and the info on which experiment set has been delivered to the user (hosted on a free instance of MongoDB Cloud)
- (OPTIONAL) the Amazon Mechanical Turk for requester account. Here we recruit participants and validate those that send us a valid submission. Note that this is the only part that needs investment, so we invest money only on real data not on infrastructure maintenance since we use free resources..
To deploy this tool for a software engineering experiment you need:
- an Heroku account (FREE)
- a mongodb account (FREE)
Heroku will host our application, whereas MongoDB will host our NoSql Database to store the logs of the participants.
Follow these steps:
- Create heroku account on heroku.com
- Download and install Heroku CLI (google it and download)
Go to the folder where you cloned the project and open the CLI there:
- create an ssh key (https://devcenter.heroku.com/articles/keys)
ssh-keygen -t rsa
- add key to heroku account. In this project CLI:
heroku keys:add
- Create the link between this git and the heroku remote. In this project CLI:
heroku create <app_name_you_want_it_to_be>
- Add a new heroku remote. Go to the folder where you cloned this project andn run:
git remote add heroku https://git.heroku.com/<app_name_you_want_it_to_be>.git
- Create an account on cloud.mongodb.com
- Create a new project via website. Let's name it:
MyProject
. - Open the project and create a cluster. Choose the FREE options with 512 MB of storage space.
- Go to the
security section > database access
and Add new database user - Select a user name and password, then add user
- Go to
security section > network access
and Add IP address and allow from everywhere (since we do not know where heroku will deploy our app precisely), then confirm. - Go to
data storage section > clusters
and click on Connect in yourMyProject
cluster. - Select Connect your application
- Copy the url endpoint
Our NodeJS web interface, hosted on Heroku, needs the credentials we just created to store new documents (participants logs) in the database:
- Create a copy of the configuration file at
config/template.settings.yaml
, rename it toconfig/settings.yaml
- Insert the username and password from mongodb, replacing
<your_username>
and<your_password>
. - Insert the url endpoint, replacing
<your_endpoint>
. - Save and commit your changes locally
- Push it to heroku. In this project CLI:
git push heroku master
Troubleshooting: Sometimes you might need to force the push:
git push heroku master --force
We need mongoexport
to efficiently download data from mondodb. Follow the official documentation for that: https://docs.mongodb.com/database-tools/mongoexport/
If you used the default configuration, the JSON files in the folder data/datasets/methods_showed_to_original_participants
have been already deployed to the heroku nodejs app, nevertheless the information on whether each expeirment dataset has been already consumed by a participant or not, that is stored in the mongodb database.
In this step, we add records to the mongodb database to let it know that heroku has new experiment sets to show to participants.
Open and run the following notebook top to bottom: notebooks/Uplaod_Available_Experiment_Sets.ipynb
.
If everything was successful, you can access your Human Reasoning Recorder interface directly from any computer! To get the url get the name of the application with:
heroku apps
=== <YOUR_EMAIL> Apps
<YOUR_APP_NAME>
And then go to <YOUR_APP_NAME>.herokuapp.com
to see your Human Reasoning Recorder! Congratulations!
A demo of the environment is available here (the tool starts on demand, so it might take up to 30 seconds to start if you are the first user of the day):
Try the Human Reasoning Recorder NOW!
Startup intro page:
Before asking we inform the participant about the task:
3.1 Interface to explore the method body and choose one of the alternatives:
3.2 Deblurring based code exploration:
3.3 Click on tokens to make them always visible:
We ask "How difficult was the previous question?" right after every method inspection.
Remember that the platform is fully customizable: the task can be changed according to your needs, it takes only a simple JSON file as input where you:
- ask your code related question
- propose your custom list of options
- provide a code snippet (and the tokenization that you want)
- provide a custom "after task" question with a grading scale
The platform will record the answers of the user together with all the events with a timestamp (e.g. mouse over token, clicked tokens, mouse over alternative) to let you perform your custom analysis and answer your research questions.
Now that you had a look at the interface, why not to try the experience by yourself? Try the Human Reasoning Recorder NOW!