Software Development COMP 170
Popular in Course
Popular in ComputerScienence
This 2 page Class Notes was uploaded by Ashlynn Bergstrom on Monday October 12, 2015. The Class Notes belongs to COMP 170 at Harding University taught by Frank McCown in Fall. Since its upload, it has received 18 views. For similar materials see /class/222131/comp-170-harding-university in ComputerScienence at Harding University.
Reviews for Software Development
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/12/15
Tips to Writing Clean Code By Frank McCown Functions Capnahze gramme mpm m onemnonon vs maonons wmbh penovm each o hose aonons Davametev ha meoes whataH thyoughthemno on s body to undevs1and whauhemnonon s veaHy dmrg Stampe Th funct takes two parallel arr ys en array of ID end en array of v scores The thlrd parameter s the m to be seerehed for The score v ccrrespcndlng to the Search m 15 returned If the 1 cannot be found 111 the v IDS array 71 15 returned Coda r Use p enty o mue spaoeto o amy code r Put statements endwrg mh sembobns and n on sepava e hnes except my hope for olt5 vs for 1 o 1 lt 5 1w ccutltlt139j 3373 lt cont ltlt 1 v 3 j e j e 3 Error Checking Stampe Illegal new vs Please enter a number between 1 end 10quot Han aooessmg aways om o bound em Wm rm HO 0 ensunng an mpuHHe estts be oveuywrg to vead New A Variables Constants Carefully chosen variable names and constants will often be selfdocumenting Examplec a b VS score total points pointsimissed Declare all variables at the top of the function Variables should generally not be initialized to a computed value on the same line on which it s declared although initialing to a constant is acceptable Example int c sqrt b vs int c 39 Comment the purpose of each variable declaration Constants should generally be all capitalized and variables should generally be all lower case camelcasing is bl also accepta e Exampleiconst int NAMEiLEN 4 and int numiofistudents 20 or numOfStudents Use constants for all magic numbers or whenever a particular value is used more than once Documentation Write comments that express more of the whythan the how Document the codes intent Example Divide total grades by total students VS Compute student grade average Always place your name date and program description at the top of the program Make your comments say something about the code that the code can t say about itself Example level Add 1 to level VS level Advance to next level before processing remaining lives Typically a comment should refer to a logical grouping of lines rather than a single line of code Avoid all but the most common abbreviations in comments so they re easy to read Clearly separate comments from code Use a commenting style that is not overly tedious timeconsuming or a maintenance monster Outline your code with comments before you write it rather than doing all of the documentation at the end You ll save yourself time from having to figure out tricky places or forgetting details assumptions and subtleties of design
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'