Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Java Basics!
You have completed Java Basics!
Preview
In this video, we go over the specifications for the program and flesh out our prototype.
Boilerplate
String name = console.readLine("Enter a name: ");
String adjective = console.readLine("Enter an adjective: ");
String noun = console.readLine("Enter a noun: ");
String adverb = console.readLine("Enter an adverb: ");
String verb = console.readLine("Enter a verb ending with -ing: ");
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We're all set to build
this tree story prototype.
0:00
So to prove this prototype works, let's
make a couple line story that prompts for
0:03
various different parts of speech.
0:08
If you want to, you can press pause now,
head over to work spaces and
0:11
try to swing it coding this before I do.
0:14
All right?
0:17
Here we go.
0:18
Okay, so
let's get started first things first.
0:19
Let's get rid of this code that
we've been working on here,
0:22
and let's talk about what we're gonna do.
0:24
Let's build a little thing here that says,
name is
0:26
a adjective noun.
0:31
So those are blanks there.
0:36
They are always adverb and
0:39
a verb ending in an ing.
0:43
All right, so, since we've been working so
much on this prompting stuff,
0:47
I'm pretty sure you have it by now.
0:51
I'm going to go ahead and
0:53
paste it on this video, the prompts that
you're going to need to fill this out.
0:54
So go ahead and copy that, and
then you can just come in here and
0:59
paste it and you'll see that we have
a name, adjective, noun, adverb and verb.
1:03
All right so let's print out a little
heading to start this off with so
1:08
do a console.printf, and
we'll say, Your Tree Story.
1:14
And let's use the new
line escape sequence.
1:20
And we'll put a little heading there, and
then a new line something, so let's just
1:22
draw some dashes underneath and have
a couple new lines, make it look clean.
1:27
All right, and then we'll end that and
1:31
now let's do it let's break it out so
console.printf.
1:34
So we wanna replace name with %s is a %s,
1:38
%s, and so again that's
1:44
name is an adjective noun Okay.
1:48
And so, we also want to make sure that
we put the period, the punctuation here.
1:53
We're gonna put a couple spaces, because
we don't have a new one at the end.
1:57
We want them to join together.
1:59
Okay, so let's do the next one.
2:01
We'll do console.printf.
2:03
And we'll say that they are always
adverb, verb, %s.
2:04
So that was adverb, comma verb,
and Iβll close that up.
2:13
Letβs go ahead, and we can put
a period and put a new line here.
2:17
OK, so Iβm going to save.
2:25
Letβs take a look and see what happens.
2:27
So run, then enter name,
I'll use another teacher.
2:30
Well he's Kenneth adjective
let's say incredible.
2:34
Now code quickly and
2:38
a verb ending in ing, hacking.
2:43
All right here is our tree story,
2:48
Kenneth is a incredible coder,
they are always quickly hacking.
2:50
I see a little bug in our English there,
looks like we should remember that one any
2:57
time we use an a,
we need to remember to put a parenthesis
3:02
in next to it in case the word following
starts with the vowel, we need to do that.
3:05
I wonder what other errors are out
there waiting for us to find them.
3:09
Great job building the prototype.
3:15
We are so close and I think it definitely
deserves getting a beta sticker.
3:16
We did find an error that was only obvious
when we ran it with input from the user.
3:21
The Java compiler will do its
best at preventing errors, but
3:26
there are some that it just can't
possibly see without running the program.
3:29
While this is only a small
flaw in our logic,
3:34
there are other types of errors that we
can introduce that can be catastrophic.
3:36
Since these types of errors can only
be found when the program is running,
3:41
they are called runtime errors.
3:44
So how do we find these errors before
we release our software to the public.
3:47
There's been numerous approaches
to solving this age old problem.
3:52
Now most commonly this problem is
solved by employing a team of people
3:55
that will run your software
through rigorous testing.
3:59
These people typically hold the title
of Q.A. engineers, where Q.A.
4:02
stands for quality assurance.
4:06
There's a lot of automation that
can happen during software testing,
4:08
and this field has grown
tremendously over time.
4:11
Some workspace formations split
this out into a separate team, and
4:15
others expect the software
developer write automated tests for
4:19
their code and perform all Q.A. tests.
4:22
Neither way is perfect.
4:25
Another approach is to release your
software to a subset of users known as
4:27
beta testers.
4:31
You will be absolutely
stunned by the creative ways
4:33
users will break your product.
4:36
By controlling the amount of
people using your software,
4:38
you can keep frustrations to a minimum,
but
4:41
still find important errors that you do
not want everyone out there to experience.
4:43
So what I'll do is this.
4:48
I'll send this program out
to my fellow teachers and
4:50
have them be beta testers
of our prototype.
4:53
Whatever they find or
4:55
bugs that they expose,
we'll incorporate into our final product.
4:56
Sound good?
5:00
Okay, one final prototyping
exercise before we get into
5:01
iterating on our product.
5:04
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up