I am trying to write an MVC based application from scratch using Java 8 and Swing... I am having some difficulties with this.I want to know if I am going the correct way about this...My controller code is:public class Controllerv2 {private final Map<String, View> views = new HashMap<>();private final Map<String, Command> commands = new HashMap<>();private final ModelContainer model = new ModelContainer(this);public void addView(String key, View view) {    views.put(key, view);}public View getView(String key) {    return views.get(key);}public void showView(String key) {    getView(key).showForm();}public void addCommand(String commandString, Command cmd) {    commands.put(commandString, cmd);}public void executeControllerCommand(String commandString) {    commands.get(commandString).execute();}}public abstract class View {protected final JDialog dialog = new JDialog();protected final GUIAction guiAction = new GUIAction();protected final Controllerv2 controls;Views are subclassed from this class:public View(Controllerv2 suppliedController) {    this.controller = suppliedController;}// Fires up the formprotected abstract void initComponents();// Package up the fields into an object of type T and returnpublic abstract <T> T readFields();// Self explanatory functionspublic void showForm() {dialog.setVisible(true);}public void hideForm() {dialog.setVisible(false);}// For fields that need updatingpublic abstract void updateFields(String[] msg);     }This is an example of a concrete View:public final class VBasexLoginR extends View {    private JButton connectButton;private JLabel connectionLabel;private JTextField hostField;private JLabel hostLabel;private JLabel passwordLabel;private JButton pingButton;private JTextField portField;private JLabel portLabel;private JPasswordField pwField;private JLabel titleLabel;private JTextField uidField;private JLabel userId;public VBasexLoginR(Controllerv2 c) {    super(c);    initComponents();}@Overrideprotected void initComponents() {// Boilerplate to setup the form}@Overridepublic BaseXCredentials readFields() {    return new      BaseXCredentials(hostField.getText(),portField.getText(),uidField.getText(),pwField.getPassword());}@Overridepublic void updateFields(String[] msg) {    connectionLabel.setText(msg[0]);}}Am I going in the right direction with this?Also, I think I may need different models, one for running queries on BaseX and then ones for working with the results. Thus far I have...public class ModelContainer {private final Map<String, Model> models = new HashMap<>();private final Map<String, ModelCommand> commands = new HashMap<>();private final Controllerv2 controller;ModelContainer(Controllerv2 suppliedController) {    this.controller = suppliedController;}public void addModel(String key, Model model) {    models.put(key, model);}public Model getModel(String key) {    return models.get(key);}public void addCommand(String key, ModelCommand cmd) {    commands.put(key, cmd);}public void executeModelCommand(String key) {    commands.get(key).execute();}}Views can be got at through the getView method in controlsIs this correct or is this overkill?EDIT -- Taking into account Mat's Mug response, changed the code to reflect the naming conventions suggested.
Java MVC Implementation
java;mvc;java 8
I'm only going to scratch the surface here, and leave more seasoned java reviewers take a stab at this one, for I've never written a line of java-8 - but some concepts transcend language barriers.Naming in particular.Signatures can, and should talk.public void addView(String viewString, View view) {    views.put(viewString, view);}public View getView(String viewString) {    return views.get(viewString);}Take this line:public void addView(String viewString, View view) {The name viewString is pretty confusing. One has to look at how it's implemented to go oh, that's a key for a hashmap!. How about this instead?public void addView(String key, View view) {Now there's no ambiguity whatsoever, and getView(String key) becomes crystal-clear.Consistency is KingThis is just a minor thing, but I'd prefer consistency in the choice of verbs used to describe an action. For example, if a form is a view and a form gets shown, then a view should be shown too, not opened:public void openView(String viewString) {    getView(viewString).showForm();}Would bepublic void showView(String viewString) {    getView(viewString).showForm();}Same with commands - if a command executes, I wouldn't want the verb run to refer to the same thing, I'd prefer it be consistent:public void runControllerCommand(String commandString) {    commands.get(commandString).execute();}Would be:public void executeControllerCommand(String commandString) {    commands.get(commandString).execute();}Single-letter identifiersDon't. This:ModelContainer(Controllerv2 c) {    this.controls = c;}Is pretty darn confusing. Does c stand for controller, or for controls? Actually there seems to be something fishy going on here, controls is a nice name for a collection of controls, but you have it as ..a Controllerv2 (is there a Controllerv3? Avoid versioning classes like this, especially in the early development stages). Notice the puzzled expression in my face? ;)Anyway, that c would probably be better of as controller.Constructor argumentsI like this part - final makes your intent very clear:private final Map<String, Model> models = new HashMap<>();private final Map<String, ModelCommand> commands = new HashMap<>();private final Controllerv2 controls;ModelContainer(Controllerv2 c) {    this.controls = c;}I'd push it a step further though, and provide a way to initialize the class with models and commands, like this:private final Map<String, Model> models = new HashMap<>();private final Map<String, ModelCommand> commands = new HashMap<>();private final Controllerv2 controller;ModelContainer(Controllerv2 controller, Map<String, Model> models, Map<String, ModelCommand> commands) {    this.controller = controller;    this.commands = commands;    this.models = models;}And now the client code doesn't need to call AddCommand 20 times when there's that many commands to add.IndentationYour indentation is a little off, too. Whenever a code file ends like this:}}You know something's gone wrong. I'd blame it on the Java-style braces but that's just the c# mug talking, just select all but the signature and last closing brace, and give that Tab button some lovin' ;)