You are probably being recorded, perhaps even transcribed.
Getting started (this will be our normal start-of-class sequence)
For the future: I’m happy to reserve a (somewhat random) seat at the front of the classroom for those who need a front seat as an adjustment or accommodation. Just let me know.
Approximate overview
Not yet available to submit.
Academic/Scholarly
Cultural
Peer
Wellness
Misc
What’s the best way to tell what work is due?
The daily eboards are most likely to have links to everything.
Gradescope will have the things you need to turn in, but Gradescope is sometimes overwhelming.
The schedule lists most things, but won’t always have links.
When should I fill out the pre-reflection?
Soon after you first read the assignment.
Will we have a pre-reflection for each mini-project?
Probably. I’d like to encourage you to (a) think about the purpose of each assignment, (b) do the brain dump thing, and (c) ask questions.
Will we have a post-reflection for each mini-project?
I’m happy to revisit post-reflections after we’ve done five or so.
What does it mean for an empty string to be correctly encoded? (from the rubric)
The empty string should be encoded as the empty string, rather than crashing and burning.
Do helper methods reside in the same class as the main method? (i.e., in (3) helper methods would be inside of MyClass and before the main method…)
Helper methods can either be in the same class or a different class. In many cases (e.g., you only need them in that class), it makes sense to put them in the same class. In others (e.g., you will use them in different classes), you put them in a separate class.
You can put them before or after the main method.
``` /**
/**
pen.println(greeting());
pen.close(); } // main(String[])
// +———+—————————————————– // | Helpers | // +———+
/**
If one wanted CeasarCipher and VigenereCipher to share code, would this require packages? (i.e., putting shared methods in a package imported to both CeasarCipher and VigenereCipher…)
Nope. Just put the shared code in static methods in another class.
What helper methods should Caesar Cipher and Vigneneré Cipher have and should they be the same helper methods?
Part of the assignment goal is for you to think about how best to decompose the problems.
Yes, it would be nice if some of the helper methods were shared between classes.
How do I share helper methods between classes?
/**
* A variety of procedures that help with encryption and
* decryption.
*/
public class EncryptionHelpers {
/**
* Convert a letter (in the range a-z) to the corresponding
* number (in the range 0-25).
*/
public static int letterToNumber(char letter) {
return 0; // STUB
} // letterToNumber
} // class EncryptionHelpers
/**
* Caesar Ciphers.
*/
public class CaesarCipher {
public static void main(String[] args) {
int result = EncryptionHelpers.letterToNumber('q');
} // main(String[])
} // class CaesarCipher
/**
* Vigeneré Ciphers.
*/
public class VigenereCipher {
public static void main(String[] args) {
int result = EncryptionHelpers.letterToNumber('q');
} // main(String[])
} // class ViginereCipher
Should each class be in its own file.
Yes. (It’s not always necessary, but I ask that you do so for this assignment.)
Where should we write the Java code?
Using the editor of your choice.
vim
, emacs, VSCode.
Do we really have to do meaningful commits on GitHub?
Nah. I’ll move that to another assignment.
Why are we creating PrintWriter
objects that we seem to call pen
?
It makes our code a bit more general/modifiable. If we change where we want output to go, we need only change one line in our code.
Is it okay to use System.out
?
Maybe for the first assignment. I’d prefer that you use PrintWriters.
In class, we said that it was bad practice to print error messages, but I am not sure if how to tell the user their input was invalid without printing a message.
It’s bad for utility methods to print error messages. UI programs can print error messages, and you’re writing UI programs for this assignment.
Why are we printing an error message to stderr rather than throwing an Exception as suggested in previous readings?
We haven’t covered exceptions yet.
You’re creating something that interacts directly with the user, so it’s appropriate to print error messages.
How do I get started coding in Java?
I think you’ll be fine after today’s class.
How do I best follow the Google Java style guidelines?
Read them.
Look at the code I write.
See if you can identify some basic principles.
Ask in class on Monday and we’ll see what we can come up with as a class.
This may be a stupid question, or something I forgot but what is a
README.md
file? And how do we code it?
A
README.md
file provides information about the project. If you use GitHub, it can create the basic template automatically.
It’s written in Markdown, but you can mostly treat it as a plin text file.
Use whatever editor you like to create it.
Do we have to use GitHub for the first assignment?
Nope. But you will need to use it for future assignments.
Do we have to write up the answers to the questions?
No. You’ll only be turning in the code for part 2.
Surprise! Even though the lab says to turn in the array problems, you
need only turn in FizzBuzz.java
If you’ve finished it already, turn it in now.
If not, finish it on your own.