Wednesday, April 3, 2019
How Is Readability Important To Writability?
How Is Readability Important To Writability?User-defined factor oerloading can disparage the readability of a program if the drug user doesnt take into ac calculate differences in operands and possible confusion between the function of an operator. Consider if a user defined to mean the logical AND over intent in Boolean logic. soul else might conceptualise to be the giberess of a variable much(prenominal) as the case in a wording akin C. It would consecrate the scratch difficult to understand for a reader as comfortably as cod it difficult for a compiler to put one over capableness errors when the two functions of the earn mixed up.What is aliasing?Aliasing is having two or more trenchant names that can be utilise to entree the same shop cell. It is effective in that it allows a ruler more freedom to access data but it also can be dangerous in that aliasing can go away to a lot of errors specially if a computer programmer doesnt do a full job of ke eping track of these names or cursors to a memory cells.How is readability essential to writability?Readability is important to writability because if a program quarrel is difficult to read and understand indeed it can be difficult for a programmer to stimulate raw(a) code that might need to interact or use brand-new(prenominal) code. Often terms code needs to be modified and if a program is difficult to read so it is difficult to add new code to it.What argon the cardinal fundamental features of an fair game-oriented programming terminology?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 another(prenominal) part of a program. Inheritance allows one to reuse existing software so it allows significant improvement in productivity. Polymorphism allows data types and functi on to croak to more generic classes thus allowing for antithetical data types to be graceful in a uniform manner.What are three general modes of implementing a programming actors line?One method is compiler implementation in which programs are translated into machine words. Another method is cal direct pure interpretation in which programs are interpreted by an interpreter. A third implementation method is called a hybrid implementation in which high-level linguistic process programs and translated to an mediocre 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 mark off the same language and h grey-headed up a common understanding of symbols and functions. on that point 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? various programming languages have various strengths and weaknesses and using a single language for all programming domains can make things more difficult especially when programming in a variant 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 exploit age and run time speed. Others run quickly and efficiently but are more inclined(predicate) to errors. Having a choice of languages makes accomplishing a certain task easier.What common programming language educational activity, in your opinion, is more or less detrimental to read ability?One of the most common programming language statements that is detrimental to readability is the conditional statement much(prenominal) as an if, while, etc especially if it involves fuse 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 line up 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 pick up it unconstipated more difficult with nested loop statements because one has to recognize layers of conditionals and even more so in languages like C or coffee tree that use poise simoleonss to dying enhance statements. Sometimes a reader provide forget which loop is running or will have a difficult time debugging when forgets to use a pair mark and the conditional statements overlap. burnt umber uses a beneficial brace to mark the end of all compound statements. What are the arguments for and against this digit?One of the arguments for the role 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 duad to end all compound statements in deep brown is that its more detrimental to readability. Its 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 adenosine deaminase dont 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 statem ent, and end loop determines the end of a loop.Many languages withdraw 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 soul reading the code. One of the cons of languages distinguishing between uppercase and lowercase letters is that it could digest 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 wont since Mystring, and mystring would not be recognized.10) What are the arguments for writing efficient programs even though hardware is relatively gaudy?As hardware costs decreased the major cost of reckon shifted to progr ammer costs in software. Programs were being used more and more for larger and more complex tasks and thus having efficiently written programs relieve 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 hump, using the criteria described in this chapter.ReadabilityIn terms of readability, coffee berry 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 Javas overall simplicity is that the sanctioned constructs follows that of the C and C++ family, thus its 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 trope and has no pointer types. Data types and complex body parts can be specified to a high degree.WritablityJava 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 clog ups 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 computer 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 javas dynamic set up system.ReliablityJava uses a type checker at compile time which virtually eliminates most of the type errors during run time. Its 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 about the errors of Java but this insures that programmers dont screw up the code and perhaps computer like what could happen with an inexperienced programmer in C. Java also has vast exception handling and can check for and cast out 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 Javas 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, saved and thus access can be regulated. Java also has a free complier/interpreter system thus it is more widely used than an expensive compiler.Some programming languages, for example, Pascal have used the semicolon to split 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 Pascals usage of the semicolon to separate statements is rather counterintuitive but perhaps its because I learned the usage of the semicolon to terminate statements in C in front 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 statementIf x = 0 thenAnswer=1Then 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 thenAnswer=1ElseAnswer=2Some 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 its easier to remember not to put a semi-colon later on 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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.