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.

レビュー

CC

Great course, it does help to have some background knowledge in another language but it is doable without any. goes through some fun projects but also some work usable items such as CSV parsing.

DN

Aug 08, 2016

Filled StarFilled StarFilled StarFilled StarFilled Star

You need a little more experience in coding that just the first course, or try not to leave everything by the end of the week(as I did) to find what you need for the assignments. Great course !

レッスンから

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.

講師

Owen Astrachan

Robert Duvall

Andrew D. Hilton

Susan H. Rodger

字幕

Now, you can iterate over all the genes in the DNA string and print them out. If you wanted to iterate over the genes in the DNA string and do something else to them, the algorithm would be pretty similar. In fact, for whatever you want to do with each gene, it would look pretty much like this. The line in blue is the only thing you would change to do whatever you might want to. Maybe printing only those genes that meet some condition, counting genes. Saving them to a file. Building a web page with all of them or anything else you can think of. So if you wanted to do these other things, you might copy the algorithm you have pasted. Paste it into a new method and edit that line to make small changes. This approach works, but it's generally a bad idea. Why? Well, for one thing, copy and paste is error prone. You might forget to change some things that you need to. Even worse, if you find a bug in your original implementation after you have made copies, you need to go fix every copy you made. It is also tedious. You have to go find the method, copy and paste it and change it. This may not be so bad, if you want one variation. But if you want to do five different things, then it's pretty boring. And finally, it indicates bad programming design choices. Whenever you find yourself wanting to copy and paste, there's almost always a better approach. Let's take a moment to see something that we could improve about this algorithm. Why it would make a lot of work if we leave it as is and copy, paste, change and then we'll understand the motivation for how to make to fix it. This is our algorithm to print all the genes in a string. We're going to condense it down to a small description at the bottom and then copy and paste, it and change line five to print only the genes with a high CG ratio, and then we'll condense that down to a short description. Now we're going to copy, paste and edit to make several other algorithms to do various things with the genes from our DNA string like printing genes in HTML. Writing genes to an output file. Counting genes with the codon CGA or whatever else you want to do. All these algorithms are the same, except for the details of what they do to the DNA string. So at first, copy and pasting does not seem like a big deal. Later, we end up with some other DNA data, which list all the genes in a file, one gene per line. We need to do the same sorts of operations on this data too or the algorithm will be slightly different. It will have a for each line in the file loop, then do the same operation for the genes. With our copy and paste approach, we now need to write and test six algorithms. They're pretty similar to each other, so it may not be so hard, but it's tedious error prone work. Then if we end of with some other source of data, we're going to have to go make all six algorithms again for that data source. Likewise, if we end up with a new operation that we need to do. We're going to have to write three copies of it, one for each data source. Ick, what a mess. What we would really like to do is redesign out algorithm to use separation of concerns. Our initial algorithm does two tasks. One is getting all the genes from some source of data and the other is printing them or whatever else we want to do to each of them. We would like to split these up. By having the algorithms that find the genes, put them into some structure that can hold a list of all of the genes. Then having the algorithms that print the genes, count the genes or whatever else we want to do to the genes. They should operate on that list. Now if you need to add some new source of data, you just write a way to get its genes into our list and it automatically works with every processing algorithm you already wrote. Likewise, if you need to write a new processing algorithm, it automatically works with every source of data that you already wrote. No copying and pasting is ever needed. So, what is this thing that can hold all the genes your algorithms find? We're going to start by using a class from the edu.duke package called StorageResource, which is a simplified way of doing this. Later on, once you have learned a few more concepts, you will transition to using the standard Java.util.ArrayList class, which has similar functionality, but it's a lot more complex. Thank you.