Sunday, September 14, 2014

Brython -- an introduction

In this blog post, I am going to briefly do an overview on Brython, how to install several versions of it, and ways to implement it as a student.

What is Brython?
Brython is a way to use python instead of javascript for browsers.
However, the only way to implement brython on web pages is to source it from a JavaScript file. The convenience is able to write python script inside a HTML file or to have a python program (.PY file) executed by HTML controls.

How do I use Brython?
Taken from the github repository of Brython:
To use Brython, all there is to do is .
  1. load the script brython.js.
  2. run the function brython() on page load.
  3. write Python code inside tags <script type="text/python">.
Note that Brython implements Python 3 so several 2.7 methods/techniques won't be applicable.

Where to download Brython:
https://github.com/PierreQuentel/brython/releases

There are two different files:
The latest version of brython is the necessary javascript files to code Python into a html file.
The site mirror file contains a clone of the brython.info website that includes documentation and an online script editor console (similar to CPython).

How does Brython work?
Python scripts are converted to JavaScript code, which might explain why it compiles 3-5 times slower. In the FAQ (http://brython.info/doc/en/index.html) , the developers explain circumstances concerning run-time:
  • the time to translate Python into Javascript, on the fly in the browser. To give an idea, the module datetime (2130 lines of Python code) is parsed and converted to Javascript in 0,5 second on an ordinary PC
  • JavaScript code generated by Brython must be compliant with the specifications of Python, including the dynamic nature of the search attributes, which leads to unoptimized Javascript code


Sunday, September 7, 2014

Infrastructure as a Service as a teaching tool

On upcoming blog posts I will be documenting (technically and figuratively) several website that can be used in Computer Science classes. These websites have been chosen for their ability to emulate a Unix environment (primarily for python scripting use) and the ability to share and collaborate the code with instructors and other students.

The following websites:
www.koding.com
brython.info
Cloud9
IDEone
Python Anywhere

Of these three websites, I will document and assess their ability for use for beginning software developer students.

The criteria for assessing these abilities:
  • Ease of use in usage.
  • Ease of use in installing (brython).
  • The capabilities of each website in terms of development environments.
  • Reliability of each website.
  • The ability to collaborate and/or evaluate source code.
  • The aesthetic design of each website.
  • The overall usability for each website.
The websites will then be compared with their strengths and weaknesses and it will ultimately be up to the reader to decide which platform best fits their needs in a classroom.