Suppose you needed to some simulations before a business implements their ideas, what would you pick? Suppose you needed a program that understands natural language, what language would you pick? 5. Better understanding of programming What is the appropriate implementation of error languages will improve your code and reduce handling in your program? bugs What can you do in your code to improve maintainability? Suppose we want to produce the reverse of a string in Java. What is good/bad about this approach? static String reverse(String str) { String rev = ""; for (int i = 0; i < str.length(); i++) rev = str.charAt(i) + rev; return rev; } String origStr = "abcdef"; String revStr = reverse(origStr); ?? Terminology for Programming Language Imperative FORTRAN (uses GOTO statement) Categorization Imperative Procedural COBOL, PL/I, C, Python statements that Functional LISP (although most change a implementations provide program's nonlocals) LISP examples: variables (COND ((> X Y) X) imperative Structured (T Y)) without GOTO statements (+ (* L 2) (* W 2)) Procedural a step-wise structured Object-oriented C++, Java, Python process where the program Logical SQL, Prolog specifies how to SQL example: do something select Student.Id, Functional uses functions Student.Name which given a from Student, Enrollment particular value where Student.Id = of X always Enrollment.Id AND returns the same Enrollment.CourseNr result. = "CS3723";
Suppose you needed to some simulations before a business implements their ideas, what would you pick? Suppose you needed a program that understands natural language, what language would you pick? 5. Better understanding of programming languages will improve your code and reduce bugs What is the appropriate implementation of error handling in your program? What can you do in your code to improve maintainability? Suppose we want to produce the reverse of a string in Java. What is good/bad about this approach? static String reverse(String str) { String rev = ""; for (int i = 0; i < str.length(); i++) rev = str.charAt(i) + rev; return rev; } String origStr = "abcdef"; String revStr = reverse(origStr); ?? Terminology for Programming Language Categorization Imperative statements that change a program's variables Structured imperative without GOTO statements Procedural a step-wise structured process where the program specifies how to do something Functional uses functions which given a particular value of X always returns the same result. Imperative FORTRAN (uses GOTO statement) Procedural COBOL, PL/I, C, Python Functional LISP (although most implementations provide nonlocals) LISP examples: (COND ((> X Y) X) (T Y)) (+ (* L 2) (* W 2)) Object-oriented C++, Java, Python Logical SQL, Prolog SQL example: select Student.Id, Student.Name from Student, Enrollment where Student.Id = Enrollment.Id AND Enrollment.CourseNr = "CS3723";
cs3723OverviewWO.docx