Apache Mina SSHD SshServer Example

I’ve had an absolutely miserable time finding a fully working example of writing a Java ssh daemon. I finally just went ahead and wrote a working demo ssh daemon echo server, because I’m sure I can’t be the only one not able to get any of the current Apache Mina SSHD example ssh echo daemons to work.

One of the first things not to mix up is the difference between the Apache Mina and the Apache Mina SSHD projects. If you down load the Apache Mina project instead of the Apache Mina SSHD project binaries or source, you’re out of luck. You’ll spend many hours confused and have to implement everything you need practically from scratch. Remember to verify you are downloading the Mina SSHD project!

Read more ›

Posted in Advanced Java Tagged with: ,

Cool Colorful Java Println()’s

The classic System.out.println(“Some String …”) is not going away. All the cool kids use it. But what if you could be cooler than all the cool kids?

If you print to a terminal window, now you too can be cooler than all the cool kids by mixing Java and ANSI escape sequences. Even diehard Java programmers often have never used ANSI color codes directly with their println’s

What if you could print from your Java program to a terminal window in multiple colors?

Such a thing can’t be done! You shout.

In fact is can.

Prepare to be amazed!

Embedding ANSI codes in your print’s and println’s allow for colored backgrounds, colored text, and in the hands of the rare genius, multi-colored ASCII art.

Read more ›

Posted in Advanced Java Tagged with: , ,

Collection of JShell Commands

Java’s REPL, JShell, has a great collection of command descriptions available from the ‘/help’ command. Sometimes the terse descriptions given in JShell’s help are not descriptive enough. This JShell article is a somewhat complete list of JShell commands with better descriptions of the JShell commands.

JShell REPL commands give you a way to manipulate failed, overwritten, dropped and start-up snippets and even other commands. All commands start with a forward slash (/).

If you’re new to JShell, snippets are little chunks of Java code. For a quick introduction to JShell, see my Java 9 REPL tutorial. Once you get accustomed to JShell, you will realize there is not much of a limit to what you can do with it.

Read more ›

Posted in Advanced Java Tagged with: , ,

JShell … AKA the Java REPL … Uses

So you’ve heard of the Java JShell REPL, but don’t know what it’s good for? This overview’s for you!

Here are the three main uses for Java 9’s new JShell.

  1. It’s great for education.
  2. It’s great for investigation of APIs that are unfamiliar to you.
  3. It is wonderful for quick prototyping of tricky code.

So the Java REPL is best suited for education, investigation, and prototyping. That’s a pretty important list. Read more ›

Posted in Java for Beginners Tagged with: , ,

JShell … The Java 9 REPL

JShell, Java REPL introduced with Java 9, makes quick test code and simple Java snippets easy. Install Java 9, and you’ll have access to a shiny new JShell. If you’re using an early-access version on Mac OS X like I am, you’ll find JShell in the library hidden away in a path similar to the following.

/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin

Start up JShell on any OS and you’re presented with with the jshell> prompt. For JShell newBs, I recommend you start by typing /help at the JShell prompt to get a list of valid commands. Entering /help at the JShell prompt returns the following. Read more ›

Posted in Java for Beginners Tagged with: , ,

JavaFX TableView Explanation

JavaFX TableViews are for editing and displaying data. Think of the TableView as a very raw spreadsheet for JavaFX. If you are familiar with the TableView from Swing or another windowing toolkit, then you’re well on your way to understanding the JavaFX TableView.

If you are looking for a tutorial with JavaFX TableView code, check out my Simple JavaFX TableView Example. This post has more to do with explaining how basic TableViews fit together. Think of it as a companion to the Simple JavaFX TableView Example. I wrote this post, because just looking at a JavaFX TableView example is not nearly enough for the learning programmer to understand everything going on. JavaFX TableViews have a steep learning curve to put it mildly. Don’t feel bad if you’re having a hard time wrapping your mind around the TableView in JavaFX. It takes a little getting use to.

In JavaFX, all tables are enclosed in TableViews objects. If you’ve done a little JavaFX already, you could think of JavaFX TableViews as scenes for holding TableColumns. JavaFX TableColumns in turn are associated with specialized data objects called ObservableLists.

Read more ›

Posted in JavaFX Tagged with: , ,

Simple JavaFX TableView Example

JavaFX TableViews are perfect for making spreadsheets or just displaying data. In JavaFX, TableViews are a little trickier than normal UI elements, because you are dealing with data, and data can come and go as you use your application. This tutorial goes over setting up your first JavaFX TableView and populating it with custom data.

javafx_tableview_example

Typical JavaFX TableView in use.

Read more ›

Posted in JavaFX Tagged with: , , ,

JavaFX Button Example

Let’s say that you want to display multiple buttons and have different actions take place because of them. Buttons in JavaFX are just as important as in other UI toolkits. Here is a tutorial giving an example of two JavaFX buttons changing the text of a JavaFX TextField.

If you are brand new to JavaFX, be sure to go through the JavaFX tutorial I wrote a while back. This tutorial assumes you are using Eclipse. Read more ›

Posted in JavaFX Tagged with: , , , ,

Separation of Concerns

Separation of Concerns (SoC) is a principle of design used in computer programming. Separation of concerns results in modular programs. The idea of separation of concerns is that each part of a computer program should deal with one concern, and that each of those sections of code should be broken down into more targeted concerns, preventing the same module of code from addressing more than one concern at a time.

Concerns have different granularities, so that the 10,000 foot view of a solution will have separations that may be addressed by different company divisions, and more focused concerns would be addressed by teams of programmers, and so on down to the most granular of concerns being addressed by individual programmers or projects.

Read more ›

Posted in Advanced Java, Design Patterns, Functional Programming

Functional Programming

Functional programming languages, whether in Java, F#, or Clojure, share several common features. Functional programming is based off lambda calculus by Alonzo Church. The rules of lambda calculus have been applied in making languages more functional. The three lambda calculus rules that influence functional programming are:

  1. Functions are like mathematical functions. One-and-only-one return exists for each function argument or arguments.
  2. Variables are immutable. They don’t vary.
  3. Functions and variables are inter-changable.

This post will go over some of the common features that result from following these rules.

Read more ›

Posted in Functional Programming, Threading Tagged with: , , , ,

Functional Programming Languages

My favorite functional programming language is Clojure. I stumbled upon functional programming as a result of Clojure. Other popular functional programming languages are Haskell, Scheme, Scala, and Erlang. One of the newer functional languages is F#.

Haskell has a reputation as being a programming language that only allows functional programming. Where as a language like Clojure allows for mutation without a lot of difficulty. Haskell makes non-functional source hard to write.

Some of the other language choices out there are Erlang and OCaml/SML.

So here is the complete list: Read more ›

Posted in Functional Programming Tagged with:

Functional Programming Primer

Functional Programming is the hot new keyword in the coding world. Look! We’re Functional! However, I’m pretty sure most people jumping on the Functional Programming bandwagon have no idea where Functional Programming came from, why functional programming is important, or why the lowercase greek letter lambda is splashed all over the covers of Functional Programming books.

Never fear! This is  your quick Functional Programming Primer. I’ll give you the 10,000 foot overview of the benefits of Functional Programming, along with its benefits, and even explain the origin of the lambda. Read more ›

Posted in Advanced Java, Clojure, Functional Programming Tagged with: , , , , , , , ,

JavaFX 8 Hello World for Eclipse

Learning JavaFX 8 on Eclipse is simple, once you get past the first Hello World style example. This JavaFX tutorial introduces SceneBuilder, FXML, and JavaFX 8 for Eclipse with an event (an ActionListener) and a controller class.

Believe it or not, I have a JavaFX 8 book that never once explains how to hook up events between a POJO and FXML generated from SceneBuilder—hundreds of pages of how-to material on JavaFX, and not one word on events. Pretty sad.

No such letdown here.

This tutorial demonstrates and explains creating a window that displays a button and a textfield in JavaFX 8, and then hooking them up in Eclipse, using SceneBuilder, so that clicking the button results in the words “Hello World” displaying in the textfield.

Read more ›

Posted in JavaFX Tagged with: , , , , , , , , , ,

Multiple JavaFX Scenes Sharing One MenuBar

JavaFX allows primary stages to swap out scenes. However, JavaFX stages don’t handle MenuBars directly. So what if you want to swap JavaFX scenes, but need to share one MenuBar between them? The trick is using a BorderPane as a root pane of your scene to hold a top JavaFx MenuBar and a central pane that gets swapped, instead of swapping the primary stage’s scene.

Note: If you have never set up JavaFX in Eclipse, check out my JavaFX 8 with Eclipse Mars tutorial. Also, I have a JavaFX 8 Hello World tutorial, too.

This example creates a Main class, a menu controller class, and three FXML files. The FXML files are a MenuBar, and two AnchorPanes that we swap between. All the custom code is included below for quick reference.

JavaFX Menu Layout Diagram

When using one JavaFX MenuBar with multiple views, encapsulate everything in a BorderPane.

Read more ›

Posted in JavaFX Tagged with: , , , , , , , , , ,

JavaFX 8 with Eclipse Mars

JavaFX 8 is the coolest thing since sliced bread. After installing the 2015 Mars release of Eclipse, the first question I asked was, “Where’s JavaFX 8?”

Don’t worry. Installing the right tooling for Eclipse Mars to develop JavaFX 8 apps is not difficult at all if you download the pre-setup version here. However, if you want to add the JavaFX 8 tooling to an Eclipse that doesn’t have the JavaFX 8 tooling already, things get a little more involved. But still, it really isn’t difficult.

Read more ›

Posted in JavaFX Tagged with: , , ,

Simple Date Format in Java

Dates and calendars have long been a challenge for Java programmers. One ray of sunshine in dealing with dates and times has been the SimpleDateFormat class found in the java.text package. The SimpleDateFormat class allows easy conversion of custom formatted Strings to Dates and Dates to custom formatted Strings.

The main use case for the SimpleDateFormat class in real-world is for converting formats between different countries and when processing forms or data. Also, the SimpleDateFormat class is great for formatting times as well as dates.

Read more ›

Posted in Java for Beginners Tagged with: , , ,

8 Puzzle AI

One of my current projects is creating an 8 puzzle with an AI to solve it for the player. I’ve finished everything except the AI solver. The AI is fairly simple for a project like this, but I wanted to create a UML class diagram and an activity diagram for the project, just so I could break the code up over several weeks, as I have time to work on it, and just check bits and pieces off on the diagrams as done so I don’t forget what still needs working on, or the design I came up with.

In case you don’t know, an 8 puzzle is one of those flat sliding puzzles with the numbers one thru eight that you slide around until they are in order. Some people solve them with the empty square in the center, and some people solve them with the empty square down at the bottom righthand corner.

8 Puzzle Game

This is a screen capture of the 8 puzzle game I’m writing.

Read more ›

Posted in Artificial Intelligence Tagged with: , , , ,

Clojure Regex Patterns

Note: If you’re new to regex, check out my Clojure regex introduction.

Entire books have been written on the regular expression patterns. Regular expressions were designed originally by Larry Wall, the creator of the PERL programming language. He has claimed that he was just being lazy, because he didn’t want write the program to match some text, so he invented an entire new language to solve the problem instead. What he really did was revolutionize finding and replacing text in the entire realm of computer programming and word processing.

Clojure, like most languages worth learning, supports a full suite of regex patterns. In my previous tutorial, I explained the basics of finding words in a string using regular expressions and the Clojure language. However, regex doesn’t show its real power until you don’t have much more than an idea what you are looking for. That’s when regex shines its brightest. Read more ›

Posted in Clojure Tagged with: , ,

Introduction to Clojure Regular Expressions

If you need to validate user input, find and replace phrases or words in files, or extract information from documents, then you want to use regular expressions. Regular expressions, also referred to as regex, are the go-to tool for programmers when dealing with any sort of find, find-replace, or data extraction involving strings. I’ve worked with regular expressions for decades, and never found a situation where a match needed to be made, that regular expressions couldn’t come to the rescue.

Clojure regular expressions are based off of Java’s regular expressions API. Clojure uses Pattern and Matcher extensively. However, you don’t need to learn Java to use Clojure’s Regular Expressions. This tutorial teaches the basics of using Clojure’s regex.

Read more ›

Posted in Clojure Tagged with: , , ,

Clojure Regex

Note: If you’re new to regex, check out my Clojure regex introduction.

Clojure programming supports regular expressions, often just called regex. Underneath Clojure’s hood, Clojure is using Java’s java.util.regex package, so it isn’t surprising to see Clojure’s regular expressions (regex) has similarities to Java’s regular expressions.

Now of course, you could write regular expression code directly using Java from Clojure with Java-Interop. For example,

(def some-quote 
  (str "It was the best of times. "
  "It was the worst of times. It was Friday "
  "night and it was late."))

(def day-pattern "\\w*day")

(defn java-interop-regex
  "just doing Clojure regex with Java APIs"
  []
  (let [pat (java.util.regex.Pattern/compile day-pattern) 
        mat (.matcher pat some-quote)
        day-found (.find mat)]
    (println "Is there a day? ... " day-found)))


(java-interop-regex)

would print out, Read more ›

Posted in Clojure Tagged with: , , , , , , , , , ,

ClojureScript Game Engine Development with Construct 2

Clojure game programming benefits most from use of a game engine. While game engines are not specifically written for Clojure, Clojure is written to run on many VMs, and can take advantage of many game engines.

Construct 2 happens to be a great game engine for use with Clojure in the form of ClojureScript. ClojureScript integrates very nicely with Construct 2’s plugins and behaviors. Construct 2 allows for Clojure games (in the form of ClojureScript) to reach practically every platform out there for 2D game publishing.

Construct 2 / ClojureScript games can reach any platform HTML 5 games can reach, including:

  • All modern web browsers
  • Behave like native PC, Mac, and Linux apps using the Node-Webkit wrapper
  • Be published by Chrome Web Store, Facebook, Kongregate, NewGrounds, Firefox Marketplace, iOS and Android app stores, the Windows 8 Store, and Amazon
  • And can easily integrate advertising into games published to your own web site

Read more ›

Posted in Clojure, Construct 2 Tagged with: , , , ,

LocalStorage in Construct 2

Construct 2 LocalStorage saves variables in a similar way to the Construct 2 Dictionary. (See my Construct 2 Dictionary Tutorial if you are not familiar with Dictionaries.) The two big differences between LocalStorage and Dictionary are that LocalStorage doesn’t go away when the web browser restarts, and LocalStorage is asynchronous, not synchronous like Dictionary.

If that didn’t all make perfect sense to you, don’t worry. That’s the whole point of this tutorial. This tutorial teaches the basics of using Construct 2’s LocalStorage to store information when the game is not running. We’ll make a simple app that uses LocalStorage to store variables when the web browser is not running.

Construct 2 LocalStorage Example

LocalStorage saves variables when the web browser or even the computer are not running.

Read more ›

Posted in Construct 2 Tagged with: , , ,

Construct 2 Dictionary Tutorial

Construct 2 dictionaries store data in key-value pairs. Think of a Dictionary as a table with one column for names of values and one column for values associated with the names. If you want a value from a Construct 2 Dictionary, you request the value associated with a key (keys are sometimes called “names”). You can also have Construct 2 get all the key-value pairs, one pair at a time, and do things with them, such as print out high scores.

If you know one or more programming languages, this may all sound familiar to you. The Construct 2 Dictionary is similar to associative arrays and hashmaps found in other languages.

Names (called keys) cannot be duplicated in a Construct 2 Dictionary. For example, if you have a Dictionary of high scores, you could store key-value pairs of Doug-35, Bob-99, and John-42, but you could not have two scores named “John” in the list. For example, Doug-35, John-42, and John-33 would not work because the key “John” is used twice.

Note to Advanced Programmers: You can get around the no-duplicate-keys limitation by having multiple minion-style Construct 2 Dictionaries keyed off values from a master Dictionary. It would work like foreign keys in relational databases. I won’t go into that now, but remember, having no duplicate keys in a table is not a limiting factor. It just requires some extra planning and work.

Dictionaries are extremely useful for storing lots of related data. Dictionary use is easy for old-time programmers, but dictionaries need explaining in more detail for newer Construct 2 game developers. So, here’s a Construct 2 project example that shows the basics of Construct 2 Dictionary use.

New Empty Construct 2 Project

Select a new empty Construct 2 project.

Read more ›

Posted in Construct 2 Tagged with: , ,

Calling ClojureScript from JavaScript

Integrating JavaScript and ClojureScript into a single web page is easy, with the right start. JavaScript is the language of the web, for now anyway. However sometimes, you want a more modern, powerful language. Perhaps a language that combines modern functional paradigms with the old school power of Lisp. ClojureScript fits your needs.

ClojureScript is a modern functional Lisp that happens to compile down to optimized JavaScript. The base language is called Clojure. Clojure targets the JVM, .NET, and JavaScript VMs. ClojureScript is the JavaScript variety of Clojure.

Read more ›

Posted in Clojure Tagged with: , , , , , , , ,

JavaFX vs GWT

GWT and JavaFX are the only UI development toolkits Java developers need. Old time Java programmers argued about AWT vs Swing and discussed the benefits of Applets, JSF, and regular desktop apps. Now, stick to GWT or JavaFX. There isn’t really any need for the older UI technologies, from a Java programmer’s perspective.

If you’re not clear on differences or benefits of GWT and JavaFX, the two technologies compete, but not directly. GWT and JavaFX are both UI toolkits, but not for the same mediums. It’s like saying ships and trucks are both modes of transportation, but they really don’t compete directly, because one is for water transit and the other is for land transit. The same is true for GWT and JavaFX. They both compete in the UI world, but GWT is for web based apps and JavaFX is for traditional desktop apps that may interface with remote systems.

Read more ›

Posted in GWT, JavaFX Tagged with: , , , , ,

Calling Custom Clojure Functions from Java

Calling Clojure APIs from Java is discussed in my first tutorial. This tutorial explores calling your own Clojure functions from Java. A common use case for this is when you write a JavaFX UI and want to have the controller code written in Clojure.

Our first example explains how to call a simple Clojure function that takes no arguments and returns no values. (Technically, all Clojure fuctions return values, but that doesn’t mean we care about all values Clojure functions return.)

(ns java-clj-interop.core)

(defn hello-world
  "Yeah. You guessed it. This prints 'Hello World!'"
  []
  (println "Hello World!"))

Read more ›

Posted in Advanced Java, Clojure Tagged with: , , , , , , ,

Calling Clojure Functions from Java

Mixing Clojure functions and Java methods usually happens when pure Clojure applications need to interact with Java libraries. However, sometimes you have Clojure functions receiving events from a Java program. This is often the case when you have a Java program with a JavaFX, Java Swing, or Java AWT GUI, but you want all the controller logic written in Clojure. It certainly is  possible to write Clojure code calling Java libraries to create a decent UI, but doing so would be clunky at best.

It is also possible that you have a legacy Java application that you want to write Clojure plugins for. This is easily accomplished by calling Clojure functions from any appropriate place in the Java code. You can call directly into uncompiled Clojure scripts. To call Clojure scripts, you just need to know the right classes for loading your code.

Read more ›

Posted in Advanced Java, Clojure Tagged with: , , , , , , , , ,

Clojure Threading with Future

Clojure concurrency is easy with future. Speed improvements in Clojure on modern computers come from multi-threading. Besides tapping into Java’s thread system, Clojure has it’s own easy-to-use thread system, and Clojure threads don’t get easier to use than with future.

In its simplest form, use def with a future and then then dereference the value obtained. When the future is no longer needed, make a call to shutdown-agents for the program to exit properly.

For example:

(ns clj-future.core)

(defn do-something
  "Doing something noticable."
  []
  
  "Life. Don't tell me about life.")

(defn -main
  "I don't do a whole lot."
  []
  
  ;; create a var named some-string
  ;; and make it reference our future
  (def some-string (future 
                     (do-something)))
  
  ;; dereference the future value
  ;; and print it
  (println @some-string)
  
  ;; remember to shut down agents
  ;; so the program exits normally
  (shutdown-agents))

Read more ›

Posted in Clojure Tagged with: , , , ,

JavaFX Tutorial: Menu

JavaFX menu creation is essential to most complex applications. This JavaFx tutorial explains how to create menus using FXML. If need a quick introduction to JavaFX, check out my beginner’s tutorial, JavaFX 8 Hello World for Eclipse.

In case you’re new to JavaFX, or been away for a while, JavaFX 8 applications are arranged with a Stage, a Scene, Groups, and Leaf Nodes. The Stage is the application’s window. The Scene has the containers such as AnchorPanes and BorderPanes. Containers hold other containers, and leaf nodes. Leaf nodes are Controls such as Buttons, Labels, and text files.

JavaFX Stage, Scene, Group, and Leaf Node

JavaFX organizes its UI into Stages, Scenes, Groups, and Leaf Nodes.

Read more ›

Posted in JavaFX Tagged with: , , , , ,

Commenting Java Code

Comments are essential to good programming. Every file containing code should start with a comment justifying its existence. Comments should be sprinkled liberally throughout every file explaining the purposes and goals of every block of code that is not obvious. When you are in a hurry to finish a task, documenting what you are doing is not glamorous, but years later when you need to go make a fix for yourself or a customer, you’ll be very glad you took the time to comment your code.

Comments are ignored by the ‘javac’ command. The compiler does not care what you put into a comment. You can even put code into a comment and the ‘javac’ command will pretend it doesn’t exist.

Java has three commonly used types of comments. There are the single-line comments, multi-line comments, and Javadoc comments. They are all useful. However, Javadoc comments are the most powerful, because technical documentation for your code can be automatically generated from them.

Read more ›

Posted in Java for Beginners Tagged with: , ,

JavaFX … Information Alerts: Hello World

For decades, the traditional first program created when learning a computer programming language has been the “Hello World!” program. I like the tradition, so we’ll do the same here.

All Hello World does, is print out “Hello World!” As it turns out, there are lots of ways to do this in Java. They vary as widely as printing to a web page, or using a Swing dialog to pop up the words.

The two most cutting edge ways to do new Java apps are with GWT and JavaFX. GWT is too difficult for first time programmers, so I’ll stick to using the friendlier JavaFX for this tutorial.

This is part of the Java Tutorial series I’m writing for my son.

Read more ›

Posted in Java for Beginners, JavaFX Tagged with: , , , , , ,

Basic Java Object Oriented Programming

Java was written around the concept of Object Oriented Programming. That’s OOP for short. To understand Java programming, it’s useful to know what is meant by “objects” and “object oriented.”

Let’s explore objects by using the example of a car. A car has an owner, gas, and the ability to move. A car is an object. Objects encapsulate identity, state, and behavior. In the case of our car, the car’s identity might be Tom’s car. It is in the state of having a half tank of gas. Also, one of the car’s behaviors is its ability to accelerated so it is moving or braking to a stop. Read more ›

Posted in Java for Beginners Tagged with: , , , ,

Java Lambda Expression Basics

Java 8 introduced Lambda expressions. Lambda expressions are a shorthand for implementing single method interfaces. By a single method interface, I mean something like the following.

package com.tgenedavis.lambda;

public interface Flower {
	public void bloom();
}

The interface Flower has a single method called bloom(). Before Lambda expressions, we could implement single method interfaces with an anonymous class or with a normal class.

Read more ›

Posted in Advanced Java, Functional Programming Tagged with: , , ,

Java pass-by-reference and pass-by-value

The question often arises, “Does Java pass-by-reference or does it pass-by-value?” meaning when an argument is passed to a method in Java, is it the memory address of the variable given to the method, or the value of the variable that is passed to the method. What happens when you change the values of the arguments passed to a method?

Without getting into discussions about the virtues of functional programming versus traditional object oriented programming, let’s answer the pass-by-reference or pass-by-value question.

Java uses pass-by-value. This gets a little confusing with objects, but we’ll stick to primitives for the moment. Java passes copies of variable values to methods. When passing primitives to methods, such as ints and bytes, any changes to the values of the method arguments are only of local scope to the method.

Read more ›

Posted in Advanced Java Tagged with: , , , , ,

Comparing Strings in Java

A common mistake by new Java programers is using == for comparing Strings. Often the results are correct when using the == comparison with Strings.

String s1 = "my string";
String s2 = "my string";

if ( s1 == s2) {
	// this comparison evaluates to true
	System.out.println("Why not use =='s ?");
}

After all, == works for comparing ints. Not only does it work, but it is the correct way to do primitive comparisons.

Read more ›

Posted in Strings Tagged with: , , ,

Simple Java DOM XML Example

A Simple XML Document

Unfortunately DOM XML documents in Java have a reputation for being
hard to create. This simply isn’t true. The construction process is
very wordy though, but if you have a cheat sheet (like this tutorial),
then they really aren’t so bad.

I’m going to show you a base example that does everything that most
documents need to do. It has a root element. The root contains
another element that is its child. The root contains a comment too.

Read more ›

Posted in XML Tagged with: , , , , , , , , , , ,

Implementing Runnables the Lambda Way

Java 8 introduced Lambda expressions. We’ve been told they would bring simpler easier-to-read programs. We’ve been told that Lambda expressions create multi-core friendly code. Functional programs created with Lambda expressions have fewer bugs, saving development time and maintenance costs. Rumor has it that the release of Java 8 was the moment when the rise of the oceans began to slow and our planet began to heal; it was the moment when we ended all language wars and secured Java’s image as the last, best hope on Earth.

I’m not saying it’s all true. That’s just what I’ve heard.

To decipher rumor from truth, we need to start with some basics. There is a lot of complex, albeit cool, stuff that the experts can do with Lambda expressions. We’ll start with a basic tutorial on how to use a Lambda expression to implement a Runnable.

Read more ›

Posted in Advanced Java, Functional Programming, Threading Tagged with: , , , , ,

What is Java Used For?

Java is a computer programming language used to create software for servers, computers, tablets, phones, and all kinds of devices. Java creates programs found on web sites, in credit cards, in Blu-ray players, ATMs, HVACs, Minecraft and other games, robots, cars and programs found just about anywhere computers exist. Java applications run in small embedded microchips, normal computers, and massive multi-tier enterprise web-based applications.

Java is one of the most popular programming languages on the planet. Billions of devices run Java. Any sort of software can be written using Java.

Java programming is taught by most universities and colleges. This ensures a large base of developers for employers to choose from. Java is a mature language, developed in the 1990’s. Java software is in NASA’s Mars Rovers, so Java is an interplanetary language, too.

This is part of the Java Tutorial series I’m writing for my son.

Read more ›

Posted in Java for Beginners Tagged with: , , , , ,