F01.justanswer.com



Austin Wakeham & Paolo Evarretta15 April 2020CS 355Dr. ZengCS 355 Final PaperAll programming languages are unique in their own way, but it is important to note that although the syntax may look vastly different that doesn’t necessarily mean the functionality of the language is much different. In this comparison we will be putting three Object-oriented language toe to toe in order to summarize and create a researched opinion on how each language can be utilized in an optimized and successful manner. Object-oriented programming is a program tha defines data types within data structures, that can then be utilized to apply it to said data structure and in this document we will be comparing three that in recent history have been growing exponentially in popularity that being: C#, PHP, and the notorious Python. As we take a deep dive into the heart of Object-oriented coding to figure out what they really bring to the table.C# is one of the C like object-oriented languages that is still widely used today. Some of the main reasons that it is still used today are, its capability to be used in different area or types of projects, the balance level of complexity in learning the programming language, and the extent of features and capacity it provide to the programmer. For some history of C#, the programming was developed by prominent Danish software engineer Anders Hejkberg at Microsoft. The incentive that gave Microsoft and Anders Hejkberg to create C# was because Sun Microsystems, the company that had the right of ownership of Java at that time , did not want Microsoft to create changes to Java. For this reason, Microsoft and with the brilliance of Anders Hejkberg C# was born. This is also the reason why C# and sharp are quite similar. The first version of C# was called “version 1.0” and it was released around 2002. In C# version 1.0, some of its main features were classes, structs, statements, properties and interfaces. Meanwhile, currently, C#’s latest version is 8.0. New and improved features such as readonly member, default interface methods and asynchronous streams. Despite of C#’s numerous features and quirks, one of its most noticeable characteristics is declaration of unique data types. Like its predecessor C and C++, and other similar programming languages, C# requires declaration of data type when creating variables, functions, and data members. In C#, there are two categories of data types. These are primitive and abstract data type. Some of the primitive data types in C# are integer or int, floating point, decimal, Boolean, and characters or also known as char. When using a specific primitive data type in C#, variables and functions must only correlate or be used on the same primitive data type otherwise error may occur. However, C# has fortunately added some flexibility in addressing primitive data type restriction. In C#, programmers are allowed to convert some data types other data types through converting functions. Some of these converting functions includes Parse and TryParse (which belongs to System.Convert class) and casting strategies (implicit and explicit). However, these converting functions do not allow conversions into any type of primitive data type, they are specified. Meanwhile, the other category of C#’s data type is abstract data type. Abstract data type is one of the main of strengths of C# and other object-oriented languages. The reason behind this is because abstract data types is user defined. Therefore, abstract data type varies on each declaration. Lastly, abstract data types are only used and implemented in creating classes and method which are both user-defined. Example:4371340-371747Parsestring myString =”123”;int myInt = Int32.Parse(myString)int addOne = myInt + 1;Console.WriteLine(addOne); //Output 12400Parsestring myString =”123”;int myInt = Int32.Parse(myString)int addOne = myInt + 1;Console.WriteLine(addOne); //Output 1242090420-391523Explicit Castingdouble myDouble = 5.9;Console.WriteLine ((int) myDouble); Console.WriteLine(myDouble);//Output 5//Output 5.9 00Explicit Castingdouble myDouble = 5.9;Console.WriteLine ((int) myDouble); Console.WriteLine(myDouble);//Output 5//Output 5.9 -159567-404767Implicit Casting double myDouble = 5.9; int myInt = (int) myDouble; Console.WriteLine (myInt); Console.WriteLine (myDouble);//Output 5//Output 5.900Implicit Casting double myDouble = 5.9; int myInt = (int) myDouble; Console.WriteLine (myInt); Console.WriteLine (myDouble);//Output 5//Output 5.9Another component plays a huge part in C# is array. Arrays are data structure that has a fixed number of cells or indices where data can be stored, retrieved and manipulated. Most of the time, arrays are represented as tables. The reason for this is because, the logical and description of an array matches to those of a table and more importantly it makes arrays easier to understand. In a one-dimensional array, it is similar to table that has one row and has variety number of columns depending on its how many indexes are set when the array was created. Moreover, the first index (cell) of the array is the left most index, which is always labeled or addressed as zero. Then, the addresses of the indices increase by one as it goes from left to right. Additionally, array can also be two-dimensional or multidimensional. In a two-dimensional array, it is similar to a table with user-defined number of rows and columns. When it comes to addressing two-dimensional array, it uses two numbers. The first, which start with zero, indicates the row number and the second number, which also starts with zero, indicates the columns. Lastly, in multi-dimensional array, it cannot be represented as a table because the array has more than two axis which is incompatible with only rows and columns. To address a multi-dimensional array, it uses a number of numbers that is directly proportional on how many dimensions it does. For instance, if it is a three-dimensional array, it uses three numbers to address each dimension which all starts with zero. Check out the examples below.Example:-420370118110One-Dimensional Arrayint [] numArr1 = new int [5]; //array declaration with fixed sizeint [] numArr2 = new int[]{ 1,2,3,4,5 }; //initialized array without fixed sizeint [] numArr3 = new int[3]{ 6,7,8 }; //initialized array with fixed sizeConsole.WriteLine(numArr3[2]); //Output 8, array index was accessed then printedTwo-Dimensional Arrayint [,] numArr2d1 = new int [2,3]; //2-d array declaration with fix sizesint [,] numArr2d2 = new int [2,2] { {1,1},{2,2} }; //2-d array initialization with fix sizesint [,] numArr2d3 = {{3,4},{5,6}}; //2-d array initialization without fix sizesConsole.WriteLine(numArr2d3[0, 1]); //Output 4, row 0 and column 100One-Dimensional Arrayint [] numArr1 = new int [5]; //array declaration with fixed sizeint [] numArr2 = new int[]{ 1,2,3,4,5 }; //initialized array without fixed sizeint [] numArr3 = new int[3]{ 6,7,8 }; //initialized array with fixed sizeConsole.WriteLine(numArr3[2]); //Output 8, array index was accessed then printedTwo-Dimensional Arrayint [,] numArr2d1 = new int [2,3]; //2-d array declaration with fix sizesint [,] numArr2d2 = new int [2,2] { {1,1},{2,2} }; //2-d array initialization with fix sizesint [,] numArr2d3 = {{3,4},{5,6}}; //2-d array initialization without fix sizesConsole.WriteLine(numArr2d3[0, 1]); //Output 4, row 0 and column 1 494284042273numArr3:6780numArr3:678494792032385numArr2d3:3456numArr2d3:3456Like other object-oriented languages, C#’s capability to allow users to create user-defined Classes, which are abstract data type, primarily makes the programming language immensely flexible and customizable. With this kind of trait, it allows programmers to express their ideas with more freedom and clarity. Ordinarily, when a Class is created it must contain some data members, constructor, properties, and functions. Data members of a Class are variables that represent the characteristics or attributes of the Class. These data members have a variety of data types. Hence, data members could be a data type of int, double, char and so on. Constructors are functions that initialize the declared data members. Normally, a Class has multiple constructors that each has different parameters or arguments. The reason for this approach is to provide variation in initializing the data members which either could be user-defined inputs or default values. Also, since constructors’ job is to handle the Class’s initialized value, they are always given the same name as the Class. Properties’ role in a Class is to gather (get() function)and assign (set() function) values of any of the declare data members of the Class, somewhat similar to a constructor. However, they are not identical because properties use a specific declared data member as its name, and each property only initializes one specific data member or attribute. Meanwhile, functions in a Class are components that provides various functionality. They may serve as component that calculates numerical operations or to handle conditional statements. Functions must also have a specific data type if they must return an output. Otherwise the key word “void” must be present in the place of the function’s data type, which returns no output. Finally, on each component of a Class mentioned, its privacy or access configuration must be defined. The keywords that are used to define the accessibility of the components of a Class are divided into three categories: private, protected and public. The main difference between them is that, public and protected allow other Classes to use the components of the Class. Meanwhile, private components are strictly exclusive to the Class where they were created.Example:2764972-100784Propertyclass Gpa{ public int CreditHour { set { creditHour = value; } get { return creditHour; } }}0Propertyclass Gpa{ public int CreditHour { set { creditHour = value; } get { return creditHour; } }}164193106770Constructorclass Gpa{ public Gpa(int c, char l) { creditHour = c; letterGrade = l; }}0Constructorclass Gpa{ public Gpa(int c, char l) { creditHour = c; letterGrade = l; }}In C# based projects, source codes are partially compiled to Intermediate language (IL) on the first run of the project, especially in an Integrated Development Environment (IDE) such as Microsoft Visual Studio. Therefore, executing the newly changed code normally takes longer than executing or running it on the second time. However, in reality the real time difference is really not too significant. Furthermore, the reason why C# code is only partially compiled in the first execution is because Visual Studio and its compiler also needs to catch and specify syntax errors of the C# code if they are present. This kind of feature is usually exclusive only for interpreters because interpreters translate any programming language code to machine code line by line, which make syntax error checking possible. Therefore, by partially compiling C# code to Intermediate Language not directly to Machine Language(Binary), time efficiency and debugging capability are enhanced. As a programmer you have a vast amount of options when choosing a programming language for helping create web applications such as and PHP. PHP is being used for many commercial sites at this point such as the notorious Facebook, so it is slowly becoming more notable to the public. While PHP is exceedingly different from both C# and Python, what PHP offers in its unique web development implementation is causing it to be a mandatory skill for all coders alike.First we are going to talk about the similarities between PHP and Python, while they may have opposite syntax, PHP is still very user friendly, making it easier to learn than the C languages. The syntax however is very closely related to that of C, so even if your coding knowledge is minimal it won’t take too long for you to get your feet wet and pick up PHP. The language offers extensive flexibility in comparison to its other web development counterparts, making it an optimal language to pick up and get going with to utilize in your projects. Also similar to Python PHP is open source meaning it is a free software that receives constant updates to make the experience that much better, when being compared to the Visual Studios programs that are only free to a certain extent. Since we’re on the topic of open source, this allows for a vast number of frameworks that are not only secure, but fast making for an optimal experience when learning the language.Next, we are going to break into the different data types that correspond with PHP and the first is a simple integer which can be implemented into PHP code fairly simple and can be any whole number.Example:$a = 52;The next data type is a string, which can also be implemented and executed pretty simple compared to both C# and Python all you need to do is the following:Example:$a = ‘Jacksonville University’;Echo $a;Floating point or doubles are very similar to that of string, the only difference is that a float is going to contain a decimal place, similarly Boolean data types are going to have a similar attribute the main difference of course being that there is only two possible values. A 0, which will be indicated as false and a 1, which will be indicated as true.Finally, we breach into some data types that differentiate themselves from the other languages we have and will talk about. Arrays are noted as data types in php and can hold more than a single value at any given time.Example:$types_Of_Classes = array(“math”, “history”, “art”, “English”,” Computer Science”);The last data type we are going to mention is one that is not found within the other languages, yet is extremely important when concerning databases and web development as a whole and that is the NULL data type. What a NULL data type is going to accomplish is that it is going to represent a blank variable or an element that does not store any data. There is only one possible output and it is type null. This is an automatically assigned data type to any value that has not been assigned data.Example:$a = NULL;The unique aspect of PHP is how it correlates many components from different languages; in this case it is ironic how much likeness there is between PHP and both C# and Python, but in its own unique way, yet so incomparably different in its actual functionality, syntax, and implementation. Now, to fully understand how it is in comparison to that of Python, let’s jump right into a brief history of the second open source language we’ll be discussing.Python is an object oriented, simple, yet high level language to use while coding. It allows for great performance similar to C# and PHP, all these languages are very prevalent in the computer science field today. Python was released in the early 90’s as a follow up to ABC language and its main purpose was for simple object orienting. Python is open-source which means that source code can be released under a license. A unique detail of python that many coders receive as a culture shock once they move out of Python is that most other languages don’t offer the same readability component that Python offers with it object oriented tactic.Python is considered an interpreting language and basically what this means is that the debugging functionality is already built in to the program, this allows for exception flags to come in if there is an issue. Python is a great option those who are debugging their program or trying to quickly test their code. The main benefits that come to mind when you think of Python is: easiness, open-sourced, and its readability. Finally, Python has a simple integration which basically means that it is going to work well with a vast library of different languages.Python is a programmer’s code what I mean by this is that unlike C# and PHP Python was designed to be coded by programmers, whereas C# and PHP offer familiarity to other programs such as the C languages. Python is easily readable and I will demonstrate this with an example of Python code. In order to write the name of your university in Python you would write:print(“Jacksonville University”)Under the same circumstances, it would take more than a single line of code to write in either C# or PHP. Another thing you might have noticed is that Python does not force the user to end a line with a semi-colon, instead simply going to a new line will execute the previous line. Python in comparison to C# and PHP have very different syntaxes, so if you are learning Python as your first language you are probably going to be much slower learning C-based languages, however if you learned a C-based language first, then it is going to be much easier for C# and probably slower learning Python with how different the syntaxes actually are. Another major difference between the two is that they are typed differently, while PHP and C# are static, Python is dynamically typed and what this means is that for Python programs the user does not have to specify what data type the code is going to be and once the code is ran, the code will learn and figure out what to identify it as.For instance, you can have python determine your data type, but you don’t have to call a data type for Python to understand if it is a string, integer, float, etc.:Input: a = 5 Type(a)Output: intPython does not need to compile the code, so instantaneously as it is ran, it is then produced on the output screen.As mentioned earlier Python is the epitome of readability, PHP and C# utilize curly brackets to separate chunks of code, while Python prefers a more indented approach, without these indents showing the code will not be able to run. So once it is sent to peers to look at and read it is much easier to separate code by indents rather than brackets and braces which can disorient the code to the reader. All three languages can be used for practically anything making them general languages. However, where Python reigns supreme is when dealing with machine learning, the vast library of software’s a programmer has when using Python for machine learning far outweighs both PHP and C# making it the ideal choice for programmers when trying to pick a language to code.Finally, the last detail I’d like to touch on when comparing these languages is the Python is completely open-source so anyone can get Python for free, while C# e not entirely open-source leaving there to be a paywall to some extent.When comparing these languages it is important to note that they are similar for what they are and that is Object-Oriented programming. While C# has a more organized and concise configuration, PHP has its importance in utilizing front end HTML, and Python utilizes it with simplicity and readability to create a more simple environment for beginning programmers. While Python may not utilize curly brackets to organize its code, it does offer indenting as the alternative to make sure the code is properly working and utilizing the correct components. C# and PHP are going to take a beginner a little bit longer to learn the ropes, but in return you will receive a substantially better runtime. In conclusion, all the languages have their own unique functionality that separates them from each other with their own strengths and weaknesses, but they are all important in the ever expanding programming universe. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download