Sei sulla pagina 1di 20

 COURSE 2

Java Programming: Solving Problems with Software


Current session: Feb 20 — Mar 27.

About the Course


Learn to code in Java and improve your programming and problem-solving skills. You will learn to
design algorithms as well as develop and debug programs. Using custom open-source classes, you
will write programs that access and transform images, websites, and other types of data. At the end
of the course you will build a program that determines the popularity of different baby names in the
US over time by analyzing comma separated value (CSV) files. After completing this course you will
be able to: 1. Edit, compile, and run a Java program; 2. Use conditionals and loops in a Java program;
3. Use Java API documentation in writing programs. 4. Debug a Java program using the scientific
method; 5. Write a Java method to solve a specific problem; 6. Develop a set of test cases as part of
developing a program; 7. Create a class with multiple methods that work together to solve a
problem; and 8. Use divide-and-conquer design techniques for a program that uses multiple
methods.

 Show or hide details about course Java Programming: Solving Problems with Software

WEEK 1

Welcome to the Course

Welcome to “Java Programming: Solving Problems with Software”! We are excited that you are
starting our course to learn how to write programs in Java, one of the most popular programming
languages in the world. In this introductory module, you will get to meet the instructor team from
Duke University, have an overview of the course, and hear from Google engineers about why they
find programming exciting and why Java is important. Have fun!

Video · Introduction to the Course

Reading · Programming Resources

Video · Resources to Help You Succeed

Video · Tips for Learning Programming

Video · Using Forums: How to Ask for Help Effectively


Iterables in Java

In this module, you will learn to design and run your first Java programs, including one program that
prints “Hello!” in various countries’ languages and another where you will copy and edit many files
by converting color images to grayscale. To accomplish these tasks, you will learn about classes
constructed for this course: Iterables libraries that allow you to perform the same task over multiple
lines in a document or webpage or multiple files within a directory. By the end of this module, you
will be able to: (1) Download and run BlueJ, the Java programming environment for this course; (2)
Access the documentation for the Java libraries specially designed for this course; (3) Edit, compile,
and run a Java program; (4) Construct for loops in Java; and (5) Use Iterables to run a program that
iterates over multiples lines in a document or webpage or multiple files in a directory.

Reading · Module Learning Outcomes

Video · Why Use Java?

Reading · Download BlueJ Environment

Other · Asking for help in the forums

Video · Using BlueJ to Program in Java

Video · Components of a Java Program

Video · Hello around the World in Action

Video · Iterables Summary: Using FileResource and URLResource

Practice Quiz · "Hello!" around the World

Video · Batch Grayscale: Converting Many Files

Video · Iterating Over Files: DirectoryResource

Video · Google Engineer Spotlight: Iterables

Reading · Optional Review Videos on the Seven Step Approach

Video · Grayscale Algorithm: Seven Step Approach

Video · Image Iterable in BlueJ: Grayscale

Video · Batch Processing Grayscale

Video · Saving Images with New Names

Video · Batch Grayscale Summary: Converting Many Files

Reading · Programming Exercise: Batch Grayscale and Image Inversion

Practice Quiz · Batch Grayscale Images

Quiz · Iterables in Java


Reading · End of Module Survey

Video · Solving Problems: The Seven Step Approach

Video · Finding Bugs In Code: Applying the Scientific Method to Fix Programs

Reading · Return to Grayscale Lesson

WEEK 2

Strings in Java

This module begins with a short presentation from Raluca Gordân, an assistant professor in Duke
University’s Center for Genomic and Computational Biology, about an important problem genomics
scientists encounter regularly: how to identify genes in a strand of DNA. To tackle this problem, you
will need to understand strings: series of characters such as letters, digits, punctuation, etc. After
learning about Java methods that work with strings, you will be able to find genes within a DNA
string as well as tackle other string related problems, such as finding all of the links in a web page. By
the end of this module, you will be able to: (1) Use important methods for the Java String class; (2)
Use conditionals, for loops, and while loops appropriately in a Java program; (3) Find patterns in the
data represented by strings to help develop the algorithm for your program; (4) Understand the
importance of designing programs that keep different data processing steps separate; (5) Use the
StorageResource iterable for this course to store some data for further processing; and (6) Rely on
Java documentation to better understand how to use different Java packages and classes.

Video · What is a String

Video · Understanding Strings

Video · Developing an Algorithm

Video · Positions in Strings

Video · Translating into Code

Video · Java Math

Reading · Programming Exercise: Finding a Gene and Web Links

Practice Quiz · Finding a Gene in DNA

Video · Introduction

Video · Conceptual Understanding

Video · While Loops

Video · While Loop Syntax and Semantics

Video · Coding While Loops


Video · Three Stop Codons

Video · Coding Three Stop Codons - Part I

Video · Coding Three Stop Codons - Part II

Video · Logical And / Or

Video · Coding And / Or

Video · Finding Multiple Genes

Video · Translating to Code

Reading · Programming Exercise: Finding Many Genes

Practice Quiz · Finding All Genes in DNA

Practice Quiz · Debugging: Part 1

Practice Quiz · Debugging: Part 2

Other · Debugging First Steps

Video · Separation of Concerns

Video · StorageResource Class

Video · Coding StorageResource Class

Reading · Programming Exercise: Storing All Genes

Practice Quiz · Using StorageResource

Quiz · Strings in Java

Reading · End of Module Survey

WEEK 3

CSV Files and Basic Statistics in Java

A common format for storing tabular data (any data organized into columns and rows) is in comma
separated values (CSV) files. In this module, you will learn how to analyze and manipulate data from
multiple CSV data files using a powerful open-source software package: Apache Commons CSV.
Using this library will empower you to solve problems that could prove too complex to solve with a
spreadsheet. By the end of this module, you will be able to: (1) Use the open-source Apache
Commons CSV package in your own Java programs; (2) Access data from one or many CSV files using
Java; (3) Convert strings into numbers; (4) Understand how to use “null” in Java programs (when you
want to represent “nothing”); (5) Devise an algorithm (and implement in Java) to answer questions
about CSV data; and (6) Analyze CSV data across multiple CSV files (for example, find maximums,
minimums, averages, and other simple statistical results).

Reading · Module Learning Outcomes

Video · CSV Data: Comma Separated Values

Video · Using CSV Libraries

Video · Which Countries Export...? Developing an Algorithm

Video · Which Countries Export...? Translating into Code

Video · CSVExport: Summary

Reading · Programming Exercise: Parsing Export Data

Practice Quiz · Which Countries Export...?

Video · Hottest Day in a Year: Comma Separated Values

Video · Converting Strings to Numbers

Video · Maximum Temperature: Developing an Algorithm

Video · Java for Nothing—null: When You Don't Have an Object

Video · Maximum Temperature: Translating into Code

Video · Maximum Temperature: Testing Code

Video · Maximum Temperature from Multiple Datasets

Video · Maximum Temperature Refactored

Video · CSVMax: Summary

Reading · Programming Exercise: Parsing Weather Data

Practice Quiz · Weather Data

Quiz · CSV Files and Basic Statistics in Java

Reading · End of Module Survey

WEEK 4

MiniProject: Baby Names

This module wraps up the course with a mini project that ties together the different practices, skills,
and libraries you have gained across the course! Using data on the popularity of different baby
names in the United States from the past several decades, you will be able to compare different
names’ popularity over time. While the data we have collected for this course is from the United
States, we welcome you to share data from other countries in the course discussion forums. Good
luck with the mini project!

Video · Baby Names MiniProject: Overview

Video · Baby Names MiniProject: Data Overview

Video · Baby Names MiniProject: Total Births

Reading · MiniProject Exercise Guide

Quiz · Baby Names

Reading · Extend Your Program

Reading · End of Module Survey

 COURSE 3

Java Programming: Arrays, Lists, and Structured Data


Current session: Feb 20 — Mar 27.

About the Course


Build on the software engineering skills you learned in “Java Programming: Solving Problems with
Software” by learning new data structures. Use these data structures to build more complex
programs that use Java’s object-oriented features. At the end of the course you will write an
encryption program and a program to break your encryption algorithm. After completing this course,
you will be able to: 1. Read and write data from/to files; 2. Solve problems involving data files; 3.
Perform quantitative analyses of data (e.g., finding maximums, minimums, averages); 4. Store and
manipulate data in an array or ArrayList; 5. Combine multiple classes to solve larger problems; 6. Use
iterables and collections (including maps) in Java.

 Show or hide details about course Java Programming: Arrays, Lists, and Structured Data

WEEK 1

Welcome

Welcome to “Java Programming: Arrays, Lists, and Structured Data”! We are excited that you are
starting our course to learn how to write programs in Java, one of the most popular programming
languages in the world. In this introductory module, you will hear an overview of this course and be
introduced to the supporting resources available.

Video · Welcome
Reading · Programming Resources

Reading · Feedback surveys

Cryptography: Keeping Information Secret

In this module, you will learn about the basics of cryptography, the science of keeping information
private and secure. You will learn about simpler cryptographic systems, which were used from the
Roman Empire through the early 1900s. You will learn how to implement these ciphers, as well as
how to break them. To solve these problems, you will work more with processing Strings, but also
learn about arrays—a way to store an indexable sequence of elements. You will be able to: (1)
combine Strings using concatenation; (2) build Strings within a Java program using StringBuilder; (3)
use arrays to store and manipulate collections of data; (4) refactor your programs for improved
organization using object-oriented principles; (5) and practice effective algorithm design.

Reading · Module Learning Outcomes / Resources

Video · A Brief History of Cryptography

Video · Introduction

Video · Creating and Manipulating Strings

Video · Counting Loops

Video · Character Class

Video · Developing an Algorithm

Video · Translating into Code

Video · Testing and Debugging

Video · Summary

Reading · Programming Exercise: Implementing the Caesar Cipher

Practice Quiz · Implementing the Caesar Cipher

Video · Introduction

Video · Arrays

Video · Random Numbers and Arrays

Video · Counting with Arrays

Video · Developing an Algorithm

Video · Summary
Reading · Programming Exercise: Breaking the Caesar Cipher

Practice Quiz · Breaking the Caesar Cipher

Video · Introduction

Video · Rewriting with Encapsulation

Video · Fields

Video · Visibility

Video · Constructors

Video · Summary

Reading · Programming Exercise: Object Oriented Caesar Cipher

Practice Quiz · Object Oriented Caesar Cipher

Quiz · Cryptography

Reading · End of Module Survey

WEEK 2

GladLibs: Stories from Templates

After completing this module, you will be able (1) to program a word frequency counter to analyze
any input text file, (2) to select and substitute words from a list into a document template using both
ArrayList and HashMap, (3) to create new lists to use in templates, (4) to recognize brittle code, and
(5) to improve code with flexible, object-oriented design. You will gain these skills in the framework
of developing a randomly generated story that we call GladLibs. You may discover that bald lions
change peoples’ lives, or that fluffy dinosaurs get things done in a jiffy. We hope you have fun
developing your Java skills this week!

Reading · Module Learning Outcomes / Resources

Video · Introduction

Video · High-level Design Concepts

Video · ArrayList

Video · ArrayList for Unique Words

Video · ArrayList Advantages and Issues

Video · Summary

Reading · Programming Exercise: Telling a Random Story


Practice Quiz · Telling a Random Story

Video · Introduction

Video · Brittle Code

Video · Adding New Labels

Reading · Programming Exercise: Using GladLibs

Video · HashMap

Video · HashMap for Unique Words

Video · HashMap for Flexible Design

Video · Summary

Reading · Programming Exercise: Improving GladLibs

Practice Quiz · Using and Improving GladLibs

Quiz · GladLibs

Reading · End of Module Survey

WEEK 3

Web Server Logs: From Logs to Visits

In this module, you will learn about how web server logs store information about visitors to a
website, and you will write programs to access information like user IP address, date and time of
access, and more. Using Java programs you write in this module, you will be able (1) to read
information from a web server log, (2) to count the number of unique visitors to your website, and
(3) to count the number of times each visitor uses your website.

Reading · Module Learning Outcomes / Resources

Video · Introduction

Video · Understanding Log Files

Video · LogEntry Class with toString

Video · Parsing Log Files

Video · Summary

Reading · Programming Exercise: Reading Log Files

Practice Quiz · Reading Log Files


Video · Introduction

Video · Developing an Algorithm

Video · Translating to Code

Video · Equality

Video · Summary

Reading · Programming Exercise: Finding Unique IP Addresses

Practice Quiz · Finding Unique IP Addresses

Video · Introduction

Video · Developing an Algorithm

Video · Translating to Code

Video · HashMap for Unique IPs

Video · Summary

Reading · Programming Exercise: Counting Website Visits

Practice Quiz · Counting Website Visits

Quiz · Web Server Logs

Reading · End of Module Survey

WEEK 4

MiniProject: Vigenère Cipher

In this module, you will develop a program to break the Vigenère Cipher, a more complex version of
the Caesar Cipher. You will improve your program in three stages: first decrypting messages where
you know the language and key length, then adding the capability to handle messages with unknown
key length, then extending the program to handle messages in a range of possible languages.
Through this project, you will be able (1) to effectively use HashSet and HashMap, (2) to expand an
algorithm from solving a simpler problem to handle broader, more complex problems, and (3) to
design and modify program code involving a more complex collection of classes, methods, and data.

Reading · Module Resources

Video · Introduction

Video · Known Language and Key Length

Reading · Programming Exercise: Known Language and Key Length


Practice Quiz · Known Language and Key Length

Video · Unknown Key Length

Reading · Programming Exercise: Unknown Key Length

Practice Quiz · Unknown Key Length

Video · Unknown Language

Reading · Programming Exercise: Unknown Language, Unknown Key Length

Quiz · Breaking the Vigenère Cipher

Reading · Extend Your Program

Reading · End of Module Survey

 COURSE 4

Java Programming: Principles of Software Design


Upcoming session: Feb 27 — Apr 3.

Commitment

4 weeks of study, 4-8 hours/week

Subtitles

English

About the Course


Solve real world problems with Java using multiple classes. Learn how to create programming
solutions that scale using Java interfaces. Recognize that software engineering is more than writing
code - it also involves logical thinking and design. By the end of this course you will have written a
program that analyzes and sorts earthquake data, and developed a predictive text generator. After
completing this course, you will be able to:

1. Use sorting appropriately in solving problems;

2. Develop classes that implement the Comparable interface;

3. Use timing data to analyze empirical performance;

4. Break problems into multiple classes, each with their own methods;

5. Determine if a class from the Java API can be used in solving a particular problem;

6. Implement programming solutions using multiple approaches and recognize tradeoffs;


7. Use object-oriented concepts including interfaces and abstract classes when developing
programs;

8. Appropriately hide implementation decisions so they are not visible in public methods; and

9. Recognize the limitations of algorithms and Java programs in solving problems.

10. Recognize standard Java classes and idioms including exception-handling, static methods,
java.net, and java.io packages.

Show or hide details about course Java Programming: Principles of Software Design

 WEEK 1

Welcome to the Course

Welcome to “Java Programming: Principles of Software Design”! We are excited that you are starting
our course to learn how to write programs in Java, one of the most popular programming languages
in the world. In this introductory module, you will hear an overview of this course and be introduced
to the supporting resources available.

Video · Welcome!

Reading · Programming Resources

Earthquakes: Programming and Interfaces

In this module, we will introduce a data set containing details about earthquakes around the world.
You will learn how to pull this data into a program, search through the data, and filter the data based
on desired criteria. By the end of this module, you will be able to (1) write programs that include
multiple classes and ArrayLists of class types, (2) find the maximum value in an ArrayList, (3) use a
Filter interface to search through data, (4) implement interfaces with method signatures, and (5)
combine several filters together.

Reading · Module Learning Outcomes / Resources

Video · Introduction

Video · Relationships Between Classes

Video · Licensing and APIs

Reading · Location class documentation and license resources

Video · Coding a Magnitude Filter

Video · Coding the Closest Quakes


Video · Summary

Reading · Programming Exercise: Searching Earthquake Data

Practice Quiz · Searching Earthquake Data

Video · Introduction

Video · Interfaces to Avoid Duplication

Video · Interfaces in More Depth

Video · MatchAll

Video · Summary

Reading · Programming Exercise: Filtering Data

Practice Quiz · Filtering Data

Quiz · Earthquakes: Programming and Interfaces

Reading · End of Module Survey

WEEK 2

Earthquakes: Sorting Algorithms

In this module, you will continue using real earthquake data to explore several sorting algorithms.
You will learn how to implement a selection sort and a bubble sort, then be introduced to a Java
method Collections.sort, which sorts with much greater efficiency. By the end of this module, you
will be able to (1) implement several sorting algorithms from scratch, (2) use efficient pre-existing
sorting classes, (3) modify a class’s compareTo method to choose the criteria by which objects of
that type are ordered, and (4) write classes that implement the Comparator interface to create
interchangeable sorting criteria.

Reading · Module Learning Outcomes / Resources

Video · Introduction

Video · Developing an Algorithm

Video · Translating to Code

Video · In Place

Video · Efficiency

Video · Summary

Reading · Programming Exercise: Implementing Selection Sort


Practice Quiz · Implementing Selection Sort

Video · Introduction

Video · Comparable

Video · Ordering Quakes by Magnitude

Video · Comparator

Video · Comparator for Distance from a Location

Video · Summary

Reading · Programming Exercise: Sorting at Scale

Practice Quiz · Sorting at Scale

Quiz · Earthquakes: Sorting Algorithms

Reading · End of Module Survey

WEEK 3

N-Grams: Predictive Text

In this module, you will explore some of the underlying concepts of predictive text. The first lesson
will introduce random character generation and then how to train the character selection based on
an input text. The second lesson will extend this concept to complete words. By the end of this
module, you will be able to: (1) base random text generation on the frequency of characters in a
training text, (2) collect a set of characters that occur in a text after randomly chosen initial
character(s) to create a semi-random text, (3) extend the predictive text generation to use whole
words, and (4) implement your own .equals method to compare complex data types.

Reading · Module Learning Outcomes / Resources

Video · Introduction

Video · Order-Zero, Order-One

Video · Finding Follow Set

Video · Implementing Order-Two

Video · Testing and Debugging

Reading · Programming Exercise: Generating Random Text

Practice Quiz · Generating Random Text

Video · Interfaces and Abstract Classes


Video · Summary

Reading · Programming Exercise: Interface and Abstract Class

Practice Quiz · Interface and Abstract Class

Video · Introduction

Video · Order-One Concepts

Video · Order-One Helper Functions

Reading · Programming Exercise: Word N-Grams

Practice Quiz · Word N-Grams

Video · WordGram Class

Video · WordGram Class Implementation

Video · Equals and HashCode Methods

Video · Equals Method Implementation

Video · Summary

Reading · Programming Exercise: WordGram Class

Practice Quiz · WordGram Class

Quiz · N-Grams: Predictive Text

Reading · End of Module Survey

WEEK 4

Java: Tools and Libraries for Everyone

As you reach the end of this series, you may wish to extend your Java experience to tools beyond
those provided here. This module will cover some of the Java basic information that is needed to
program without BlueJ or the edu.duke library. After completing this module, you will be able to: (1)
write a main method to start a Java program in any programming environment, (2) use the “static”
keyword to modify fields, (3) find alternative editors to use with Java, (4) use exceptions to debug
your program and make it more robust, and (5) reference Java libraries that are necessary to read
files without the edu.duke library.

Reading · Module Learning Outcomes / Resources

Video · Miscellaneous Java

Video · Main Method


Video · Static

Video · Editors

Video · Summary

Video · Introduction

Video · Understanding Exceptions

Video · Handling Exceptions

Video · Declaring Exceptions

Video · Throwing Exceptions

Video · Reading Files with Java.nio

Video · Hello Around the World with Eclipse

Video · Summary

Reading · Where To Go From Here

Quiz · Java: Tools and Libraries for Everyone

Reading · End of Module Survey

 COURSE 5

Java Programming: Build a Recommendation System


Upcoming session: Feb 27 — Apr 3.

Commitment

4 weeks of study, 3-6 hours/week

Subtitles

English

About the Capstone Project


Ever wonder how Netflix decides what movies to recommend for you? Or how Amazon recommends
books? We can get a feel for how it works by building a simplified recommender of our own! In this
capstone, you will show off your problem solving and Java programming skills by creating
recommender systems. You will work with data for movies, including ratings, but the principles
involved can easily be adapted to books, restaurants, and more. You will write a program to answer
questions about the data, including which items should be recommended to a user based on their
ratings of several movies. Given input files on users ratings and movie titles, you will be able to:
1. Read in and parse data into lists and maps;

2. Calculate average ratings;

3. Calculate how similar a given rater is to another user based on ratings; and

4. Recommend movies to a given user based on ratings.

5. Display recommended movies for a given user on a webpage.

Show or hide details about course Java Programming: Build a Recommendation System

5. WEEK 1

Introducing the Recommender

You will start out the capstone project by taking a look at the features of a recommender
engine. Then you will choose how to read in and organize user, ratings, and movie data in
your program. The programming exercise will provide a check on your progress before
moving on to the next step.

Reading · Module Description / Resources

Video · Introduction and Motivation

Video · Reading and Storing Data

Reading · Programming Exercise: Step One

Quiz · Step One

Reading · End of Module Survey

WEEK 2

Simple Recommendations

Your second step in building a recommender will focus on making simple recommendations
based on the average ratings that a movie receives. You'll also make sure that each
recommended movie has a least a minimal number of user ratings before including it in your
recommendations. Throughout this step you are encouraged you use your knowledge of the
seven step process to design useful algorithms and successful programs to solve the
challenges you will face.
Reading · Module Description

Video · Average Ratings

Reading · Programming Exercise: Step Two

Quiz · Step Two

Reading · End of Module Survey

WEEK 3

Interfaces, Filters, Database

In your third step, you will be encouraged to use interfaces to rewrite your existing code,
making it more flexible and more efficient. You will also add filters to select a desired subset
of movies that you want to recommend, such as 'all movies under two hours long' or 'all
movies made in 2012'. You'll also make your recommendation engine more efficient as you
practice software design principles such as refactoring.

Reading · Module Description

Video · Filtering Recomendations

Reading · Programming Exercise: Step Three

Quiz · Step Three

Reading · End of Module Survey

WEEK 4

Weighted Averages

In your fourth step, you will complete your recommendation engine by finding users in the
database that have similar ratings and weighting their input to provide a more personal
recommendation for the users of your program. Once you complete this step, you could
request ratings of movies from those you know, run your program, and give them
recommendations tailored to their own interests and tastes!

Reading · Module Description

Video · Calculating Weighted Averages


Reading · Programming Exercise: Step Four

Quiz · Step Four

Practice Peer Review · Step Five

Reading · End of Module Survey

Farewell

Congratulations on completing your recommender programming project! As we conclude


this capstone course, our instructors have a few parting words as you embark in future
learning and work in computer science!

Video · Farewell from the Instructor Team

Creators
 Duke University is consistently ranked as both a top undergraduate and research
institution, with world class faculty at all levels in undergraduate, graduate, and
professional schools.

Owen Astrachan

Andrew D. Hilton
Professor of the Practice
Assistant Professor of the Practice

Susan H. Rodger

Robert Duvall

Lecturer Professor of the Practice

Potrebbero piacerti anche