Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Let's discuss the basics of Web Application Development and how it differs from what you might be used to creating.
Pre-requisites
- Learn Java track
- HTTP Basics course
- Java Lambdas workshop
- Dependency Management with Gradle workshop
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
[MUSIC]
0:00
Hello and welcome.
0:04
I'm Craig and I'm a developer.
0:06
In this course we're going to do a hands
on approach, and a relatively gentle
0:08
introduction, to web development
with the Java programming language.
0:11
Now before we get started though,
0:15
I'd like to make sure we're
talking the same language.
0:16
So here's the thing, I've added some
detailed prerequisites to this course, and
0:19
I'm gonna assume that you,
0:23
as a java developer, understand what
I'm talking about, more or less.
0:24
Now that being said, if you don't have
any experience doing web development,
0:28
don't worry, we'll go over all the basics.
0:32
And I promise that once you complete
this course, you'll be very familiar and
0:34
very comfortable with how to serve a web
application from your local machine.
0:38
So I'm good?
0:41
Web application development is a lot
like regular application development.
0:43
First of there's output.
0:47
Now I've know you've seen web pages.
0:48
[LAUGH] Probably looking at one right now,
right?
0:50
Also there's some input, right?
0:53
There's form fields,
you know like enter your email,
0:54
how many stars would you rate
this restaurant et cetera.
0:57
So that's a lot like the other
development you've done right.
1:00
You output something and
then you wait for input and
1:02
then you do some processing of the data
and then you output something more.
1:05
It's pretty straight forward.
1:09
When dealing with web applications
there is a slight difference
1:11
in the way that we need to
think about our application.
1:13
Now I really wanna tune into
the difference here because I've seen it
1:16
confuse developers new to web programming.
1:19
And it doesn't have to be that way.
1:21
Okay, so get this.
1:23
So remember when we discussed HTTP,
or Hypertext Transfer Protocol, and
1:25
we talked about how it was
the language of the web.
1:30
Well the web application
the we're going to be exploring
1:32
here communicated using HTTP.
1:35
Now HTTP is a pretty basic protocol and
1:38
one of its key features
is that it's stateless.
1:41
This statelessness causes for
lots of eyebrow raises and furrowed brows.
1:45
But don't worry there's lots of tools
in place that will help us out.
1:50
And once you grasp the concept
of this statelessness,
1:54
you'll start to understand why
you need the support of tools,
1:57
like these Web frameworks we're
gonna discuss here in a bit.
2:00
Let's recall again how
the flow of HTTP works.
2:02
So a client makes a request to a server.
2:06
[SOUND] That request has some important
information encoded in it like what it
2:08
is they're trying to do to which resource.
2:12
As well as some specifics
about the client and
2:15
what the client is expecting to get back.
2:17
The server then receives this request and
2:20
uses that information
to produce a response.
2:22
That response also has some additional
information that the client can use to
2:26
better understand the response
that came back from the server.
2:30
And that's it, that's your program.
2:34
You make one request and
you get back one response.
2:36
That's the entirety of things.
2:39
The server isn't waiting for
2:40
you to come back, it doesn't really care,
it's done its job.
2:41
This single request and response works
really well following links around, right.
2:45
Where you click one link,
2:50
you make a request, get a response
back with more links to click.
2:51
State doesn't really matter there does it,
it's simple and static.
2:55
This is a static website.
2:59
You can actually just build this with
a folder and a handful of HTML files.
3:01
But, that's not the kinda site you're
probably dreaming of building is it?
3:05
You want one that the user interacts with.
3:10
You want a great user experience and
detailed flows.
3:13
You want to tailor your site
to the user's interests.
3:16
You want them to contribute data and
have them connect with other users.
3:19
You want to build a web application.
3:23
Well, the good news is you're
not alone in your wants.
3:25
Everyone wants a web application.
3:28
The users expect it,
your client demands it.
3:30
But here's the thing.
3:34
That kind of application requires state,
doesn't it?
3:35
Now, since we can't change
the statelessness of the protocol we must
3:38
work with it.
3:42
The best news you might hear today?
3:44
Others have blazed this path for us.
3:46
There are many practices and
patterns that are in place and
3:48
we can pretty easily now just stand
on the shoulders of giants and
3:51
knock out a really quick,
seemingly stateful web application.
3:54
And this is huge for us as developers.
3:58
The patterns those early
Internet giants place became so
4:01
common place that they were
able to be abstracted.
4:04
Much like how you donβt think about
when you assign a value to a variable
4:07
that youβre actually flipping a series
of bits in memory location somewhere
4:11
well the HTTP difficulties and
intricacies can be extracted away for
4:14
you, and you can just focus on
developing your killer app.
4:19
These abstractions usually come in
the form of what is known as a web
4:23
application framework.
4:27
There are a ton of these
frameworks available for
4:29
just about every language under the sun.
4:31
And each of them provides different levels
of what it is that is abstracted for you.
4:34
But there are a few things that all
frameworks will provide for you.
4:38
A Web Server, frameworks either embed or
integrate with a specific web server.
4:42
This is what handles the actual
communication over HTTP.
4:47
It makes sure it can handle many requests
at once and serve multiple clients.
4:50
Routing, an HTTP request specifies
the resource it wants through headers.
4:54
A framework allows developers
to define what code gets run
5:01
based on the resource requested.
5:04
They usually allow you to partially
match the URI to keep things dynamic.
5:06
Request and Response objects.
5:12
Frameworks usually give you
a very rich request and
5:14
response object that are representations
of the HTTP requests and responses.
5:18
These objects make it very easy for
you to check if a header exists or
5:24
handle normal HTTP status codes.
5:27
Templating most pages have
a surrounding style and
5:30
only little bits of dynamic data.
5:34
Instead of writing all those bits in
a string, the idea of templating is used.
5:36
Most frameworks allow you to snap in
different templating languages to
5:41
build pages and push in just the dynamic
bits into the surrounding HTML.
5:44
So each framework handles each of those
basic things a little bit differently.
5:49
But the point is this.
5:52
Once you kinda get a vibe for
how these work,
5:54
you should be able to transfer
the knowledge to other frameworks.
5:56
What I hope to give you with this course
is a driveby of a currently popular
6:00
easy to learn framework and show you how
to navigate around the documentation.
6:04
Chances are,
by the time you're watching this,
6:08
another killer framework has been
released, and it's all the rage.
6:11
But that doesn't mean that everyone
is going to switch to it immediately.
6:15
So there will be other
frameworks out there, and
6:18
you most likely will have to
interact with many of them.
6:20
In my opinion, a crucial part of being a
web developer is being able to drop in to
6:23
many environments and frameworks.
6:28
So with that in mind take a look at
a great micro-framework spark and
6:30
see its take on these
powerful abstractions
6:36
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