OIM3640 - Problem Solving and Software Design

2025 Spring

Session 26 (4/29)

contain

Today's Agenda

  • Welcome/News/Announcements
  • Student Experience Questionnaire
  • Course Overview
    • Semester wrap-up
    • What/How to learn next
    • Non/Less-programming tech job
  • Data x Python

Welcome/News/Announcements

  • Project Submission: Saturday, 5/03
    • I am available this week if you'd like to meet and discuss your project.
    • Make sure your repository is public, and document in the README how to run your program.
      • You will receive ZERO if I cannot access or run your code.
    • If it requires API keys, Slack or email me on how to get and use them.
  • Proof(s) for Extra Credit Opportunity
    • Submit on Canvas, open until end of tomorrow
  • Grading
    • Exercises: Total 16 (15 + quiz0); one excuse is allowed
    • Quizzes: Each is worth 2 exercises; lowest grade will be dropped
    • Participation: 5 points (in class, office hours, Slack, etc.)

Student Experience Questionnaire (10 mins)

  • Canvas - Left Panel - Student Evaluation Questionnaire (SEQ)

Python in 100 Seconds

How is your project going?

Progress in 13 Weeks

  • 13 weeks ago:
    • You had little or zero knowledge about programming.
    • You had never used VS Code or GitHub.
    • You had never processed data from API.
    • You had never thought about using new GenAI tools beyond ChatGPT.
    • You had never created a web application.
    • You had never collaborated with others on a real programming project.
    • You had very limited understanding of LLMs and how it works.
    • You had never experienced the joy and challenges of problem-solving and creative development.
  • Today: Well, let us take a look...

Programming Concepts

  • Variables, Expressions, Statements
  • Types: int, float, str, bool, None, list, dict, tuple, set, ...
  • Functions
  • Control flow
    • Conditional Statements: if...elif...else
    • Iterations: for, while
  • I/O Programming
  • Web Framework
  • Pseudo-code/Debugging

Data Structures

  • Basic data structure types (containers/sequences)
    • List: an ordered collection of elements
    • Dictionary: an unordered collection of key-value pairs
    • Tuple: an ordered, immutable collection of elements
    • Set: an unordered collection of unique elements
  • Operations
    • Basic operations: slicing, concatenation, ...
    • List comprehension: a shorthand for loop
  • Advanced data structures in collections module
    • e.g., Counter, namedtuple, deque, ...

Functions

  • Procedural abstraction and decomposition
    • To break down complex problems into smaller, more manageable pieces.
    • Avoid duplicating code and make program easier to understand and maintain.
  • Defining and calling functions:
    def add_numbers(x, y):
        """Returns the sum of two numbers."""
        return x + y
    
    result = add_numbers(3, 5)
    print(result)
    
  • Anonymous (lambda) function: reduce(lambda x, y: x * y, [1, 2, 3, 4, 5])

Object Oriented Programming (OOP)

  • Class
    • A blueprint for creating objects that defines the attributes and methods of a particular type of object.
  • Object
    • An instance of a class that contains the data and methods.
  • Attributes
    • Data stored within an object that describe its state.
  • Methods
    • Functions defined in a class that can modify object's state or perform other actions.
  • Inheritance
    • A mechanism for creating a new class that is a modified version of an existing class, inheriting all of its attributes and methods.

Testing

  • Write enough tests to
    • cover every branch of each boolean expression
    • cover special cases:
      • Numbers: such as zero, positive, negative, int vs. float
      • Various sizes of data structures
  • Other Testing Concepts
    • Test-Driven Development (TDD)
    • Unit Testing
    • Integration Testing
    • Continuous Integration (CI)

Debugging

  • Key Strategies:
    • Use assertions to catch issues early.
    • Divide and conquer: isolate problematic code.
    • Use print() to trace program flow.
    • Get help from AI.
  • Tools:
    • Breakpoints to inspect program state.
    • Rubber Duck debugging to clarify your thoughts.
    • AI tools
  • Scientific Approach: Form a hypothesis, test it, analyze results, and iterate.
  • Pause and Think: Analyze the problem before diving into the code.

Program Design - Write a Function

  • Choose a name that clearly indicates what the function does.
  • Define parameters that specify the inputs to the function.
  • Write a docstring that explains what the function does and how to use it.
  • Write tests that cover a variety of inputs and expected outputs.
  • Write the body/implementation, using good programming practices:
    • Clear and readable code
    • Appropriate use of data structures and algorithms.

Program Design - Write a Program

  • Decompose the problem into smaller logical units
    • Functions, modules, etc.
    • Avoid units that are too large or too small
  • Write each part
    • Define the problem and requirements
    • Choose proper data structures and algorithms
    • Write pseudo-code first, then translate into code
  • Use wishful thinking
    • Assume a function or module exists and write code as if it's already available
    • Break down a complex problem into smaller, more manageable parts.

Beyond Basic Programming

  • Developing Tools
    • Integrated development environment (IDE): VS Code
    • Version Control System (VCS): Git/GitHub
  • Python Programming
    • Working with API
    • Using third-party libraries/packages, e.g. flask, NLTK, openai, ...
  • Automations
    • Web scraping
    • Data processing
    • Building AI agents
  • GenAI/LLMs

OK. What you have learned in this class ...

  • Evaluate your skills today compared to 13 weeks ago:
    • Theory: abstraction, decomposition, specification, design, ...
    • Practice: implementation, debugging, testing, collaboration, ...
    • Tools: IDE, GitHub, ChatGPT, ...
  • Congratulations on all you've accomplished!
    • You have built a strong foundation in programming.
    • You are capable of tackling complex programming tasks with confidence.

What ultimately matters in this course is not so much where you end up relative to your classmates, but where you end up relative to yourself when you begin.

Want to learn more about Python?

  • Strengthen Foundations
    • Principled, systematic programming and software design/engineering
    • Study advanced Data Structures and Algorithms (time/space complexity)
  • Enhance Data-related Skills
    • Database and SQL
    • Data wrangling, data analytics, data visualization, AI/ML
  • Scale Up Your Programs
    • Larger and more complex projects, i.e. FlaskDjango
    • More on virtual env, testing, version control, debugging, deployment
  • Leverage AI
    • Use AI tools for everything and explore AI-powered automation and solutions.
    • Build projects integrating GenAI.

What Else to Learn Next

How to Learn Next

Learning Building with AI

  • Adopt Popular/Mainstream Languages and Frameworks
    • Examples: React/Vue for front-end, Flask/FastAPI for back-end.
    • Benefits: Higher-quality code, rich resources for troubleshooting.
  • Run First, Optimize Later
    • Start small and focus on creating a running program (MVP).
    • Immediate feedback -> confidence. Easier for debugging.
  • Learn by Doing
    • Generate runnable code, then ask AI to explain unclear parts.
    • AI can provide detailed explanations and comments/documentation.
  • Handle Errors Effectively
    • Clearly describe the issue (steps, expected outcome, error message).
    • Roll back to the last working state if needed.

Example: Creating a Chrome Extension

  • Define Requirements
    • List desired functionalities for the extension.
    • Use AI for suggestions if needed.
  • Select Tech Stack
    • Standard tools: JavaScript, HTML, CSS.
    • Ask AI for recommendations on structuring your project.
  • Set Up a Basic Extension
    • Ask AI to generate a simple working example.
    • Test the extension in Chrome to ensure it runs correctly.
  • Iterate with Small Steps
    • Add one feature at a time (e.g., UI enhancements, API integration).
    • Regularly test and debug each step.

Non/Less-Programming Tech Jobs

  • Business/Data/BI Analyst
    • Excel, SQL, Python
    • Domain knowledge
  • Cybersecurity Expert
  • UI/UX Designer: Figma, etc.
  • IT Consultant: project management, communication, etc.
  • Digital Marketer
  • Technical Recruiter
  • Product Manager

Data x Python

--- # Revisit Quiz - OOP * How to optimize/improve/build more features - from MVP to product

- Object Oriented Programming (OOP)