# Open source

Open source refers to a philosophy and practice characterized by making the code available (in the context of software), but the term is also used more broadly to refer to similar free culture principles in other fields, which provides the options to community not only to use the software but also build on the existing versions of the software and add e.g. features for the community needs.

## Open Source in the educational context

In Wikiversity we focus on learning resources and therefore we consider also the educational context of Open Source. Having the code available as Open Source the community does not need e.g. to build learning environments from scratch because existing libraries can be used to build and adapt the Open Source learning environment to requirements and constraints of the learner and the content. It allows to create learning tools for Wikiversity and appreciate standing "on the shoulders" of previous Open Source developers, that provided their contributions to the Open Source community for improvement. Forking allows branching the available Open Source software for special needs e.g. * in research for an application of learning analytics or
* for enhancing the version with e.g. with Speech Recognition for a specific support for handicapped students and integrate the tool in the local IT infrastructure of learning environments at schools, colleges, universities, ...

## Basic Workflow

* (Binary and Source Code) The source of the software can be analyzed, updated and improve by software engineer and developers while the binary code of the open source software will be executed on an Operating System to perform specifics tasks to
* (Openness and Validation of the Code) The source of the software is completely open to check if the software does, what it pretends to do.
* (Compiler/Interpreter) The users can compile the software on their Operating System with an Open Source Compiler to convert the source code into the binary executable form that is running on the Operating System of choice. An Interpreter reads the source code and interprets the code directly on the operating system. Compiler and interpreter convert the source code into an executable form for the processor of your computer. The main difference between Compiler and Interpreter is that the compiler does that once and then the binary is executed and the interpreter does that on execution time on the operating.
** (Compiler/Interpreter as Open Source Software) A compiler and interpreter is a software product so the Open Source philosophy is applicable on these software products as well. The compiler as Open Source software allows software engineers to check, fix, optimize and add additional features to the compilation workflows to improve performance, privacy, ...
** (Execution on Operating Systems and Hardware) The hardware processors in a computer perform at the end the work encoded in the Open Source software. The executions on different hardware and operating systems should be functional equivalent to the open source code provided by the developers. E.g. if the open source defines the sum $a+b$ of two decimal numbers $a:=3$ and $b:=5$ then developers would expect that independent of operating systems the result of $a+b=8$ independent of the used hardware and operating system.

## T-Diagram for a Compiler

The T-diagram for a compiler visualizes a task the compiler performs. The compiler in the diagram should convert source software in the programming language ADA into a functional equivalent software in destination language - The compiler itself is a software that is written in the programming language C.

## Example of Interpreter and Compiler

In this example we analyse the concept of Java as programming language. We will see both concepts of interpretation and compilation are combined to retrieve a platform independent execution on different hardware and operating systems. As mentioned above different processors "understand" and interpret byte code information differently. So consequence is, that byte code for processor A will not be executed functionally equivalent on a processor B that gets the same byte code sequence as input. Java uses a compilation from source code to Java Byte Code (JBC) and executes that on different hardware and operating systems with the Java Runtime Environment (JRE). This software design of Java uses the JRE as an interpreter that generates functional equivalent execution of the source on different hardware.
Now we visualize a machine/hardware that is able to ("understand") interpret the byte code BC1. In a diagram we use a square with a double frame to indicate hardware. See the diagram on the right in which interpreter is started on hardware, that "understands" the byte code BC1. The interpreter itself is now executed and though the interpreter is able load open source code in Python and interpret the code.
Basically the interpreter converts the code in python into a sequence of commands into byte code BC1 that is doing the job encode in the OpenSource code in python. Let us assume we have software, that does Open Source Speech Recognition.
* The T-diagram for compiler is a theoretical compiler that is written in Python,
* when you execute the compiler it will convert a C++ source into the byte code BC1.
* the blue triangle indicates that the compiler is running and doing the job.
* to make the compiler run we put all the elements together.
* in the diagram below an Open Source speech recognition software written is compiled in byte code BC1 that is running on hardware that is able to interpret the byte code. The generated byte code is functional equivalent to source code. The different is that we have hardware that can execute the byte code BC1 but we do not have an interpreter for the open source code. So the Open Source code for speech recognition cannot be executed directly. Theoretically we could run the Open Source speech recognition if the we C++ interpreter available that runs a BC1 hardware.
* In the following diagram the generated /compiled speech recognition software in byte code BC1 is regarded. In this context the speech recognition software are regarded as input file (in C++) and output file in the byte code BC1.
* at the bottom on the right hand side in the output file from the compilation process is not interpreted on a machine that take command in byte code as input and executes the code. The blue triangle indicates that the software in running and here to software take audio input from a microphone and converts the audio input into recognized text output.
* the main lesson learnt is that Open Source software is used in different use-cases. The compilation of the source code and in an execution context on a hardware where the functional equivalent software in BC1 is executed.
* explain the interpretation process how the compiler is running. Explain the relevance for offline speech recognition in an educational setting for processing audio input with an Open Source compilation and interpretation infrastructure locally in a digital learning environment.

## Learning Tasks

* (T- and I-diagrams for Java as Programming Language) Analyse the concept of Java and do a presentation about Interpreter and Compiler and how those principles work together for open source software created with Java. Explain the role of platform independency of the Java software design principle.
* (Compiling and Executing an Open Source Editor) Search e.g. for a open source text editor written in Java for OpenJDK (Open Java Developers Kit) and explain that workflow to the other students in your class or seminar. Explain with T-diagrams and I-diagrams how the Open Source editor written in Java is compiled, executed for editing specific files. Explain the role of input and output files in the context of an editor in comparison to input and output file of compilers.
* Compare the workflow in Java with an approach for Linux Operating Systems where open source code for the operating system is compiled from C++, C# to byte code that can be executed directly on hardware and operating system.
* (Operating Systems) Operating System are doing their job between hardware and the Open Source applications. The hardware can be the same but on one computer an OpenSource Linux operating system is installed and on the other computer a different operating system. Extend the T-diagrams and I-diagrams with an Operating System on top of the hardware in mind. What are important requirements and constraints for compiling and executing Open Source applications on different operating systems. Create I-diagrams and T-diagrams for that context and you might want to include even the use of virtual machines implemented as OpenSource infrastructure. What are the benefits to write code for an OpenSource application and create with different compilers binaries as executable byte code on Linux BC1, LineageOS on mobile device BC2 or even on proprietary operating systems.
* (Open Source Speech Recognition) Assume we compile in an Open Source speech recognition software from Java source code into Java Byte Code (JBC). This functional equivalent code in JBC can now be executed on different hardware and operating systems. Create the I-diagrams for the interpretation on different machine and the T-diagram for compilation of the open source software. What are the benefits and challenges for such a scenario for the developer.
* (Bootstrap - Compiling a Compiler) Now we assume we have a compiler for Python that is written in Python. This compiler compiles Python source code into a specific byte code BC1. Furthermore we have a Python interpreter that is able to interpret Python code and execute the Compiler written in Python on a machine the executes byte code BC1. Paint the I-diagram and T-diagram for the compilation of open source software written in Python. Create with the tools you have as learning task a binary for Python compilerhttps://pegjs.org/ (Java to BC1) that runs natively on the machine BC1 and is not interpreted with an OpenSource Python interpreter for compiling Python sources in byte code BC1.
* (Browser as Interpreter) Web application can run offline without internet connectivity. In this case the code is implemented in Javascript and the GUI (graphical user interface) is designed in conjunction with CSS style sheets and underlying HTML. Create I-diagram for a parser written in Javascript (e.g. with PEG - Javascript Parser Generator). What are the benefits and constraints of having a parser or interpreter available within the browser offline in Javascript without the need of a backend to perform basic tasks. Define areas of application in an educational setting e.g. Computer Algebra Systems (like Algebrite) running in a browser? Wiki2Reveal is another example of browser based conversion of MediaWiki sources into RevealJS presentation usable in an educational environment to annotate Wikiversity slides in lectures and seminars.

## Objectives

Design of learning resource will support learners for the following objectives:
* be able to access the application of open source software and identify requirements and constraints of applications,
* assist learner in installation, maintenance and usage of open source software on different levels:
   * Open Source Operating Systems
   * Open Source Software
   * Open Source on Open Hardware
* learn about challenges and workflows to migrate towards an Open Source infrastructure of multiple IT devices.
* Calculate total cost of ownership
For more info, see open source (Wikipedia).

## Learning Task

* (Digital Divide) Explore the benefits and challenges for Open Source Software, the maintenance, ... and analyze the relevance for working against the Digital Divide.
* (Sustainable Development Goals) Explain the relevance for Sustainable Development Goals - check the different goals for application of Open Source software and identify possible Open Source software for the specific goal.
* (Low-Cost Technology) Explore the concept of low-cost technology to reach a maximum number of people.
* (Open Community Approach) The Open Community Approach is a generalisation of the Open Source principle. Explain the differences and join ideas that are shared between Open Source and the Open Community Approach!

## Idea

Open source software development has begun a revolution. The three major characteristics are:
* open source revision control/repository systems such as Git,
* pair programming that starts with modifying examples,
* Test driven development (TDD) which involves Unit Testing documented by DICE.
A majority of engineering projects involve software. Typically the next team finds it easier to start over rather than re-use software. This has to change. The above tools are designed to emphasize software documentation and creation that is rapidly evolving in the open software community.
The goal of this project is to develop introductory tutorials in each of the above topics, figure out how to integrate this within a general engineering introduction course, and how this is linked to wikiversity documentation.

## Version Control Systems

A community of developers create bug fixes, improve the software and create new releases in a team. Explain the role of Version Control for the Open Source community.
* GIT
* DICE