1 / 48

* Property of STI Page 1 of 48

Basic Computer Concepts Program Planning and Development Defining the Problem Designing a solution Writing the Program. Software Development. * Property of STI Page 1 of 48. Basic Computer Concepts Program Planning and Development. Compiling, debugging and testing the programs

minor
Download Presentation

* Property of STI Page 1 of 48

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BasicComputerConcepts ProgramPlanningand Development DefiningtheProblem Designingasolution WritingtheProgram SoftwareDevelopment *PropertyofSTI Page1of48

  2. BasicComputerConcepts ProgramPlanningand Development Compiling,debuggingandtestingtheprograms DocumentingtheProgram Ø Ø SoftwareDevelopment *PropertyofSTI Page2of48

  3. BasicComputerConcepts ProgramPlanningand Development DefiningtheProblem Ø recognizingtheneedforinformation definingwhatoutputsarerequiredofthe program v v DesigningaSolution Ø breakingtheproblemintodiscretesteps v knownas“algorithm” Flowcharting-agraphicalrepresentationofthe sequenceofoperationsacomputeristoperform SoftwareDevelopment *PropertyofSTI Page3of48

  4. BasicComputerConcepts DesigningaSolution Terminal Generalinput/outputoperation Process Comparison Connector Predefinedprocess Document ManualInput Ø Ø Ø Ø Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page4of48

  5. BasicComputerConcepts DesigningaSolution PayrollFlowchart SoftwareDevelopment *PropertyofSTI Page5of48

  6. BasicComputerConcepts DesigningaSolution Ø Ø Pseudocode-isaversionoftheinstructions describingeachstepthecomputermustfollow PayrollPseudocode Start Reademployee'shoursworkedand hourlywage Dountilendofitems Multiplyhoursworkedbyhourly wagetogetgrosspay Ifgrosspayisgreaterthan70K Thentaxrateis20% Elsetaxrateis15% Multiplytaxratebygrosspay togivetax Subtracttaxandunionduesfrom grosstogetnetpay Printcheck Readnextemployee'shours workedandhourlywage Endloop(nomoredata) Printreports SoftwareDevelopment *PropertyofSTI Page6of48

  7. BasicComputerConcepts WritingtheProgram writetheprograminaspecificprogramming language typesofprogrammingstatements Ø Ø comments declarations input/outputstatements computations transferofcontrol Comparison v v v v v v theprogrammershouldtrytoincorporatethe followingqualitiesintoanyprogram: Ø easytoreadandunderstand efficient reliable robust maintainable v v v v v SoftwareDevelopment *PropertyofSTI Page7of48

  8. BasicComputerConcepts Compiling,Debugging, andTestingtheProgram acompilerisaspecialprogramforeach programminglanguagethatisloadedintothe computerwhenthelanguageisused compilationerrorsarediscoveredbythe compilerandinclude: Ø Ø spellingerrors syntaxerrors improperlysequencedstatements improperlylabeledstatements conflictinvariablenames illegalnamesorstatements missingpunctuations v v v v v v v SoftwareDevelopment *PropertyofSTI Page8of48

  9. BasicComputerConcepts Compiling,Debugging, andTestingtheProgram logicalerrorshavetobedetectedbythe programmerinaprocesscalleddebugging tobesurethattheprogramwillgivethe correctoutput,theprogramhastobetested byrunningtheprogramandinputtingdata withknownoutputs Ø Ø SoftwareDevelopment *PropertyofSTI Page9of48

  10. BasicComputerConcepts Documentationofthe Program documentationconsistsofwrittendescriptions andexplanationsofprogramsandother materialsassociatedwithanorganization’s dataprocessingsystem properprogramdocumentationservesasa guideforprogrammersandanalystswhomust modifyorupdateexistingprogramsandsystem procedures theprocessofdocumentationisanon-going one Ø Ø Ø acompletedescriptionofthecontentsand formatsofalldatainputs,outputsandfiles tobeused astatementofthehardwarerequirements forrunningtheprogramaswellas estimatedprocessingtimeandstorage requirements astatementofsoftwarerequirementssuch asutilityprogramsandlibraryprograms v v v SoftwareDevelopment *PropertyofSTI Page10of48

  11. BasicComputerConcepts StructuredDesign programsmustbestructured,thatis,each majorstepintheprogrammustbedeveloped asindependentmoduleandrepresentedinthe flowchartasaseparateblock programcodeswillbeeasiertounderstandand moremaintainableifyoubreakthelogicinto steps,andencompasseachstepinitsown subroutineorfunction usingstructureddesignleadstothefollowing benefits: Ø Ø Ø earlydetectiondesignflaws programsthatcanbeeasilymodified clearandcompletedocumentation modulardesigntoimprovetesting v v v v SoftwareDevelopment *PropertyofSTI Page11of48

  12. BasicComputerConcepts StructuredDesign Top-downvs.Bottom-up Top-downstructureddesignisdonebyfirst recognizingthemajorcomponentsofthe solution,expressingthesolutionasasequence ofthesemajorcomponentsandthen expandingthemajorcomponentsthemselves similarly. Bottom-updesignstartsbyidentifyingsmall functionsandsubroutinespresentinthedesign andmovinguptowardsmorecomplex procedures. Ø Ø SoftwareDevelopment *PropertyofSTI Page12of48

  13. BasicComputerConcepts StructuredDesign UsingFlowchart generallyinvolvesatop-downanalysisofthe problem basedontheassumptionthattherearefour (4)basiclogicpatternsnamely: Ø Ø Selection SimpleSequence SoftwareDevelopment *PropertyofSTI Page13of48

  14. BasicComputerConcepts StructuredDesign Loop Branch Ø Ø SoftwareDevelopment *PropertyofSTI Page14of48

  15. BasicComputerConcepts StructuredDesign Do-while Case Ø Ø SoftwareDevelopment *PropertyofSTI Page15of48

  16. BasicComputerConcepts ProgrammingParadigm Paradigm Ø an“example,modelorpattern” anidealizedpatternofusageunderwhich someagentcanoperate v v ProgrammingParadigm Ø awayofthinkingaboutproblemsandtheir solutions,oranapproachonhowtousea computertoimplementthosesolutions v Foraprogrammertosolveaparticular problem,heneedstoknowseveralthings, namely: Ø musthaveaclearpictureofwhatthe problemissupposedtodo musthaveanunderstandingofhowthe programshouldworktoproducethe desiredresult mustunderstandhowtheprogramfitsin itsenvironment v v v MajorProgrammingParadigms Ø Imperative Logical Functional Object-Oriented v v v v SoftwareDevelopment *PropertyofSTI Page16of48

  17. BasicComputerConcepts ImperativeParadigm characterizedbyprogrammingwithstatesand commandsthatmodifythestates Imperativemeansacommandororder,while acommandoraproceduremeansaparticular courseofaction. impliesprocedures(orprograms)ordirections forperforminganaction anabstractionofrealcomputers,whichare basedontheVonNeumannmachine assumesthatacomputercanmaintainthrough environmentvariablesanychangeinthe computationprocess Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page17of48

  18. BasicComputerConcepts ImperativeParadigm Popularprogramminglanguagesaremoreoften imperativemainlybecauseoftworeasons: Ø itcloselyresemblestheactualcomputer ormachineitself,sotheprogrammeris muchclosertothemachine itistheonlyoneefficientenoughfor widespreaduse v v Advantage: Ø canbeeasilytranslatedtoanefficient machinecode,sotheyareconsidered highlyefficient v Disadvantage: Ø someproblemsarehardtomodelusing thisparadigm v SoftwareDevelopment *PropertyofSTI Page18of48

  19. BasicComputerConcepts ImperativeParadigm Ø Ø Whenitiscombinedwithsubprogramsitis calledproceduralprogrammingalsocalled structuredprogramming Anexampleofanimperativeprogramthatwill computethefactorialofagivennumberis: Functionfactorial(n) { varx=1; while(n>0){ x=x*n; } n=n-1; returnx; } SoftwareDevelopment *PropertyofSTI Page19of48

  20. BasicComputerConcepts LogicalParadigm takesadeclarativeapproachtoproblem- solving canbedividedintothree(3)steps: Ø Ø aseriesofdefinitions/declarationsthat definetheproblemdomain statementsofrelevantfacts statementsofgoalsintheformofqueries 1. 2. 3. Advantages: Ø thesystemsolvestheproblem;so programmingstepsarekepttoaminimum sinceitislargelybasedonmathematical logic,provingthevalidityofagiven programbecomessimple v v SoftwareDevelopment *PropertyofSTI Page20of48

  21. BasicComputerConcepts LogicalParadigm Anexampletoillustratethelogicalparadigm: Ø SoftwareDevelopment *PropertyofSTI Page21of48

  22. BasicComputerConcepts FunctionalParadigm basedonfunctionalexpressionsandthe evaluationoftheseexpression viewsallprogramsasfunctionsina mathematicalsense toillustrate,thefunctionalprogramexpressed infunctionalparadigm: Factorialn= Ifn=1then1 Else n*Factorial(n-1); Advantages: Ø Ø Ø Ø provideahighlevelofabstraction;the programmingbecomesmodularand removesthepossibilityofcreatingmany errors notheavilydependentontheassignment operation,sotheprogramscanbe evaluatedwithmanydifferentorders muchmoreamenabletomathematical proofandanalysisthanimperativeones v v v SoftwareDevelopment *PropertyofSTI Page22of48

  23. BasicComputerConcepts FunctionalParadigm Disadvantages: Ø hardtoimplementefficiently,becauseitis hardtodetermineifdatastoragecanbe re-usable forproblemsinvolvingmanyvariablesora v v lotofsequentialactivity,itissometimes easiertohandlethemimperativelyorwith object-orientedprogrammingparadigms Functionforcomputingtheaverage oftwonumbers: (defunavg(XY)(/(+XY)2.0)) Functioniscalledby: >(avg10.020.0) Functionreturns: 15.0 SoftwareDevelopment *PropertyofSTI Page23of48

  24. BasicComputerConcepts Object-Oriented Paradigm Ø Ø aparadigminwhichrealworldobjectsare viewedasseparateentitieshavingtheirown stateandexhibittheirownbehavior focusesontheobjectsthattheprogrammeris representing Illustratesobjectsandhowtheyare encapsulatedintomodules Objectinterface DATA Methods SoftwareDevelopment *PropertyofSTI Page24of48

  25. BasicComputerConcepts Object-Oriented Paradigm Object-oriented programmingapproach in Ø generalcanbedividedintofour(4)steps: Identifytheproblem Identifytheobjectsneededforthe solution Identifymessagestobesenttotheobjects Createasequenceofmessagestothe objectsthatsolvetheproblem v v v v Ø Toillustratethefour(4)steps: 1.Problem Identification:Computethesum oftwonumbersandprintouttheresult 2.Object Identification:Identifyobjects neededtosolvetheproblem •Num1-firstnumber(object) •Num2-secondnumber(object) •Sum-resultoftheadditionofthetwo numbers SoftwareDevelopment *PropertyofSTI Page25of48

  26. BasicComputerConcepts Object-Oriented Paradigm Toillustratethefour(4)steps(cont.): 3.Message Identification:Messagesneededto sendtoobjects +aNum-thisisthemessagesenttothe receiverobjectwithparameteraNum.The resultofthismessageisthevalue(a numericobjects)ofthetotalsumofthe receiverobjectandaNum print-amessagethatdisplaysthevalueof v v thereceiverobject 4.Objects-Message Sequences: (Num1+Num2)print Themessage+withparameterNum2is senttoobjectsNum1.Theresultisan object(Num1+Num2),whichissentthe messageprint. v SoftwareDevelopment *PropertyofSTI Page26of48

  27. BasicComputerConcepts OtherProgramming Paradigms Tree-thisisviewingcodeordatainahighly hierarchicalmanner ExpertSystem-thisorganizesdatabyusinga listorpoolofrulesthataresometimes constantlyrecycledthrough Stream-isbasedontheideathatinputand outputofsmallerprogramsorutilitiescanbe linkedtogether NeuralNetwork-basedontheconceptsthat computersareprogrammedinthesamewayas howhumansthink 1. 2. 3. 4. SoftwareDevelopment *PropertyofSTI Page27of48

  28. BasicComputerConcepts ProgrammingLanguage Languageisdefinedasasystemfor communicating. Writtenlanguageusesymbols(characters)to buildwords. Theentiresetofwordsisthelanguage vocabulary. Thelanguagesyntaxandgrammardefinethe wayinwhichthewordsaremeaningfully combined. Theactualmeaningofwordsandcombinations ofwordsisdefinedbythelanguagesemantics. Ø Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page28of48

  29. BasicComputerConcepts MachineLanguage thelowestlevelofprogramminglanguage onlylanguageunderstoodbycomputersand consistsofpurenumbers;takestheformof “1”or“0” eachmachineinstructionhastwo(2)parts: Ø Ø Ø opcode(operationcode)-whichtellsthe computerwhatfunctiontoperform operand-whichtellsthecomputerwhat datatousewhenperformingthefunction v v SoftwareDevelopment *PropertyofSTI Page29of48

  30. BasicComputerConcepts Low-levelLanguage Ø alsocalledassemblylanguageandissimilarto machinelanguagebutassemblylanguageis mucheasiertounderstandthanmachine language Examplesofmnemoniccodes SoftwareDevelopment *PropertyofSTI Page30of48

  31. BasicComputerConcepts Low-levelLanguage Programmerswhowritelow-levellanguage programsmustbehighlyskilledintwo(2) areas: Ø mustknowagreatdealabouttheinternal workingsofthemicroprocessor,anda broadtechnicalknowledgeofthe computerisneeded mustbeverydetailoriented;everystepof v v thecomputermustbecoded,andthe actualnumericaladdressofthe instructionsanddatamustbespecified Anexampleofusingtheassemblylanguageto multiply87and243andsavingtheresult inthememory SoftwareDevelopment *PropertyofSTI Page31of48

  32. BasicComputerConcepts High-levelProgramming Language enablesaprogrammertowriteprogramsthat aremorelessindependentofaparticulartype ofcomputer consideredhigh-levelbecauseit’scloserto humanlanguagethanthemachinelanguage thatthecomputerunderstands easiertounderstandandallowsthe programmertofocusonsolvingtheproblem ratherthanknowinghowtoprogramthe computer examples:Ada,Algol,BASIC,COBOL,C,C++, FORTRAN,LISP,Pascal,Prolog Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page32of48

  33. BasicComputerConcepts BASIC Beginner’sAll-purposeInstructionCode developedbyJohnKemenyandThomasKurtz intheearly1960’s intendedasaneasy-to-learninteractive languageforthestudents Advantages: Ø Ø Ø Ø simplicityandflexibility allowsbasicmanipulationoftext providesbuilt-infunctionssuchas v v v logarithms,squareroot,trigonometric functions,andrandomnumbergenerator AnexampleofaBASICprogramthatwillmultiply twonumbers,243and87andprintingtheresult SoftwareDevelopment *PropertyofSTI Page33of48

  34. BasicComputerConcepts FORTRAN FormulaTranslator theoldesthigh-levelprogramminglanguage developedinthemid-1950’sbyJohnBackus primarilyintendedasahigh-levellanguage usedforprogrammingscientific,mathematical andengineeringapplications Advantages: Ø Ø Ø Ø Ø procedure-orientedlanguagewith excellentmathematicalcapabilities itspatternissimilartotheBASIClanguage, aprogrammerwhoisfamiliarwith FORTRANcaneasilywriteprogramsin BASIC v v Disadvantages: Ø closelyresemblesmathematicalnotations; thus,itisverydifficultfornon- programmertounderstandorfindthe errorsintheprogram notsuitedasabusinessapplication languageforitdoesnothavethecapability todevelopprogramsthatinvolvefile maintenance,editingofdata,ordocument production v v SoftwareDevelopment *PropertyofSTI Page34of48

  35. BasicComputerConcepts FORTRAN AnexampleofaFORTRANprogramthatwill multiplytwonumbers,243and87andprinting theresult SoftwareDevelopment *PropertyofSTI Page35of48

  36. BasicComputerConcepts COBOL CommonBusiness-OrientedLanguage themostfrequentlyusedbusiness programminglanguage usedextensivelyinbusiness,education,and government startedintheearly1960’swhenacommittee ledbyU.S.DepartmentofDefenseandother computerusersandmanufacturersknownas CODASYL(ConferenceofDataSystems Languages)wantedtodevelopacommon businessprogramminglanguage Dr.GrayMurrayHopperwasamajor contributortothestructureanddevelopment oftheCOBOLlanguage Ø Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page36of48

  37. BasicComputerConcepts COBOL Advantages: Ø easytounderstandbynon-programmers sinceitisEnglish-like self-explanatoryandwell-documenting goodliterarycapabilitywhichmeansthat itisgoodinmanipulatingwords, sentences,orparagraphsoftextmaterial strongfile-handlingcapabilities machine-independent v v v v v Disadvantages: Ø programstendtobewordyandquitelong limitedcomputationalcapabilitieswhich makesitinappropriateforapplications thatrequirecomputations v v SoftwareDevelopment *PropertyofSTI Page37of48

  38. BasicComputerConcepts COBOL AnexampleofaCOBOLprogramthatwill multiplytwonumbers,243and87andprinting theresult SoftwareDevelopment *PropertyofSTI Page38of48

  39. BasicComputerConcepts PASCAL thelanguagenamedaftertheseventeenth centuryFrenchmathematicianBlaisePascal whoconstructedoneofthefirstadding machines ahigh-levellanguagedevelopedbyNiklaus WirthofZurich,Switzerlandinthelate1960’s oneofthefirstlanguagesdevelopedusinga structuredprogrammingapproach Pascalprogramsconsistofmodules,andeach moduleperformsaspecificfunction. Thestatementsinthemodulecanbe organizedintolevels,andthelevelofthe statementisshownbyitsdegreeofindention fromthemargintofollowtheprogramlogic easily. StatementsinaPascalprogramarecomposed ofreservedwords,symbols,andidentifiers. Reservedwordsarewordsthathaveaspecial meaningtothePascalcompiler. SymbolsusedinPascalincludemathematical symbolsandpunctuationmarks. Identifiersarenamesthatrepresentvarious constants,variables,procedures,orfunctions. Ø Ø Ø Ø Ø Ø Ø Ø Ø SoftwareDevelopment *PropertyofSTI Page39of48

  40. BasicComputerConcepts PASCAL Advantages: Ø relativelyeasytolearn powerfulandefficientlanguage stronggraphicscapabilities v v v Disadvantages: Ø notasstandardasCOBOLorBASIC poorinputandoutputcapabilities limitedfile-handlingcapabilities doesnotpossesstheabilitytomanipulate v v v v largecollectionofnumbersorwords AnexampleofaPascalprogramthatwillmultiply twonumbers,243and87andprintingtheresult SoftwareDevelopment *PropertyofSTI Page40of48

  41. BasicComputerConcepts PASCAL Theprogramcomputesfortheaverageof numbersreadfromaninput SoftwareDevelopment *PropertyofSTI Page41of48

  42. BasicComputerConcepts CLanguage ahigh-levelprogramminglanguagedeveloped byDennisRitchieattheBellLaboratoriesin 1972 namedC,becauseitwasinfluencedbyanother languagecalledBdevelopedbyKenThompson originallydesignedasasystemsprogramming language,whichmeansthatitwasusedto writeoperatingsystemsprograms Advantages: Ø Ø Ø Ø allowsdirectmanipulationofbits,bytes andwordsthatissimilartoassembly language usefulfornumerical,textprocessing,and databaseprograms verygoodgraphicsprogramming capabilities v v v SoftwareDevelopment *PropertyofSTI Page42of48

  43. BasicComputerConcepts CLanguage Disadvantage: Ø notintendedasalanguagefornon- v programmers,unlikeBASICandCOBOL;if youarenotfamiliarwiththelanguage,you cannotunderstandthestructure AnexampleofaCprogramthatwillmultiply twonumbers,243and87andprintingthe result SoftwareDevelopment *PropertyofSTI Page43of48

  44. BasicComputerConcepts C++Language developedbyBjarneStroustrupwhileworking attheBellLaboratories consideredasasupersetofC,andithasthe Ø Ø samecapabilitiesasCwithaddedobject- orientedfeatures AnexampleofaC++programthatwillmultiply twonumbers,243and87andprintingtheresult SoftwareDevelopment *PropertyofSTI Page44of48

  45. BasicComputerConcepts JAVA popularprogramminglanguageforcreating applicationsontheweb “Oak”,wasdevelopedinDecember1990by SunMicrosystems TheJavalanguagewastheperfectlanguage fortheInternetbecauseofthefollowing: Ø Ø Ø Simpleandfamiliar Object-oriented Architecture-neutral Portable Distributed Secure v v v v v v SoftwareDevelopment *PropertyofSTI Page45of48

  46. BasicComputerConcepts Interpretersand Compilers CompilersandInterpreterstranslateahigh- levellanguagetomachinelanguage SoftwareDevelopment *PropertyofSTI Page46of48

  47. BasicComputerConcepts Compiler aprogramthattranslatesaprogramwrittenin ahigh-levellanguage(sourcecode)and translatesitintomachinelanguage(object code) theadvantagesanddisadvantagesofa compiledcodeoveraninterpretedcodeare thefollowing: Ø Ø Compiledmachinecodesrunmuchfaster thaninterpretedones Compiledcodesoccupylessmemoryduring execution Onceaprogramiscompileditcanbere- runanytime Theprogramcanonlybeexecutedonce thetranslationiscomplete Anychangetothesourcecoderequiresa completerecompilation v v v v v SoftwareDevelopment *PropertyofSTI Page47of48

  48. BasicComputerConcepts Interpreter translatesandexecutestheprogramlineby line translateshigh-levelinstructionsintoan intermediateform,whichitthenexecutes theadvantagesanddisadvantagesofan interpreterarethefollowing: Ø Ø Ø Theinterpreterprogramisloadedinto memoryalongwiththeprogramsource codesoitusesmorememorythen compiledcodes Nocopyofthetranslatedcodeexist;ifyou wanttore-runtheprogramitmustbe interpretedalloveragain Interpretedcodesaremuchslowerthan compiledcodes Itisfasterandeasiertodetecterrorsin theinterpretedprogramthanthecompiled program Itiseasierandfastertomakechangesto theprogramwhichmakesdevelopment timefasterespeciallyforlargeprograms v v v v v SoftwareDevelopment *PropertyofSTI Page48of48

More Related