We may earn an affiliate commission when you visit our partners.
Course image
Robert Sedgewick and Kevin Wayne

The basis for education in the last millennium was “reading, writing, and arithmetic;” now it is reading, writing, and computing. Learning to program is an essential part of the education of every student, not just in the sciences and engineering, but in the arts, social sciences, and humanities, as well. Beyond direct applications, it is the first step in understanding the nature of computer science’s undeniable impact on the modern world. This course covers the first half of our book Computer Science: An Interdisciplinary Approach (the second half is covered in our Coursera course Computer Science: Algorithms, Theory, and Machines). Our intent is to teach programming to those who need or want to learn it, in a scientific context.

Read more

The basis for education in the last millennium was “reading, writing, and arithmetic;” now it is reading, writing, and computing. Learning to program is an essential part of the education of every student, not just in the sciences and engineering, but in the arts, social sciences, and humanities, as well. Beyond direct applications, it is the first step in understanding the nature of computer science’s undeniable impact on the modern world. This course covers the first half of our book Computer Science: An Interdisciplinary Approach (the second half is covered in our Coursera course Computer Science: Algorithms, Theory, and Machines). Our intent is to teach programming to those who need or want to learn it, in a scientific context.

We begin by introducing basic programming elements such as variables, conditionals, loops, arrays, and I/O. Next, we turn to functions, introducing key concepts such as recursion, modular programming, and code reuse. Then, we present a modern introduction to object-oriented programming.

We use the Java programming language and teach basic skills for computational problem solving that are applicable in many modern computing environments. Proficiency in Java is a goal, but we focus on fundamental concepts in programming, not Java per se.

All the features of this course are available for free. People who are interested in digging deeper into the content may wish to obtain the textbook Computer Science: An Interdisciplinary Approach (upon which the course is based) or to visit the website introcs.cs.princeton.edu for a wealth of additional material.

This course does not offer a certificate upon completion.

Enroll now

What's inside

Syllabus

BASIC PROGRAMMING CONCEPTS
Why program? This lecture addresses that basic question. Then it describes the anatomy of your first program and the process of developing a program in Java using either virtual terminals or a program development environment, with some historical context. Most of the lecture is devoted to a thorough coverage of Java's built-in data types, with example programs for each.
Read more
CONDITIONALS AND LOOPS
The if, while, and for statements are Java's fundamental control structures. This lecture is built around short programs that use these constructs to address important computational tasks. Examples include sorting, computing the square root, factoring, and simulating a random process. The lecture concludes with a detailed example illustrating the process of debugging a program.
ARRAYS
Computing with a large sequence of values of the same type is extremely common. This lecture describes Java's built-in array data structure that supports such applications, with several examples, including shuffling a deck of cards, the coupon collector test for randomness, and random walks in a grid.
INPUT AND OUTPUT
To interact with our programs, we need mechanisms for taking information from the outside world and for presenting information to the outside world. This lecture describes several such mechanisms: for text, drawings, and animation. Detailed examples covered include fractal drawings that model natural phenomena and an animation of a ball bouncing around in the display window.
FUNCTIONS AND LIBRARIES
Modular programming is the art and science of breaking a program into pieces that can be individually developed. This lecture introduces functions (Java methods), a fundamental mechanism that enables modular programming. Motivating examples include functions for the classic Gaussian distribution and an application that creates digital music.
RECURSION
A recursive function is one that calls itself. This lecture introduces the concept by treating in detail the ruler function and (related) classic examples, including the Towers of Hanoi puzzle, the H-tree, and simple models of the real world based on recursion. We show a common pitfall in the use of recursion, and a simple way to avoid it, which introduces a different (related) programming paradigm known as dynamic programming.
PERFORMANCE
When you develop a program, you need to be aware of its resource requirements. In this lecture, we describe a scientific approach to understanding performance, where we develop mathematical models describing the running time our programs and then run empirical tests to validate them. Eventually we come to a simple and effective approach that you can use to predict the running time of your own programs that involve significant amounts of computation.
ABSTRACT DATA TYPES
In Java, you can create your own data types and use them in your programs. In this and the next lecture, we show how this ability allows us to view our programs as abstract representations of real-world concepts. First we show the mechanics of writing client programs that use data types. Our examples involve abstractions such as color, images, and genes. This style of programming is known as object-oriented programming because our programs manipulate objects, which hold data type values.
CREATING DATA TYPES
Creating your own data types is the central activity in modern Java programming. This lecture covers the mechanics (instance variables, constructors, instance methods, and test clients) and then develops several examples, culminating in a program that uses a quintessential mathematical abstraction (complex numbers) to create visual representations of the famous Mandelbrot set.
PROGRAMMING LANGUAGES
We conclude the course with an overview of important issues surrounding programming languages. To convince you that your knowledge of Java will enable you to learn other programming languages, we show implementations of a typical program in C, C++, Python, and Matlab. We describe important differences among these languages and address fundamental issues, such as garbage collection, type checking, object oriented programming, and functional programming with some brief historical context.

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Suitable for beginners who seek an introduction to programming and computer science fundamentals
Covers crucial programming concepts like data types, variables, conditionals, loops, and functions
Imparts a strong foundation in object-oriented programming principles and practices
Emphasizes practical problem-solving skills applicable to various computing environments
Utilizes Java as the primary programming language, building proficiency in a widely-used technology

Save this course

Save Computer Science: Programming with a Purpose to your list so you can find it easily later:
Save

Reviews summary

Engaging cs for beginners

Learners say this course is largely positive, suitable for motivated beginners, features engaging assignments, and has a highly experienced instructor. It covers programming fundamentals such as Java, algorithms, and data structures, with an emphasis on practical applications. Students appreciate the assignments' real-world relevance, including examples from science and engineering. The course requires a strong foundation in mathematics and high school-level Java knowledge. Some learners find the difficulty appropriate for beginners, while others suggest it's closer to intermediate. Despite occasional frustration, students generally praise the course for its comprehensive content and challenging nature. Assignments are graded using an autograder that provides detailed feedback, helping learners identify and correct errors. Overall, the course is highly recommended for those seeking a solid foundation in computer science and programming.
Assignments are graded using an autograder that provides detailed feedback on errors, helping learners improve their code.
"I loved the course's rigor and how the auto grader guided me through the assignments."
"The autograder of the assignmet is great at providing you alot of feedback"
The course emphasizes the practical applications of programming, using examples from science and engineering.
"Amazing programming exercises."
"Good experience. Of course a lot to learn, and big effort to complete but provided new ideas!"
The course is led by highly experienced instructors who provide clear and engaging lectures.
"Great course by great teachers!"
"Prof. Sedgwich is a real artist!!!"
This course is well-suited for motivated beginners, providing a comprehensive introduction to programming.
"Great for beginners "
"great intro level course"
This course emphasizes hands-on learning with challenging assignments that provide practical experience in programming.
"This course was so impressive."
"The assignments are designed very well."
While labeled as beginner-friendly, some students find the difficulty level closer to intermediate. A strong foundation in mathematics and programming is recommended.
"I​t was very nice to code and execute Java Programs. The Instructor is very experienced."
"Not for beginners at all."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Computer Science: Programming with a Purpose with these activities:
Review Modern Computer Science: An Interdisciplinary Approach
Review key concepts and prepare for the course by reviewing the companion text.
Show steps
  • Read the preface and introduction
  • Review the table of contents
  • Identify chapters and sections that will be covered in the course
  • Make notes on key concepts
Follow Java Programming Tutorials
Supplement your learning with step-by-step guidance from online tutorials.
Browse courses on Java
Show steps
  • Research and identify reputable online Java tutorials
  • Start with tutorials that cover the basics of Java
  • Follow the instructions provided in each tutorial
  • Practice the concepts learned through exercises and examples
  • Seek assistance from the tutorial comments section or online forums if needed
Practice Java Coding Drills
Solidify your understanding of Java syntax and problem-solving through practice.
Browse courses on Java
Show steps
  • Find online Java coding exercises or purchase a coding practice workbook
  • Set aside regular practice time and commit to it
  • Start with basic exercises and gradually increase the difficulty level
  • Review your solutions against provided answers or consult discussion forums for assistance
Four other activities
Expand to see all activities and additional details
Show all seven activities
Participate in Online Study Group
Engage with peers, share knowledge, and reinforce your understanding through collaborative discussions.
Browse courses on Java
Show steps
  • Join or create an online study group for the course
  • Meet regularly with the group and discuss course topics
  • Review key concepts, work on practice problems together, and share resources
  • Seek support and clarification from group members
  • Present your own understanding of concepts to the group
Create Java Code Examples
Solidify your understanding of Java concepts by translating them into code and creating your own examples.
Browse courses on Java
Show steps
  • Identify a Java concept or algorithm you want to reinforce
  • Design and write a Java program that demonstrates the concept
  • Test your program to ensure it works as expected
  • Document your code with comments
  • Share your code with classmates or in online forums for feedback
Participate in Online Coding Challenges
Test your skills, solve real-world problems, and gain recognition by participating in online coding challenges.
Browse courses on Java
Show steps
  • Identify reputable online coding challenge platforms
  • Select challenges that align with your skill level and interests
  • Read the problem statement carefully and develop a solution strategy
  • Implement your solution in Java and submit it for evaluation
  • Analyze the results and reflect on areas for improvement
Develop a Simple Java Application
Apply your programming skills by building a functional Java application that solves a real-world problem.
Browse courses on Java
Show steps
  • Identify a problem or need that you can address with a Java application
  • Design and plan the functionality of your application
  • Write and test the Java code for your application
  • Deploy and run your application
  • Gather feedback from users and iterate on your design to improve the application

Career center

Learners who complete Computer Science: Programming with a Purpose will develop knowledge and skills that may be useful to these careers:
Software Engineer
A cornerstone of software development is the capacity to program efficiently. This course, Computer Science: Programming with a Purpose, offered by Princeton University, caters directly to this necessity. Through a comprehensive exploration of programming fundamentals, control structures, data structures, input/output mechanisms, and object-oriented programming, you will gain a robust foundation in software engineering practices. These concepts are the backbone of modern software applications, and mastering them will significantly enhance your ability to design, develop, and implement software solutions effectively.
Data Scientist
In the realm of data science, proficiency in programming is paramount. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a solid foundation in programming principles and techniques. Through hands-on exercises and real-world examples, you will learn how to manipulate and analyze data, construct predictive models, and communicate insights effectively. The course's emphasis on problem-solving and computational thinking aligns perfectly with the core responsibilities of a data scientist, enabling you to excel in this rapidly growing field.
Computer Programmer
As a computer programmer, you will be responsible for translating complex requirements into efficient and reliable software solutions. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a foundational understanding of programming principles and practices. Through a structured approach, you will learn the fundamentals of programming, including data types, control structures, functions, and object-oriented design. These concepts are essential for developing high-quality software applications that meet the needs of users effectively.
Software Developer
Software developers play a pivotal role in designing, developing, and maintaining software systems. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a comprehensive foundation in programming concepts and techniques essential for software development. You will learn how to write clean and efficient code, design modular and reusable components, and leverage object-oriented programming principles. These skills are in high demand in the software industry and will empower you to contribute effectively to the development of innovative software solutions.
Web Developer
Web development hinges on the ability to translate designs into functional and visually appealing websites. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a comprehensive introduction to programming concepts essential for web development. You will learn how to create interactive web pages, handle user input, and manage data effectively. The course's focus on object-oriented programming and modular design will equip you with the skills necessary to build robust and maintainable web applications.
Technical Writer
Technical writers are responsible for creating user manuals, technical documentation, and other written materials that explain complex technical concepts to non-technical audiences. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a solid foundation in programming principles and technical writing techniques essential for technical writing. You will learn how to organize and present technical information clearly and concisely, with a focus on user experience and readability. The course's emphasis on modular design and object-oriented programming will equip you with the skills necessary to create well-structured and maintainable technical documentation.
Systems Analyst
Systems analysts play a crucial role in bridging the gap between business requirements and technical solutions. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a solid foundation in programming principles and problem-solving techniques essential for systems analysis. You will learn how to analyze complex systems, design efficient solutions, and communicate effectively with stakeholders. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop robust and maintainable software systems that meet the needs of organizations.
Quality Assurance Analyst
Quality assurance analysts are responsible for ensuring the quality of software products and services. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a solid foundation in programming principles and testing techniques essential for quality assurance analysis. You will learn how to design and execute test cases, analyze results, and report defects effectively. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop robust and reliable software products.
Business Analyst
Business analysts are responsible for understanding business needs and translating them into technical requirements. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a foundation in programming principles and business analysis techniques essential for business analysis. You will learn how to gather and analyze business requirements, design and document system solutions, and communicate effectively with stakeholders. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop software solutions that meet the needs of businesses effectively.
Database Administrator
Database administrators are responsible for managing and maintaining the integrity of an organization's data. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a solid foundation in programming principles and data management techniques essential for database administration. You will learn how to design and implement database systems, optimize data storage and retrieval, and ensure data security and integrity. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop robust and scalable database solutions.
Information Security Analyst
Information security analysts are responsible for protecting an organization's data and systems from unauthorized access, use, disclosure, disruption, modification, or destruction. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a strong foundation in programming principles and security concepts essential for information security analysis. You will learn how to identify vulnerabilities, assess risks, and implement security measures to protect sensitive data and systems effectively.
Computer Scientist
Computer science is a vast and rapidly evolving field that encompasses the study of computation, data, and their applications. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a foundation in the core concepts of computer science, including programming, algorithms, and data structures. Through hands-on projects and real-world examples, you will gain a deep understanding of how computers work and how to solve computational problems effectively. This course is an excellent starting point for individuals aspiring to a career in computer science or related fields.
Project Manager
Project managers are responsible for planning, organizing, and executing projects to achieve specific goals. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a foundation in programming principles and project management techniques essential for project management. You will learn how to define project scope, develop project plans, track progress, and manage risks effectively. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop and manage software projects successfully.
Software Tester
Software testers are responsible for testing software products to identify and report defects. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a foundation in programming principles and testing techniques essential for software testing. You will learn how to design and execute test cases, analyze results, and report defects effectively. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop robust and reliable software products.
Data Architect
Data architects are responsible for designing, building, and maintaining data architectures to meet the needs of an organization. This course, Computer Science: Programming with a Purpose, offered by Princeton University, provides a strong foundation in programming principles and data architecture concepts essential for data architecture. You will learn how to design and implement data models, manage data quality, and ensure data security and integrity effectively. The course's emphasis on object-oriented programming and modular design will equip you with the skills necessary to develop robust and scalable data architectures.

Reading list

We've selected 11 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Computer Science: Programming with a Purpose.
Provides a wealth of practical advice on how to become a better Java programmer. It good choice for students who want to learn how to write more effective and efficient Java code.
Comprehensive reference guide to Java programming. It good choice for students who want to learn more about the Java language and its features.
Provides a comprehensive guide to writing clean and maintainable Java code. It good choice for students who want to learn how to write high-quality Java programs.
Provides a collection of best practices for writing effective Java code. It good choice for students who want to improve their Java programming skills.
Provides a fun and engaging introduction to design patterns in Java. It good choice for students who want to learn how to design and implement reusable Java components.
Comprehensive guide to Java concurrency. It good choice for students who want to learn how to write concurrent Java programs.
Provides a comprehensive guide to Java network programming. It good choice for students who want to learn how to write Java programs that can communicate over a network.
Provides a comprehensive guide to Java database development. It good choice for students who want to learn how to write Java programs that can interact with a database.
Fun and engaging introduction to Java programming. It good choice for students who are new to Java or who want to learn in a more interactive way.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Computer Science: Programming with a Purpose.
Computer Science: Algorithms, Theory, and Machines
Most relevant
101: Introduction to Computer Science
Most relevant
Programming for a Networked World
Most relevant
Java Programming Essentials: AP Computer Science A
Most relevant
Java Object-Oriented Programming: AP Computer Science B
Most relevant
102: Introduction to Computer Science
Most relevant
Introduction to Java Programming: Writing Good Code
Fundamentals of Network Communication
Decoding AP Computer Science A
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser