A Comparison of C++, C#, Java, and PHP in the Context of E-Learning
Total Page:16
File Type:pdf, Size:1020Kb
A Comparison of C++, C#, Java, and PHP in the context of e-learning MIKAEL OLSSON KTH Information and Communication Technology Master of Science Thesis Stockholm, Sweden 2009 TRITA-ICT-EX-2009:8 A Comparison of C++, C#, Java, and PHP in the context of e‐learning Mikael Olsson April 30, 2009 Master’s Thesis in Computer Science Royal Institute of Technology Examiner: Prof. Gerald Q. Maguire Jr. ‐ i ‐ Abstract The first part of this master thesis presents an effective method for producing video tutorials. This method was used during this thesis project to create tutorials on the e- learning site PVT (http://www.programmingvideotutorials.com). Part one also discloses how the production method was developed and how tutorials produced using this method compare to professional video tutorials. Finally, it evaluates the result of this thesis work and the efficiency of the production method. The second part of this thesis compares the syntactical similarities and differences between four of the languages taught via video tutorials for PVT. These languages are: C++, C#, Java, and PHP. The purpose of this comparison is to provide a bridge for programmers knowing one of these languages to rapidly learn one or more of the other languages. The reason why this would be necessary is because there is no single language suited for every area of software development. Knowing a multitude of languages gives a programmer a wider range of job opportunities and more choices in how to solve their problems. Part two of the thesis also includes a comparison of Java and C# in the context of a video tutorial series that shows how to build a basic text editor. Sammanfattning Den första delen av denna examensredovisning beskriver en effektiv metod för att producera videokurser. Denna metod har använts under detta examensarbete för att skapa kurser på utbildningssajten PVT (http://www.programmingvideotutorials.com). Del ett berättar också hur produktionsmetoden utvecklades och hur kurser producerade enligt denna metod står sig mot professionellt skapade videokurser. Slutligen utvärderas resultatet av examensarbetet och effektiviteten av produktionsmetoden. Den andra delen av denna redovisning framför de syntaktiska likheterna och olikheterna mellan fyra av de språk som har lärts ut via videokurser på PVT. Dessa språk är: C++, C#, Java, och PHP. Meningen med denna jämförelse är att underlätta för programmerare som kan ett av dessa språk och som snabbt vill lära sig ett eller flera av de andra språken. Anledningen till varför detta skulle vara nödvändigt är för att det inte finns något enstaka språk anpassat till alla områden av programutveckling. Att kunna ett flertal språk ger en programmerare ett bredare utbud av jobbmöjligheter och mer val i hur han eller hon kan lösa sina problem. Del två av redovisningen inkluderar också en jämförelse av Java och C# i sammanhanget av en videokurs som visar hur man bygger en enkel text editor. ‐ ii ‐ Table of Contents 1. Introduction ................................................................................................................ 1 2. Developing a Production Method ................................................................................ 3 2.1 Updatable ..................................................................................................................................... 3 2.2 Convenient ................................................................................................................................... 3 2.2.1 Choosing Video over Text ..................................................................................................... 4 2.3 Rapid Production .......................................................................................................................... 5 2.4 Relevant ........................................................................................................................................ 5 3. Production Method ..................................................................................................... 7 3.1 Work Environment ....................................................................................................................... 7 3.2 Outline .......................................................................................................................................... 7 3.3 Script ............................................................................................................................................. 8 3.4 Examples ....................................................................................................................................... 8 3.5 Snapshots ..................................................................................................................................... 9 3.6 Audio ............................................................................................................................................ 9 3.7 Production .................................................................................................................................... 9 4. Evaluation ................................................................................................................. 11 4.1 Production Results ...................................................................................................................... 11 4.2 Production Method Efficiency .................................................................................................... 11 4.2.1 Optimizations to the Production Method .......................................................................... 12 4.2.2 Time Needed to Update Sections ....................................................................................... 13 4.3 Production Method Comparison ................................................................................................ 13 4.3.1 Advantages ......................................................................................................................... 13 4.3.2 Disadvantages ..................................................................................................................... 14 5. Basic Syntax and Semantics ....................................................................................... 15 5.1 Data Types .................................................................................................................................. 15 5.2 Variables ..................................................................................................................................... 15 5.3 Constants .................................................................................................................................... 16 5.4 Comments .................................................................................................................................. 17 5.5 Operators .................................................................................................................................... 17 5.6 Strings ......................................................................................................................................... 18 5.7 Arrays .......................................................................................................................................... 19 5.7.1 Multidimensional Arrays .................................................................................................... 19 5.8 Pointers....................................................................................................................................... 20 6. Intermediate Syntax and Semantics .......................................................................... 22 6.1 Conditions ................................................................................................................................... 22 6.1.1 If .......................................................................................................................................... 22 6.1.2 Switch ................................................................................................................................. 22 6.1.3 Ternary................................................................................................................................ 23 6.2 Loops .......................................................................................................................................... 23 6.3 Jump Statements ........................................................................................................................ 24 6.4 Functions .................................................................................................................................... 25 6.4.1 Passing Arguments ............................................................................................................. 25 6.4.2 Method Overloading .......................................................................................................... 26 6.4.3 Variable Parameter Lists ..................................................................................................... 27 ‐ iii ‐ 6.4.4 Main Method ...................................................................................................................... 27 7. Advanced Syntax and Semantics ............................................................................... 29 7.1 Class ...........................................................................................................................................