Автор: Joshua Crotts
Издательство: Springer
Год: 2024
Страниц: 474
Язык: английский
Формат: pdf, epub
Размер: 10.1 MB
This introductory textbook on Java programming is different from others by its emphasis on test-driven development. Writing tests before designing the implementation is incredibly important for debugging purposes and understanding the desired outcome. While testing is often an afterthought in other Java textbooks (being placed at the very end or not at all, which is in some ways cruel to withhold such capabilities from the student), this text takes a different, perhaps "functional“ approach to learning Java: it introduces testing and methods from the start, followed by conditionals, recursion, and loops (on purpose in this very order). It then dives deep into data structures and the Java Collections API, including streams and generics. After this, it pivots to object-oriented programming, exceptions and I/O, searching and sorting, algorithm analysis, and eventually advanced Java/programming topics.
This ordering of topics is well adjusted to prepare students to subsequent upper-level courses in data structure or algorithm design and implementation. The approach is illuminated by numerous code snippets and the students’ understanding is consolidated by about 250 exercises covering all topics covered in the book. With this book, readers will not only learn how to program Java, but also acquire a necessary precondition for successfully writing and testing commercial software.
A course in Java programming is multifaceted. That is, it covers several core concepts, including basic datatypes, strings, simple-to-intermediate data structures, object-oriented programming, and beyond. What is commonly omitted from these courses is the notion of proper unit testing methodologies. Real-world companies often employ testing frameworks to bullet-proof their codebases, and students who leave university without expose to such frameworks are behind their colleagues. Our textbook aims to rectify this delinquency by emphasizing testing from day one; we write tests before designing the implementation of our methods, a fundamental feature of test-driven development.
In our book, we design methods rather than write them, an idea stemming from Felleisen’s How to Design Programs, wherein we determine the definition of our data, the method signature (i.e., parameter and return types), appropriate examples and test cases, and only then follow with the method implementation. Diving straight into a method implementation often results in endless hours of debugging that may have been saved by only a few minutes of preparation. Extending this idea into subsequent computer science courses is no doubt excellent.
At Indiana University, students take either a course in Python or the Beginner/Intermediate Student Languages (based on Scheme/Racket), the latter of which involves constant testing and remediation. Previous offerings of the successor course taught in Java lead students astray into a “plug and chug” mindset of re-running a program until it works. Our goal is to stop this once and for all (perhaps not truly “once and for all,” but rather we aim to make it a less frequent habit) by teaching Java correctly and efficiently.
Object-oriented programming (and, more noteworthy, a second-semester Computer Science course) is tough for many students to grasp, but even more so if they lack the necessary prerequisite knowledge. Syntax is nothing short of a different way of spelling the same concept; we reinforce topics that students should already have exposure to: methods, variables, conditionals, recursion, loops, and simple data structures. We follow this with the Java Collections framework, generics, object-oriented programming, exceptions, I/O, searching and sorting algorithms, algorithm analysis, and modern Java features such as pattern matching and concurrency.
Скачать Learning Java: A Test-Driven Approach