This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.
Create a single Java main class in src/main/java/HelloWorld.java
:
:::java
import static spark.Spark.*;
import spark.*;
Planning starts with the objectives of the business. In each area of objectives, the question needs to be asked, “What do we have to do now to attain our objectives tomorrow?” The first thing to do to attain tomorrow is to slough off yesterday. Most plans concern themselves only with the new and additional things that have to be done—new products, new processes, new markets, and so on. But the key to doing something different tomorrow is getting rid of the no-longer-productive, the obsolescent, and the obsolete. The first step in planning is to ask of any activity, any product, any process or market, “If we were not committed to this today, would we go into it?” If the answer is no, one says, “How can we get out—fast?”
Systematic sloughing off of yesterday is a plan by itself—and adequate in many businesses. It will force thinking and action. It will make available people and money for new things. It will create the willingness to act. The plan that provides only for doing additional and new things with
If you're building a Java web app that you yourself or your organization will be deploying then you can save yourself a lot of trouble by avoiding the whole build-to-war + deploy-to-server approach. Instead, you should build your web app as a normal Java application with an embedded web app server. Don't build a WAR, just compile the code and serve the files out of their source location. This has the following advantages:
mvn jetty:run
command is being used for by many developers today.mvn jetty:run
or similar to achieve a quick, iterative dev cycle. But come time for deployment, they build a WAR and throw it over the wall to be deployed in some app serverJust because we're building bad-ass infrastructure and tools doesn't mean it can't be cool, stylish, and fun. Aesthetic matters. See The Substance of Style
Slick and fun meets powerful and serious.
Before Heroku (and a few others, like Github and Atlassian), developer-facing products were almost always stodgy, ugly, and completely lacking in style or fun.
We're part of the consumerization of IT.
import ( | |
"k8s.io/client-go/1.4/kubernetes" | |
"k8s.io/client-go/1.4/pkg/api" | |
"k8s.io/client-go/1.4/pkg/labels" | |
"k8s.io/client-go/1.4/pkg/apis/extensions/v1beta1" | |
"k8s.io/client-go/1.4/tools/clientcmd" | |
) | |
var ( | |
kubeconfig = flag.String("kubeconfig", os.Getenv("HOME")+"/.kube/config", "absolute path to the kubeconfig file") |
Gigaom picked up Derek Collison's tweet about Go. The article singles out static typing as a reason why Go will become a popular systems language.
I will add another reason: It is not an object oriented language.
In the 15 years I have spent designing, building and marketing what is essentially networked services (web apps), object orientation has always feel like a poor fit. Object orientation is simply not a universally applicable modeling principle. Going further, I will argue that, in most cases, it is a poor modeling principle. Objects rarely exhibit behavior. More often, objects are subjected to behavior by some external force (functions operating on data structures).
I find that keeping functions and data structures separate yield the most well structured programs. Best practices for writing web apps follow the same pattern: Use data transfer objects, use compositi
Take a simple Maven app like this JAX-RS app:/
$ git clone http://github.com/heroku/template-java-jaxrs.git
Cloning into template-java-jaxrs...
remote: Counting objects: 348, done.
remote: Compressing objects: 100% (156/156), done.
remote: Total 348 (delta 97), reused 348 (delta 97)
Receiving objects: 100% (348/348), 39.70 KiB | 45 KiB/s, done.
$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO]
#!/usr/bin/env bash | |
# bin/compile <build-dir> <cache-dir> | |
# fail fast | |
set -e | |
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path | |
# parse args | |
BUILD_DIR=$1 | |
CACHE_DIR=$2 |