Class Orientation & Fundamentals of Programming – Comprehensive Notes
National University – Institutional Context
- Vision: NU is a dynamic private institution committed to nation-building and internationally recognized for education and research.
- Mission: Guided by Dynamic Filipinism and the core values, NU is committed to providing relevant, innovative, accessible, quality education and development programs.
- Core Values (School of Engineering, Computing & Architecture)
• Patriotism • Compassion • Innovation • Integrity • Resilience - Stakeholder Commitments
• Students – formation of life-long learners, ethical & spiritual citizens, self-directed change agents.
• Faculty & Employees – competency enhancement, passion cultivation, just & fulfilling work environment.
• Alumni – pride, engagement, and loyalty to alma mater.
• Industry Partners & Employers – active collaboration; supply of graduates who spur growth.
• Community – improved living conditions and well-being. - GAINs (Graduate Attributes Intended for Nationalians)
• Leadership & Teamwork • Responsible Citizenship • Innovative, Creative & Critical Thinking
• Academic & Professional Competence • Effective Communication • Whole-Person Character • Life & Career Skills Orientation
Course Mechanics – Fundamentals of Programming
Assessment Breakdown
- Long Examinations – 40 %
- Class Standing – 20 % (≥ 3 major quizzes/term, assignments, seat-work/lab, recitation)
- Periodic Departmental Exams – 40 % (Midterm & Final)
Grade Computations
- Midterm: Midterm Grade=0.30(Lab)+0.30(Class Standing)+0.40(Periodic Exam)
- Final Period: Final Grade Period=0.15(Lab)+0.30(Class Standing)+0.15(Project)+0.40(Periodic Exam)
- Overall Course Grade: Final Course Grade=0.50(Midterm)+0.50(Final Period)
- Descriptive Equivalents
• 96–100⇒4.00(R:Repeat) • 91–95⇒3.50(Failure)
• 87–90⇒3.00 • 84–86⇒2.50 • 81–83⇒2.00 • 78–80⇒1.50 • 75–77⇒1.00
• Special marks: 0.00(Cheating),Dr(Dropped),Inc(Incomplete)
Systems & Software Foundations
What Is a System?
- Organized set of inter-related components (software, hardware, procedures).
- Receives inputs → processes data → produces outputs to accomplish a task/solve a problem.
- Programming perspective:
• Input layer (user data, sensors, files). • Processing logic (algorithms, conditions, loops).
• Output layer (screens, printers, files, APIs).
• Additional pieces: code modules, data structures, UI, interaction flows. - Real-world example: Fast-food order system (take order → assemble food → collect payment).
System Development Life Cycle (SDLC)
- Preliminary Investigation – define the problem.
- Analysis – study existing system; gather & analyse data; develop requirements.
- Design – preliminary & detailed planning of new system.
- Development – scheduling, programming, unit testing.
- Implementation – training, conversion, evaluation, maintenance.
Programming & Problem-Solving Workflow
- Understand the Problem – clarify vague requirements; act as counselor/detective.
- Plan the Logic (Algorithm Design) – use flowcharts or pseudocode; ignore syntax.
- Code the Program – choose a language (C, C++, Java, VB, COBOL, etc.); focus on correct syntax.
- Compile – translator converts high-level source to machine code (0s & 1s); catches syntax errors.
- Test – execute with varied data; identify syntactical vs. logical, compile-time vs. run-time errors.
- Production – deploy, train users, run with live data, obtain user approval.
Algorithms
- Definition: Finite sequence of clear, unambiguous steps that produces the correct output and halts.
- Human-level analogies: baking a cake, navigating to a destination, computing income tax.
- Example: “Prepare a cup of coffee” – 10 conditional & sequential steps.
- Essential characteristics
• Precise, unambiguous instructions • Finite number of steps • Guaranteed termination
• At least one output/result
Flowcharting Essentials
- Purpose: graphical blueprint of program logic; clarifies IPO (Input-Process-Output) paths.
- Two main chart types
• Program Flowchart – detailed internal logic.
• System Flowchart – data flow across departments; highlights duplication & delays. - Common Symbols (name – meaning)
• Oval/Pill – Start/End (Terminal) • Parallelogram – Input/Output
• Rectangle – Process/Computation • Diamond – Decision
• Arrow – Flow direction • Circle – On-page connector • Pentagon – Off-page connector
• Hexagon – Initialization/Preparation - Conventions
• Each statement in its own symbol box. • Input usually in a parallelogram with English statement.
Advantages
- Improved communication among stakeholders.
- More effective analysis & debugging support.
- Serves as permanent documentation.
- Facilitates efficient coding & maintenance.
Limitations
- Becomes clumsy with complex logic.
- Any change may require redrawing.
- Hard to reproduce with standard typing tools.
- Risk of losing the ‘what’ by focusing on low-level ‘how.’
Data Elements in Programming
Variables
- Memory locations whose contents can change while a program runs.
- Naming rules
• Single word, no spaces. • Letters, digits, hyphen, underscore allowed.
• Cannot start with a digit. • Avoid meaningless names; reflect stored value.
• Not start with special chars (e.g., “#total” invalid).
Variable Types
- Numeric – integers, floats, decimals (language dependent).
- Character/Text/String – letters, digits, punctuation (e.g., NAME="WASHINGTON").
- Logical/Boolean – TRUE or FALSE only.
Constants
- Fixed values; cannot change during execution.
- Named constants occupy dedicated memory; referenced by identifier.
Operators
- Arithmetic: +,−,∗,/,% (modulus).
• Statement form: \text{left_var}=\text{expression} e.g., x=x+1. - Relational: >,\ge,<,\le,==,!= ; evaluate to Boolean result.
- Logical: and,or,not combine/negate Boolean conditions.
Pseudocode
- Half-English, half-code description of algorithm; language-independent; not executable.
- Resembles actual code structures (IF, WHILE, FOR, REPEAT, END). Focus on logic, not syntax.
- Strengths: quickly conveys program idea to technical & non-technical audiences; can be embedded in documentation; easy to translate to any language.
- Characteristics
• Readable, structured, step-by-step. • No universal standard; depends on organization.
Sample Pseudocode Snippets
- Add two numbers
START
INPUT number1
INPUT number2
sum = number1 + number2
DISPLAY sum
END
- Rectangle area – similar pattern; multiply length & width.
- Square of a number – multiply number by itself.
Practice Problems (Flowchart Design)
- Prompt for name and height (in inches); convert height to feet (1 ft = 12 in).
• Formula: feet=12inches
• Output pattern: “Jose, you are 7.52 feet tall.” - Compute Midterm Grade: MG=31(Minor A)+32(Midterm Exam).
- Sales Discount: ask for purchase amount; if >2000 give 5% discount; display net amount.
- Assignment – Year-End Bonus
• Conditions: If monthly salary < ₱2 000 → bonus = 50 % of salary; else bonus = ₱1 500.
• Output: employee name & computed bonus.
Ethical & Practical Implications
- Academic honesty: cheating yields 0.00 grade – underscores integrity core value.
- Accessibility: emphasis on “accessible quality education” connects to clear documentation (flowcharts/pseudocode) that aids diverse learners.
- Maintenance mindset: use of SDLC phases, documentation, and structured design ensures sustainable software benefiting community & industry partners.