[MUSIC]
>> Greetings, everyone.
Welcome back to Microsoft's Java for Beginner Series.
My name is Brian Benz
and I'm a Cloud Advocate at Microsoft.
I'm joined by Mark Heckler,
who's going to give us an overview of Java.
Mark, do you want to tell us a little bit
about yourself and about Java?
>> Sure. Thanks, Brian.
My name is Mark Heckler.
I'm a Principal Cloud Advocate of Java
and JVM languages at Microsoft.
We're here today to talk about Java.
Let's start by talking about Java the language,
and then we'll continue talking about Java the platform.
Next, we'll discuss the native executable
or binary option for Java deployments.
Then finally how Java is, start to finish,
community driven
and why all of that is important for you as a Java developer.
First the language.
Java is strongly typed,
but it doesn't suffer a lot of the frustrations
that perhaps if you're coming from a loosely type language
that you might expect because
it does offer a lot of power and flexibility to,
again, put the power into you, the developer's hands.
Just a few examples of that,
very quick examples, but I like to show them
because again, that helps you get a better understanding.
I feel like as a developer of what I'm talking about,
the generics offer the compiler
and tools the ability to work for you on your behalf.
The diamond operator again supports type inference.
So when you have a variable,
it's defined of a list of type string for instance,
you don't have to re specify that arraylist
that you're creating constructing as a type string
the compiler and the tools understand that.
You also have things like local variable type inference,
so you can assign an object of a certain type
to a variable and the compiler
and the tools understand exactly
what that type of that variable should be.
Pattern matching again simplifies your code
and the compiler steps in and helps you a lot with that as well.
You also have things in terms of capabilities of Java.
Java is very expressive and by that expressive
I mean readable because as they say,
the compiler reads your code once,
you read your code over and over and over again,
because we as developers write our code,
we also have to read it, maintain it,
understand it as we change it,
and make sure that we don't break things as we go along.
Something like this.
Again, this is a very simple example,
but it's very clear exactly what's happening.
You have a default value that you're assigning to a variable
and if in the constructor
a different value is passed in that is valid,
anything over zero in length,
then that value is assigned to that variable.
Then, of course, with a great method,
we're just greeting the person as requested.
Java is object oriented in its foundation.
However, it also has functional capabilities as well.
The best of both worlds in that regard as well.
When you are entirely in the object oriented camp
or entirely in the functional camp,
once again you can see advantages or discrepancies
in terms of things you would like to have
that may not necessarily be within your chosen realm.
Java incorporates the best of both worlds.
You have things like sealed classes,
seal classes give you the ability to control inheritance
and control the extension of those classes and interfaces as well,
so that you don't have this uncontrolled landscape
in terms of what can be done with classes
that you define or interfaces,
again, that you define.
We have here a sealed class called
Rectangle that permits extension of square,
and we can inherit that.
We can extend that rectangle to create a square class
which cannot be extended from that point forward.
In terms of functional characteristics,
you have the ability to create immutable collections
or immutable entities of various different forms,
pass them down through a chain of operations
and to maintain that immutability as actions are taken
when that grouping of entities is passed throughout
that chain to be processed.
Java is also incredibly backward compatible,
which may not be important for new code that you're writing.
However, eventually it will be,
but it's certainly very important for older code
that you're maintaining on behalf of your organization.
There are many cases where very,
very old code that's absolutely essential to
an organization is being rebuilt, recompiled,
rerun using current versions of the Java virtual machine
and everything just works either with zero changes
or with absolutely minimal changes
and that's critically important for a language
that has a 25 year history.
Most languages have a lot of history,
and many languages, sadly,
break that compatibility several times
as they continue to evolve, not Java.
In terms of the Java platform,
the Java platform typically is built around the JVM,
the Java Virtual Machine.
That's the most common scenario.
When you create a job application,
you build it, you deploy it.
It's typically using a JVM.
The Java compiler in this case compiles to bytecode
rather than native platform specific code.
There is a just in time compiler that often yields
better than native performance in terms of a deployable artifact,
sometimes slightly worse, sometimes slightly better.
It averages out roughly native performance even with the JVM
and it runs anywhere there is a JVM.
So any new platform,
any new container format or what have you,
it all runs, your Java application will run there
as long as there's been a JVM created.
Which is an incredibly powerful tool to put
to work on your behalf with no effort on your part.
There's also a native option.
Of course, as you might imagine,
with the native option is platform specific.
It takes longer to build,
but it gives incredibly fast startup times.
Again, as you might imagine,
with the native option, with very low resource requirements,
it gives you another way to deploy
Java applications depending on your specific use case.
Java is 100 percent community driven,
it's 100 percent open source.
You have many different organizations and vendors
and providers who offer up a build of the open Java developers,
get the JDK and they may make different choices
in terms of garbage collection or optimizations,
but you are aware of what those are
and you can transport your code,
your applications from one to the other
in nearly every case with zero modifications.
Just potentially different outcomes, for instance,
with the garbage collection pauses
and different trade-offs that you might choose to embrace
for a particular targeted use cases.
The Java community process
allows you to be involved as an individual,
as an organization, as a corporation, whatever.
As an individual you can join in and contribute to the discussion,
contribute to specifications and specification requests.
You can discuss and evolve those specifications
and once the specifications are voted and approved,
they are provided with a reference implementation
and a Technology Compatibility Kit or TCK
which allows you to test early and test often
and verify that the implementation
that you want to provide or use works.
If not, that's fed back in prior to finalization
and release into the Java language as a finalized version.
In summary, Java is much more than just a language,
although it is a great language.
Java also is a platform.
Java provides a native binary option for deploy ability
and it's also 100 percent community driven start to finish.
With that, all I have left to say is go Java.
>> Thanks, Mark.
That was great.
Please check out the other topics
in Microsoft's Java for Beginners series.
>> Thanks so much.
[MUSIC]