221 Software Design Lab - Spring 2005

Added 5.23.2005: Grades have been posted for both sections. Susan  Headcount wishes you all well. Sadly, she will not be back in the fall; the database project will involve books and authors, and the client will likely be Hardasnails Q. Editor, although Petulant (Pete) X. Publisher is also possible.

Swiss Bank Accounts last updated May 18, 2005. Grades are not shown.

Latest chatroom post: May 10. Another file I/O emergency kit, from Moustafa Makboul.

Added 5.16.2005 Important notes about  the final project.

To be explicit: I'm calling off the hesitation announced yesterday: the requirements are as stated on the Consolidated Requirements page.

BUT: if you can't get some piece working, get something else working. You want to be able to show something about the final project working, as of tomorrow. Set the hard problems aside; maybe class discussion or a chat room post will show you the solution.

AS OF TWO HOURS BEFORE CLASS TOMORROW, actually, if humanly possible. I have to have time to compile your programs and make sure the database script is where your program says to find it. We can't be doing that during class, or we'll never finish.

If you can't do that, then get it to me before class. Prototypes submitted after the start of class receive a maximum of half credit. Frenzied work done ten minutes before class almost always contains mistakes. Plan your time, decide how much you can finish, and then plan to have it done early. Tonight would be ideal.

A JAR file is fine, but make sure it really does self-launch. I need to see source for the final project, for sure, but not tomorrow. JAR files would be fine--unless, of course, you have the location of GaneshDDMemployees.sql hard-coded into your program, and that's not where it is on my machine. Send source and a JAR file.

Added 5.7.2005. Some people seem not to have the GaneshDDMemployees.sql file. It's on the CD I tried to give away all week, which some people apparently thought was only Eclipse 3.1. Or if your copy has gotten corrupted you are dead: mysql won't load it. Here's a link to a page with it all. Looooonnnnnng. On my system, I can go to that page, select all and copy to Notepad. Your mailer may not be so cooperative.

Added 5.7.2005. The consolidated requirements are now complete. That's a definition: if you find a difference between what's on that page and something else here, you may safely ignore the difference.

Added 5.6.2005. A consolidated requirements page. Subject to correction until noon Saturday May 7, but any such changes will not extend the requirements.

Added 5.5.2005. As announced in class Tuesday, there will be a quiz today (Thursday May 5) on getting information from two tables in a single SQL SELECT. I had in mind the use of INNER JOIN; if you know another way that works, of course I'll accept it.

Added 5.1.2005. It would be a really good thing if everybody could get MySQL installed. You could get the project done with only one person on the team having it installed, but don't miss this rare chance to get some hands-on experience with a core technology. See the new Chatroom for exchanges on how to overcome the various obstacles that seem to be bedeviling some people.

Added 4.24.2005. A link to the Final Project page.

Added 4.22.2005. The final project is to set up a database of employees, together with a Java program using the JDBC facilty to set up a user-friendly GUI to access and update the employee data. The purposes:

Added 4.18.2005. Setting up MySQL and running your first database program. Please do this as soon as possible. We need all teams able to do this much before the break. Once you have the program of Figure 25.31 running you can try SQL queries on the books database tables. This will prepare you for the QUIZ on basic SQL queries on Thursday, April 21. The quiz will NOT include INNER JOIN, INSERT, UPDATE, or DELETE. The last three are not supported by Figure 25.31, and inner join is too complicated for a first quiz. In the sixth edition, what you need for the quiz is on pp 1190-1201, or on the Chapter 25 PowerPoint slides 1-48.

Added 4.14.2005. Some notes about the final project.

Added 4.6.2005. Please put all your files for HW6 into a JAR file, and send me just that one file. This will be a major convenience for me, and you should know about JAR files anyway.

Added 4.6.2005 For a fine exposition of JAR files, see:

http://www.cs.laurentian.ca/badams/c1047/eclipse-tutorials/export-tutorial.html#export-jar
 

Thanks to Satish Venkatachalapathy for this link. There is very much more here than we need right now. The first example does it, I think.

Added 4.2.2005. Further (slight) extension to HW 6.

Added 4.2.2005. Thoughts on CRC cards.

Added 3.22.2005. Added requirements and changed due date(s) for HW 6.

Added 3.22.2005 (paper version distributed in classes 3.17.2005). Homework 6.

Added 3.14.2005. You are expected to use some consistent indentation in all Java code. There are dozens of styles; pick something and stick with it. Eclipse has a cool tool here. Select the whole program (Ctrl-A), then do Source/Correct Indentation. Voilá! Beautifully formatted code. Mouse around and you can find a way to specify your own style, if you wish.

2 points off on all future homework for major violations. The worst, of course, is all left-aligned. Just about unreadable, and totally unprofessional.

Added 3.12.2005. Homework 5.

Added 3.3.2005. A whole new look at HW3 and HW4. The HW3 teams will do both. HW3 will involve finding out how many terms of the various arctangent formulas are needed, and JUnit for testing. HW4 will be the computation of π, with the testing done like JUnit, except you program it, to be sure you understand JUnit. The link above will take you to a tutorial for doing the JUnit work in Eclipse.

Added 3.2.2005. A JUnit demo. There are two classes. Calculator does a very simple calculation: adding two doubles. TestCalculator, which extends TestCase, instantiates Calculator, computes a sum using it, then asks--via the assertTrue method from TestCase, when the computed result is equal to the value we supply as the expected result. If it is, assertTrue returns true; if not it returns false. A panel in the navigation area of the Eclipse workspace shows green for success and red for failure. You find this JUnit reporting screen by clicking on the chevron (» symbol) at the top of the navigation area and pulling down to JUnit. NOTE: this is probably worth doing, perhaps after doing the demo you get to from the link in the paragraph above, to get another view of JUnit.

In later work we will have a suite of tests, running checks on lots of parts of our calculations. As things pass their tests, the green progress bar grows as we smile. When we program something new, we add it to the suite and run the test on that and all previous. If everything still passes, we know that our new code did not break any old code.

There  is more, of course: we want some tests to "fail," because they are testing for error conditions. Stay tuned. I have a whole book on this! It's JUnit in Action, by Vincent Massol and  Ted Husted, Manning Publications Company, 2004. My example is slightly adapted from this book. I wish the whole book used Eclipse.

Added 3.1.2005 Homework 4, which asks you to use JUnit. (Somewhat superseded by material added 3.3.2005.)

Added 2.20.2005. The sensible way to compute a sine: with Horner's rule. Then test it with a test routine. This is entirely in the spirit of JUnit, which automates this kind of thing. JUnit has a learning curve to deal with, but once we climb that things go very quickly. Or so I am told.

Added 2.20.2005. Model solution to HW2, based on contributions by the WebSphere Visual Editor, Harvey and Paul Deitel, William Ho, Alex Casanova, Emmanouel Pantelides, Ganesh Viramuthu, Imroz Khan, Mourad Jads, and Dan McCracken.  (There were many other good solutions. These worked for the  present purposes.) HW2Model, Validate. (I have just noted, to my great dismay, that no women are represented here. My wives and five daughters would kill me! The next model solution will be by women only. I should go back and include some women's work here, but I'm outta gas.)

This model solution is worth studying. A few questions on the midterm will be based on it.  You will get paper copies on Tuesday, and also at the midterm. We'll talk about it some on Tuesday, and look at some other student work.

Added 2.20.2005. Homework 3, which asks you to use some arctangent formulas to compute an approximation to π. The value of π is known to about 2 billion decimal places, so we are not out to set a record! Useful ideas about Java and testing are involved.

Added 2.19.2005. A listing of topic coverage for the first midterm.

Added 2.16.2005. I have found a good article on what "static" means in Java, in four contexts. It includes the grumble, "Of all the many poorly chosen names in Java, "static" is the worst." See http://www.informit.com/articles/article.asp?p=349047.

Added 2.16.2005. Grades to date for both sections, in order by your "Swiss Bank Account" numbers. If you don't know what I'm talking about, you missed class yesterday. Write me and I'll give you your account number. From now on there will always be a first link to this. Don't quite want to put it on my home page, where it would invite snooping.

Added 2.16.2005. The Really Seriously Stupid Sine Computation that we looked at Tuesday 2.15.

Added 2.14.2005. Tentative subjects and homeworks for next seven or eight weeks. (Note added 3.3.2005: somewhat outdated.)

Added 2.13.2005. Homework 2, which has been modified slightly: you are to read and print a street address. This does not get validated in any way.

Added 2.13.2005. Notes inspired by reading your homework 1.

Added 2.1.2005. Instructions and code snippets for lab on Tuesday, Feb 1.

Added 1.29.2005. In response to several questions, I have written a short piece on the two subjects that are new to most of you in thinking about programming: writing a test plan first, and pair programming.

 

Added 1.20.2005. I have looked over the survey forms you filled out on the first day, with the following results:

Therefore: we must take things in a logical learning sequence. This information matches my expectations about your experience, based on having taught the course many times before. I have a plan for a succession of  homeworks that will take the target group--the big majority with no prior Java exposure--up to a level where everybody can write a correct program of some complexity. We'll learn OOP, and we'll learn program design, one small step at a time.

Conclusion: I cannot be diverted, very often, into discussions about advanced topics with the handful of students who know very much more about Java and programming in general. Such students will have a good contribution to make to the class and I trust will learn a lot, too. But this is not, and cannot be, a seminar in advanced Java topics. We'll cover intermediate topics, when we get to them.

Does this make sense?

Furthermore,  in view of the predominant student background, use of  Eclipse is not optional. I fully understand that some professional programmers don't use such tools, but most do. You need to know Eclipse, so we're going to use it. It just won't work for one member of a team to be using Eclipse while another member of the team uses Notepad and command-line execution and debugging. Once you know both, you can make your own informed choice. For this course, it's Eclipse.

Real-life scenario. A small company has a website that can handle a dozen simultaneous customers. They need  to be able to grow it to handle a hundred immediately, and they hope to expand to where they can have peak loads of 500 simultaneous user. (Peak loads of 100,000 are not uncommon in Real Life.) The company is using MySQL, but may want to switch to either Oracle or DB2. Most customers access the site with Blackberries, but most also sometimes use regular browsers and occasionally use text-based cellphone messaging. The system must automatically reconfigure its displays based on the user's access method.

Are you going to program this in Notepad? I don't think so.  You're going to be using SDOs (Service Data Objects) and Java Server Faces, in a Model/View/Controller architecture such as J2EE. The foundation of the MVC approach is a rigid separation of the Model, which contains the business logic and accesses the database, from the View, which is the collection of software that interfaces with the user.  WebSphere, the source of Eclipse, facilitates building Web-based applications of this sort. Learn Eclipse,  and you will have a head start on learning WebSphere. PS: we aren't going to do anything remotely this complex in this course, although you will get an introduction to the MVC pattern.

 

I am teaching two sections of 221 this spring: 221P at 2-3:15 and 221S at 5-6:15. The courses will not be identical, but I don't plan major differences in content or presentation.

Both will build on some key concepts from Extreme Programming, such as designing your test plan before you start programming, and doing all programming in teams of two. Both will use JCreator and Eclipse for IDEs, since each has important strengths. If you haven't heard of Eclipse, let me tell you that it has fantastic features, a non-trivial learning curve--and a 45% market share. You may hate it at first, but when the course is over other students will be asking you to teach it to them.

There will be separate Web pages for each section as soon as that makes sense.

 

Here is a tentative syllabus as of January 23. (See link below to first homework assignment.)

CSc 221 Software Design Laboratory

Prof. McCracken

 Tuesday and Thursday. Section P: 2-3:15 in NAC 5/150, and 221S 5-6:15 in NAC 5/109.

 Prerequisite: CSc 212, Data Structures

Office: NAC 8/202E Office hours 11-12 Tu&Th and after class

Email: mccracken@cs.ccny.cuny.edu or ccnyddm@aol.com

Website: ccnyddm.com  check for news, homeworks, etc.

Text: Deitel and Deitel, Java How to Program, Sixth edition, Prentice Hall, 2005.

The purposes of the course:

·        To help you develop considerable proficiency in Java. We have a good text and I trust the lectures will help, but you will learn programming by doing it. You will be working on some kind of programming assignment at all times except exam days.

·        To help you develop a reasonably full understanding of object-oriented programming: what it is, why it is important, and how to do it.

·        To extend your command of what is meant by program design.

·        To introduce you to the Java approach to compilation and execution, which involves the Java Virtual Machine executing bytecode. This is the heart of Sun’s slogan, “Write Once Run Anywhere.” We will see how this applies to code in everything from Enterprise computing (mainframes, which are definitely not dead) to the software that runs radios, car engines, anti-lock brakes, and a great many other things. It is the heart of IBM’s strategy for developing Web-based applications, using Java, Linux, and the DB2 (or any other) database system.

One of this text’s outstanding features is that all code examples are complete programs, and the programs are on the book’s CD as well as available directly from Deitel. I will be using these examples in many/most lectures. I don’t know how it will be possible to pass the course without a textbook. There are three copies on reserve in the Science Library. Check Barnes & Nobel and Amazon for used copies.

I will provide each of you with a CD containing all the examples and considerable other useful material. We need to get off to a fast start, and time wasted finding stuff that I can easily provide you is an unacceptable waste of your time and of course time.

There are significant differences between the fifth and sixth editions. The course CD contains a spreadsheet showing the approximate chapter match-ups. But the case study is entirely different, and we will be doing the case study.

We will review the basic ideas of object-oriented programming (OOP). You should have seen encapsulation and inheritance, but probably not the third leg of OOP, polymorphism. We will study graphical user interfaces (GUIs) in some detail, although it will be impossible to cover more than a fraction of the power that Java provides.

The course title is Software Design Laboratory. One part of our design methodology will be the widely-used Unified Modeling Language, UML. An important aspect of program development is the preparation of test data, before programming, so we know—and can communicate to others—what acceptable program performance will be. A required part of every—or almost every—programming homework will be your test plan.

There will be at least half a dozen homeworks to be designed and coded.

We will be exploring some of the ideas of the widely-accepted practices of what is called Extreme Programming. One key feature is that most if not all projects will be done in teams of two people, who will work whenever possible at one computer: one person types, the other proofreads and makes suggestions. The two trade places regularly. I will form the teams, at least for the first half or more of the course. The mandatory preparation of a test plan is another key idea from Extreme Programming. (Ideally, a testing program automatically runs your program against your test data. We will see if we can do a part of that.)

My tentative plan is that there will be two midterms and a major project, but no final. The first midterm will be on Thursday, February 24. You will have done two homeworks and gotten them back by that date.

I love email. Talk to me: ccnyddm@aol.com, or mail to mccracken@cs.ccny.cuny.edu will be forwarded there. I check my mail many times a day, usually. I can’t promise instant answers on all occasions, but I try.

Tentative grading, subject to change depending on how we do the project:

·        Homeworks: 25%

·        Quizzes (about 5): 20%

·        Midterm I: 15%

·        Midterm II: 20%

·        Final project, which will have several separately-graded deliverables: 20%.

In computing your course grade I discard your lowest homework and your lowest quiz.

This is one of my favorite courses. I designed it and introduced it, and have taught it probably 20 times. I never get tired of it, in large part because it’s always changing. I take great delight in showing people student projects, which are highly educational and satisfying to all. The switch to Java has certainly made the course more interesting for me.

NOTE: We will be using Java 1.5, sometimes apparently also called Java 5. It has some neat features, and some of these are used in the sixth edition of the text. The course CD contains JDK 1.5, for running under Windows or Linux.

We will be using two IDEs (Integrated Development Environment): JCreator and Eclipse. JCreator Learning edition is a free download. Eclipse is on the course CD. You will see why we want both.

Sketch of some of the homeworks:

·        Two homeworks involving a graphical user interface (GUI) to enter a customer’s name and other information. We jump right into classes, constructors, and event-driving program. Yes, I will show you a Hello World program, but we will set off at a brisk pace. See HW1 for the first assignment.

·        Two or possibly more homeworks computing p to a large number of decimal places, like a thousand. The value of p is known to at least two billion decimal places, so we’re not out to set any records. But it will be fun, and a lot of important program design and programming ideas will come into play.

Back to the top of the 221 page

Back to Dan McCracken's  Home Page