Programming And Coding

855 Words2 Pages

CODING AND UNIT TESTING Programming Principles & Guidelines Coding Definition Coding: Coding is writing a set of instructions in a predetermined sequence(logic) to achieve a functional objective Typically done using one of the high level languages like C, Java, .NET, PHP, C++ Programming: Programming is a systematic approach in Software Engineering which includes Analysis, Design, implementation and maintenance May involve application of Computer Aided Software Engineering (CASE) tools in one or more activities Coding is a part of programming (implementation), while programming requires much higher competency than coding In this unit, programming term is used to mean coding. Coding Purpose: Implement Design in a best possible way to meet requirements Having clear objectives for coding helps achieve it (Weinberg Experiment) Goals: Write readable code in a structured manner Facilitate ease of understanding & Modification Reduce implementation costs (including later phases) Common Coding Errors: Memory Leaks Memory that is not freed when no longer needed Trying to free an already freed resource NULL referencing Trying to access the contents of a location that is set to NULL Lack of unique addresses Caused by aliasing Array index out of bound Arithmetic exceptions Off by one Starting at 1 when we should start at 0 Enumerated data types Cause overflow and underflow Illegal use of & instead of &&; assignment (=) instead of comparison (==) String handling errors Buffer overflow 1) Structured Programming: A good technique for organizing the code Precursor to Object Oriented Programming Replaces the need for GoTo Statements Supported by all languages A program has a static structure as well as a dynamic structure Stati... ... middle of paper ... ... entire system – hidden Information provided through access functions All possible operations on information - not necessary Makes system maintainable through reduced coupling Helps manage the complexity of software development Ex: Banking – ATM Account details – Account No, Name, contact, address, email, DOB, CustID, UserID, transaction details etc ATM transactions – Acct balance, transactions, UserID, Acct No Display or retrieval of PIN not required Function for change of address not required Programming Principles & Guidelines 3. Programming Practices Control constructs – keep simple Goto: minimize Information hiding User-defined types Nesting – deep nesting versus performance Module size – keep meaningful Module interface – keep simple Side effects – avoid or document properly Robustness – plan for exceptional conditions Exception handling Validating inputs

Open Document