Wednesday 26 March 2014

Unit 6 M1

Unit 6: M1 - Explain the importance of the quality of code 


Annotation

Annotation is where you give a short but straight to the point line that dies not interact with your code, basically your describing or explaining what that line of code is doing this is to benefit you and others who see your code and do work on it. Here is an example of commented code.




                              





Above is a screenshot of a section in my code in green are the comments. To write a comment you start with a ' and then type what you want it to say like this 'Here is a comment. The line you have written will go green.


Sequence


When writing programs a sequence occurs; this is when an action takes place which leads to an event happening. This ensures that all steps are executed properly.  An example of this could be if the program multiplies in numbers, this means that the user will have to input the numbers and multiply them, this will allow them to be displayed so that the user has the ability to view them on screen.

Selection

This will change as it moves around the way your code is written this is because a condition decides which route the program will take when reading your code normally this occurs when a question or proposal . Here's an example “is a less than b?" The condition would be (a<b) or you could have 


Iteration

Iteration is when you reuse a piece of code this is because it needs to meet a requirement virtually all programming language uses this method to reduce the amount of code required to run a program to create tasks this is known as a loop.
There are two types of loops definite and indefinite:
A definite loop repeats only tow. Certain amount of times set manually by the programmer whilst the indefinite loop only repeats until a condition is met this would be like when a file is being read and if the program was relation dates it would stop when no more dares can be repeated.

 Eliminating repeated and redundant code

To do this what we do is make a new public class and then put the code we want in the class, this then turns into a call function, what a call function allows us to do is make the program read the piece of code we have written without slowing the PC performance down or take up lots of memory, here is an example.










Program structure

This is how the code is written if its organised really, when i write my code for my Simple Simon game i put all my Variables at the top of the code viewer then wrote the rest of my code commenting it as i went along. Having a good program structure is very helpful when writing out code this is because if the code was in the wrong order then if another coder came along to look through your code they probably would not understand what is going on and easily get confused because your program structure is disorganized.

Logical Methods






Reliable and robust this is to do with users wanting to test the program thoroughly for example on our simple Simon game we are developing we have a name input section this is for only text where as a code tester would check if numbers and symbols could be entered and accepted, if this were to occur a successful code build would be able to with stand these errors and bring up an error box telling you what to do to prevent it from happening again.

Usability this is to do with the design aspect of the program this is the graphical user interface. What this means is that usability for other people accept your self this is having clear labelled buttons for easier usage, having clear headings and titles so that the user can see what they are doing and having a good colour choice so that colours do not clash causing eye strain and headaches to the users an example would be having neon green and white the two bright colours would not work with each other as the neon green would over power the white preventing a clear heading.

Portability this means that the code of your program should not be to complex to run on lower version on operating systems this could be you developing a program on windows 7 with an intel i5 processor having lots of background code running in the program you made then trying to run this on windows XP this would create conflicts as the operating system is outdated and may not run all features making some parts to your game inoperable, this could also lead to other problems like freezing the computer and causing lag making the computer run under performance.

Predefined code are software systems that's are similar to many other systems this means they have many similar functions and procedures from other code so therefore when you come to writing another program the predefined code is already written and this will save you a great deal of time when developing code for programs.

Readability this is to do with complicated code that looks horrific because the previous coder had not put any comments.
What are the use of comments? What comments do is give a brief explanation of that piece of code does a comment is written like this 'calculate average display because of the quotation mark the software that you code with for example Visual studio 2012 the quotation mark the code doesn't get read by the software instead it only acts like a description and doesn't affect the written code when running the program itself.

Maintainability This is to do with commercial software, this is when the developers bring out updates for the program to help with compatibility issues, bug fixes and patches this will help make the software more stable and create a better user experience.



No comments:

Post a Comment