Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
PROGRAMMING LANGUAES AND COMPILERS 1 “Programming languages and compilers in today’s world.” Joseph Kitchen CPT 423 February 16, 2014 Dexter E. Fraser Southwestern College Professional Studies PROGRAMMING LANGUAES AND COMPILERS 2 “Programming languages and compilers in today’s world.” Over the last couple of years I have been learning about multiple programming languages and the compilers they use to write their code but I never really had the time to research as much about the different languages as I would have like too. There are so many different languages out there and they all do something different, but each one is unique in its own way. I have only had the opportunity to learn a small handful of these programming languages and while some came easy to me others were a bit of a challenge. Over the next couple pages I would like to cover some of the history and functions of some of the more popular languages out there today to hopefully give myself and you a better understanding of these complex languages. Programming Languages Programming languages com in all shapes and sizes, some require special compilers to be able to write the code needed to make the program run while others simply need a basic text editor. Regardless of what type of programming language you prefer, each on serves its own purpose and now I would like to go over some of the more popular programming languages of today. Java Programming The first language I looked into is probably one of the most popular in the computer programming world. To understand any computer language I believe you must first look at where it began. In the early 90s, extending the power of network computing to the activities of everyday life was a radical vision. In 1991, a small group of Sun engineers called the "Green Team" believed that the next wave in computing was the union of digital consumer devices and PROGRAMMING LANGUAES AND COMPILERS 3 computers. Led by James Gosling, the team worked around the clock and created the programming language that would revolutionize our world. The Green Team demonstrated their new language with an interactive, handheld home-entertainment controller that was originally targeted at the digital cable television industry. Unfortunately, the concept was much too advanced for them at the time. But it was just right for the Internet, which was just starting to take off. In 1995, the team announced that the Netscape Navigator Internet browser would incorporate Java technology. Today, Java not only permeates the Internet, but also is the invisible force behind many of the applications and devices that power our day-to-day lives. From mobile phones to handheld devices, games and navigation systems to e-business solutions, Java is everywhere. The biggest advantage to the Java programming language is that it produces platform independent applications and includes many forms of security built in. Java has and will continue to revolutionize the way information is transferred across the lines of communication which interconnect our world. The way the security features in Java work is that it protects the user from hostile, malicious, and potentially damaging code through the use of a hierarchy of interrelated security mechanisms (Youmans, 1997). Java accomplishes this high level of security through rigorous checks and precautions that are enacted to ensure the security of the local machine in which the Java code will be executed on. However, even one of most popular programming languages out there cannot escape criticism from its flaws. One of the complaints about Java is that is requires a compiler be shipped with the webserver, which causes a problem since the owners of Java do not give away the jar library containing their javac compiler. Another complaint is that Java page syntax errors can cause surprisingly odd and PROGRAMMING LANGUAES AND COMPILERS 4 useless error messages. This is due to the fact the page is transformed into a servlet and then compiled. Good Java tools can help narrow down errors to likely syntax error locations, but even the best of tools will probably have problems making all error messages meaningful. Regardless of its flaws Java remains a stable in the programming community, there is no doubt Java will be one of the more popular languages for years to come. Hypertext Markup Language One of my favorite languages would be Hypertext Markup Language (HTML). Web pages are essentially text files that are written in Hypertext Markup Language that then displays the things we want them to in a web browser. Hypertext refers to a method of organization in which data sources are interconnected through a series of link or hyperlinks that users can activate to jump from one piece of information to another (Carey, 2012). Most people use these hyperlinks on almost an everyday basis without even thinking about it. Any time you search for something on Google and click on one of the results you are using hyperlinks. The next part is the markup language that is the language that describes the content and structure of a document by identifying different elements in the document. For example, if a website contains paragraphs, images, captions, and so forth; each of those items could be identified as a distinct element using a markup language. Hypertext Markup Language has evolved over the year just as the Web as evolved. In the beginning the first poplar markup language was the Standard Generalized Markup Language (SGML). Even though this was a powerful language it was very complex and was limited to organizations that could afford the cost and overhead of maintaining complex SGML environments. However SGML can be used to create other markup languages PROGRAMMING LANGUAES AND COMPILERS 5 that are tailored to specific tasks and are simpler to use and maintain, HTML was one of those languages (Carey, 2012). In the early years of HTML, no single organization was responsible for the language itself and web developers were free to define and modify the language in whatever way they thought best. This obviously led to incompatibilities between various browsers, which you even see today when a website might work correctly one Internet Explorer but not Google Chrome. Finally, a group of web designers and programmers called the World Wide Web Consortium (W3C), created a set of standards or specifications for all browser manufacturers to follow. If all the browsers manufacturers follow the guidelines set forth the W3C then there shouldn’t be issues with the compatibility of their browsers and the website developed using HTML. However, since HTML is always changing and so are browsers, changes are always being made to the language. Some of the older versions of the language are often deprecated or phased out. HTML has been through many changes since it’s development in 1989 and after twenty years in 2009 HTML5 emerged as the newest standard for the next generation of HTML. One of the best things about HTML is that since it is simply a text files you can create websites using nothing more than a basic text editor such as Windows Notepad which is free on everyone’s computer. For small projects a basic text editor will suffice however if you are working on a large project you would want to use publishing software like Adobe Dreamweaver to manage all the code and features of the website. PROGRAMMING LANGUAES AND COMPILERS 6 C++ Another popular programming language today is C++, a language that’s history dates back to 1979. In 1979, Bjarne Stroustrup was working a language called Simula, which as the name implies is a language primarily designed for simulations. The Simula 67 language, which was the variant that Stroustrup worked with, is regarded as the first language to support the object-oriented programming paradigm. Stroustrup found that this paradigm was very useful for software development; however the Simula language was far too slow for practical use (Amaya, 2014). Shortly thereafter, he began work on "C with Classes", which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming into the C language, which was and still is a language well-respected for its portability without sacrificing speed or low-level functionality. In 1983, the name of the language was changed from C with Classes to C++. The ++ operator in the C language is an operator for incrementing a variable, which gives some insight into how Stroustrup regarded the language (Amaya, 2014). Now that we know a little bit about the history of C++, let’s look at what the language has to offer a programmer. First off, C++ compiles directly to a machine's native code, allowing it to be one of the fastest languages in the world, if optimized. C++ is also a language that expects the programmer to know what he or she is doing, but allows for incredible amounts of control as a result. The latest C++ standard supports both manifest and inferred typing, allowing flexibility and a means of avoiding verbosity where desired. Since C++ is a language that directly builds off C, it is compatible with almost all C code. C++ can use C libraries with few to no modifications of the libraries' code. C++ has over three thousand libraries making it one of the PROGRAMMING LANGUAES AND COMPILERS 7 most diverse languages out there (Amaya, 2014). As one of the most frequently used languages in the world and as an open language, C++ has a wide range of compilers that run on many different platforms that support it. Code that exclusively uses C++'s standard library will run on many platforms with few to no changes. The one criticism C++ seems to get however is that it is a large language and take a longer time to learn than your more mainstream languages such as Java or Python. The C++ languages unusual combination of strengths makes it an essential tool for the serious engineer. Although you may take years to fully understand some of its features, you can benefit from its power immediately. Python The Python programming language was implemented in December of 1989 by Guido van Rossum in the Netherlands. Because of his frustration with the ABC programming language, Rossum decided to design a simple scripting language that possessed some of ABC’s better properties but none of its problems. Python is a remarkably powerful dynamic programming language that is used in a wide variety of applications. Python is often compared to other popular languages such as Java or C++, which are some of the more popular languages used today in programming. Some of the key features of Python that separate it from the other languages are that it is has a very clear and readable syntax, strong introspection capabilities, exception-based error handling, and very high level dynamic data types. Python also has a very extensive standard libraries and third party modules making programming for new programmers a lot easier. The current standard library has 165 top-level modules and packages and a total of almost 300 modules (Parkin, 2014). Another benefit to using Python is that is integrates well with other PROGRAMMING LANGUAES AND COMPILERS 8 languages such as .NET and Java by using compilers like IronPython and Jython respectively. Python is also available for all major operating systems such as Windows, Mac, and Linux making it one of the most diverse languages out there today. Python can also be used to perform many different kinds of tasks. Python’s rich library of modules lets you apply it to almost any kind of programming endeavor: database managing, number-crunching, image processing, games, Web servers, even cryptography. Because of it many features and capabilities Python was awarded the most popular programming code of 2013 followed by Java, C++, and JavaScript. Structured Query Language (SQL) SQL is the last language that I am going to cover and is the standard language for accessing and manipulating databases. As you can imagine this would be a big deal in today’s business world since so much information is stored in databases. SQL was first introduce commercially in 1979 by Relational Software Inc. and since then has become the standard relational database management system language (Murach, 2008). The strengths of SQL provide benefits for all types of users, including application programmers, database administrators, managers, and end users. Technically speaking, SQL is a data sublanguage. The purpose of SQL is to provide an interface to a relational database such as Oracle Database, and all SQL statements are instructions to the database. In this SQL differs from general-purpose programming languages like C. SQL lets you work with data at the logical level. You need to be concerned with the implementation details only when you want to manipulate the data. For example, to retrieve a set of rows from a table, you define a condition used to filter the rows. All PROGRAMMING LANGUAES AND COMPILERS 9 rows satisfying the condition are retrieved in a single step and can be passed as a unit to the user, to another SQL statement, or to an application. You do not have to deal with the rows one by one, nor do you have to worry about how they are physically stored or retrieved (Murach, 2008). Another benefit to the SQL language is that all major relational database management systems support SQL, so you can transfer all skills you have gained with SQL from one database to another. In addition, all programs written in SQL are portable so they can often be moved from one database to another with very little modification. Programming language compilers Javac The first programming language that I covered was Java so the first compiler only seems right to go with javac, the compiler for Java. The Java programming language compiler, javac, reads source files written in the Java programming language, and compiles them into bytecode class files. Optionally, the compiler can also process annotations found in source and class files using the Pluggable Annotation Processing API. Javac is also a command line tool but can also be invoked using the Java Compiler API. Javac can also accept source code defined by the Java Language Specification (JLS) and produce class files defined by the Java Virtual Machine Specification (Urma, 2012). The javac compiler can be divided into four basic parts. The first part is the compiler is the front end, which includes the scanner and parser which read the Java source and build an abstract syntax tree (AST) representation of the source code. The front end must also be able to read the symbol information in the Java ".class" files that are referenced by import statements. After converting the source into an AST, the front end resolves symbol PROGRAMMING LANGUAES AND COMPILERS 10 declarations, does semantic analysis and builds the symbol table and other supporting data structures. The second part of the compiler is the Java symbol table which is one of the core data structures in a compiler. Unlike the AST, which can be deleted after the flow graph is built, the symbol table "lives" as long as the Java source is being compiled. Java's scoping and lack of unique names within a scope complicate symbol table construction. The third part is the middle pass that performs tree to tree transformations and builds the control flow graph of basic blocks that the optimizer works on. Then finally the fourth part is the optimizer which builds data structures that describe the variable usage throughout the control flow graph for the method (this is usually called global data flow). This information is then used to optimize data references globally within a method (Kaplan, 2000). Pysco One of the more popular compilers for the Python language is Psyco which allows you to run your existing Python software much fast without needing to change your source. Psyco is a kind of just-in-time (JIT) compiler, a little bit like what exists for other languages such as Java or C++. Psyco emits machine code on the fly instead of interpreting your Python program step by step. The difference with the traditional approach to JIT compilers is that Psyco writes several versions of the same blocks, which are optimized by being specialized to some kinds of variables. There are several ways that Psyco is able to improve upon what Python does. In the first place, Psyco compiles operations to somewhat optimized machine code; in itself this produces only slight improvements, since what the machine code needs to accomplish is the same as what Python's dispatched functions do. Moreover, what is "specialized" in Psyco PROGRAMMING LANGUAES AND COMPILERS 11 compilation is more than the choice of Python bytecodes, Psyco also specializes over variable values that are known in execution contexts (Mertz, 20002). One of the biggest benefits to using Pysco is it’s speed, which will run typically four times faster with and unmodified interpreter and unmodified source code. However, to go along with that speed, Pysco usually a lot of memory compared to other compilers and can only run on machines with a i386 CPU architecture. Conclusion In conclusion, I have covered the many different programming languages used today in the information technology world. From one of the most popular and diverse languages in Java, to the up and coming languages like Python, they all have their own unique benefits and flaws. I have had the chance to learn about multiple languages and will say they all have their pros and cons. When working with separate applications you can’t go wrong with the Java language, if you are working with databases, then SQL would be your language of choice. In my opinion one of the most user friendly and fun languages to work with is HTML. I say HTML is one of the best because it does not require any kind of compiler to be able to use it and it is very easy to learn. With HTML anybody can learn to build their own websites and in today’s world that kind of knowledge is priceless. Expertise in any of the languages can benefit your career in software development, the only question is what type of programming you want to do and how you want to impact the world. PROGRAMMING LANGUAES AND COMPILERS 12 References Carey, Patrick. (2012). HTML and CSS 6th Edition. Boston, MA: Cengage Learning. Youmans, B. (1997). Java: Cornerstone of the Global Network Enterprise? Virginia Tech. Retrieved from http://ei.cs.vt.edu/~history/Youmans.Java.html Murach, J., Syverson, B. (2008). SQL Server 2008. Coarsgold, CA: Mike Murach & Associates. Amaya, S. (2014). History of C++. Cplusplus. Retrieved from http://www.cplusplus.com/info/history/ Urma, R.G. (2012). How to Modify Javac. Java Magazine. Retrieved from http://www.oraclejavamagazine-digital.com/javamagazine/20120708?pg=51#pg51 Arigo. (2010). Psyco. Sourceforge. Retrieved from http://psyco.sourceforge.net/introduction.html Parkin, T. (2014). Python Programming Language. Python Software Foundation. Retrieved from http://www.python.org/about/ Mertz, D. (2002). Using Psyco, the Python specializing compiler. DeveloperWorks. Retrieved from http://www.ibm.com/developerworks/linux/library/l-psyco/index.html