How Is Readability Important To Writability?
✅ Paper Type: Free Essay | ✅ Subject: Information Technology |
✅ Wordcount: 2055 words | ✅ Published: 2nd May 2017 |
User-defined operator overloading can harm the readability of a program if the user doesnt take into account differences in operands and possible confusion between the function of an operator. Consider if a user defined “&” to mean the logical AND statement in Boolean logic. Someone else might believe & to be the address of a variable such as the case in a language like C. It would make the code difficult to understand for a reader as well as make it difficult for a compiler to catch potential errors when the two functions of the “&” get mixed up.
What is aliasing?
Aliasing is having two or more distinct names that can be used to access the same memory cell. It is useful in that it allows a programmer more freedom to access data but it also can be dangerous in that aliasing can lead to a lot of errors especially if a programmer doesn’t do a good job of keeping track of these names or pointers to a memory cells.
How is readability important to writability?
Readability is important to writability because if a programming language is difficult to read and understand then it can be difficult for a programmer to create new code that might need to interact or use other code. Often times code needs to be modified and if a program is difficult to read then it is difficult to add new code to it.
What are the three fundamental features of an object-oriented programming language?
The three fundamental features of object-oriented programming are encapsulation, inheritance and polymorphism. Encapsulation promotes the concept of information hiding, which is useful because it protects information from being changed or altered by other parts of a program. Inheritance allows one to reuse existing software so it allows significant improvement in productivity. Polymorphism allows data types and function to belong to more generic classes thus allowing for different data types to be processed in a uniform manner.
What are three general methods of implementing a programming language?
One method is compiler implementation in which programs are translated into machine language. Another method is called pure interpretation in which programs are interpreted by an interpreter. A third implementation method is called a hybrid implementation in which high-level language programs and translated to an intermediate language for easier interpretation.
What arguments can you make for the idea of a single language for all programming domains?
If there is only a single language for all programming domains this simplifies code and increases readability because everyone would learn the same language and have a common understanding of symbols and functions. There are no additional costs of having to train programmers in multiple languages and software would be easier to integrate since everything would be written in the same language.
What arguments can you make against the idea of a single language for all programming domains?
Different programming languages have different strengths and weaknesses and using a single language for all programming domains can make things more difficult especially when programming in a different language might be easier and more suitable. For example a functional programming language would be ideal for applying functions to given parameters but not a very good way of representing objects in the real world as opposed to object oriented programming. Some programs are more reliable in that they catch errors but at the cost of execution time and run time speed. Others run quickly and efficiently but are more prone to errors. Having a choice of languages makes accomplishing a certain task easier.
What common programming language statement, in your opinion, is most detrimental to readability?
One of the most common programming language statements that is detrimental to readability is the conditional statement such as an if, while, etc… especially if it involves compound statements and or nested conditionals. I believe this is detrimental because often times conditional statements involve the reader of a code having to scroll up and down to follow what goes next. This is especially true with older languages that use the goto statement or ones that use the break command to leap out of a given conditional statement to a line further down or up. I personally find it even more difficult with nested loop statements because one has to recognize layers of conditionals and even more so in languages like C or Java that use brace marks to end compound statements. Sometimes a reader will forget which loop is running or will have a difficult time debugging when forgets to use a brace mark and the conditional statements overlap.
Java uses a right brace to mark the end of all compound statements. What are the arguments for and against this design?
One of the arguments for the usage of a right brace mark to end all compound statements is that it keep the syntax simple for compound statements and it saves a programmer time for not having to write extra characters to denote the end of a compound statement. One of the arguments against using braces to end all compound statements in Java is that it’s more detrimental to readability. It’s more difficult to determine which different compound statement (while loop, for loop, …) is ending if you use a right brace mark to end all of those statements. This can be especially troublesome if you use many different types of multiple compound statements. Languages like Ada don’t use right brace marks to end compound statements and that language has greater readability in this case. For example in Ada “end if” determines the ending of an if statement, and “end loop” determines the end of a loop.
Many languages distinguish between uppercase and lowercase letters in user-defined names. What are the pros and cons of this design decision?
One of the arguments in favor of distinguishing between upper and lowercase letters in user-defined names is that it helps maintain code readability. For example if POINTER, Pointer, and pointer were distinct names that denoted different entities, then it might confuse someone reading the code. One of the cons of languages distinguishing between uppercase and lowercase letters is that it could hurt writability by making it harder for a programmer to code. For example if a programmer used MyString as a user name, then that programmer would have to remember that special case usage since Mystring, and mystring would not be recognized.
10) What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
As hardware costs decreased the major cost of computing shifted to programmer costs in software. Programs were being used more and more for larger and more complex tasks and thus having efficiently written programs saved on computing costs. Companies found out that programming language deficiencies such as incomplete type checking and poorly designed control statements led to lower programmer productivity.
Write an evaluation of some programming language you know, using the criteria described in this chapter.
Readability
In terms of readability, Java has some issues with simplicity with respect to readability. There is feature multiplicity in Java as shown in the textbook with the example of count = count + 1, count++, count +=1 and ++count being 4 different ways to increment an integer by 1. Another problem is operator overloading since java allows some operators such as the + sign to add integers, floats, and other number types. One of the good things about Java’s overall simplicity is that the basic constructs follows that of the C and C++ family, thus it’s relatively similar for people who know those languages. Control statements in java have higher readability than old BASIC and Fortran programs because they can use more complex conditionals like for loops. There is no need for goto statements that have the reader leaping to other lines of code that could be far away or out of order. However, the use of braces to designate the starting and stopping points of all compound statements can lead to some confusion. Java has 8 primitive data types: Boolean, char, byte, short, int, long, float and double and has no pointer types. Data types and structures can be specified to a high degree.
Writablity
Java has a fair bit of orthogonality in that its primitive constructs can be used in various different ways. Because Java is an imperative language that supports object oriented programming, it can be fairly complex. Java supports data abstraction so it would be easier to create a binary tree in java with its dynamic storage and pointers than in a language like Fortran 77. Java also has a for statement which is easier than using a typical while statement. Java is a high level programming language so specifying details like memory allocation are unnecessary due to java’s dynamic array system.
Reliablity
Java uses a type checker at compile time which virtually eliminates most of the type errors during run time. It’s much improved over a program like C especially with respect to allocation and de-allocation of memory. It might be a little more cumbersome to get around the errors of Java but this insures that programmers don’t screw up the code and possibly computer like what could happen with an inexperienced programmer in C. Java also has extensive exception handling and can check for and throw for several different documented exceptions. Java restricts the amount of aliasing from its predecessor C to allow for greater reliability. With respect to cost, Java has a fairly extensive library so it can be difficult for people to learn all the aspects of the language. Writing a simple program in Java is rather difficult due to the declaration of the public class and the execution statement public static void main (String[] args) {…}. However Java’s support of encapsulation allows multiple programmers working on a project to collaborate without messing up each others code. Different parts can be designated as public, private, protected… and thus access can be regulated. Java also has a free complier/interpreter system thus it is more widely used than an expensive compiler.
Get Help With Your Essay
If you need assistance with writing your essay, our professional essay writing service is here to help!
Find out more about our Essay Writing Service
Some programming languages, – for example, Pascal – have used the semicolon to separate statements, while Java uses it to terminate statement. Which of these, in your opinion, is most natural and least likely to result in syntax errors? Support your answer.
Personally I feel that Pascal’s usage of the semicolon to separate statements is rather counterintuitive but possibly it’s because I learned the usage of the semicolon to terminate statements in C before I learned Pascal. In Pascal one needs to look ahead and identify whether or not the next line is a statement before putting a semicolon. This can be a hassle because requires a programmer to go back and change code before adding new code. For example if use had a program in Pascal that had a simple if statement
If x = 0 then
Answer:=1;
Then in Pascal if you wanted to add an else clause you would have to go back and delete the semicolon because an else clause is not considered a new statement.
If x = 0 then
Answer:=1
Else
Answer:=2;
Some Pascal compilers will catch wrongly placed semicolons and declare them as errors. It also means that a programmer needs to be able to recognize what is and what is not a statement thus it hurts writablity. Of course, other requirements in Java such as the usage of parenthesis around the conditional or the usage of braces around the compound statements can also be confusing. However I think it’s easier to remember not to put a semi-colon after a right brace than it is to have to watch out for not putting it after each statement. The relative consistency of Java is more intuitive than the structure of Pascal.
Cite This Work
To export a reference to this article please select a referencing stye below:
Related Services
View allDMCA / Removal Request
If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: