<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jake Lewis</title>
    <description>The latest articles on DEV Community by Jake Lewis (@jsjlewis96).</description>
    <link>https://dev.to/jsjlewis96</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4347%2F82a004df-d0e2-4e1a-8e68-97041268b6e7.jpg</url>
      <title>DEV Community: Jake Lewis</title>
      <link>https://dev.to/jsjlewis96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jsjlewis96"/>
    <language>en</language>
    <item>
      <title>Help out a junior dev, rate my CV?</title>
      <dc:creator>Jake Lewis</dc:creator>
      <pubDate>Tue, 07 May 2019 19:17:34 +0000</pubDate>
      <link>https://dev.to/jsjlewis96/help-out-a-junior-dev-rate-my-cv-3kp9</link>
      <guid>https://dev.to/jsjlewis96/help-out-a-junior-dev-rate-my-cv-3kp9</guid>
      <description>&lt;p&gt;Just recently started looking for new work, and this is my first time writing a CV since getting industry experience. I've got something that I don't hate so far, but I'd really appreciate it if any of you had any tips.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://drive.google.com/open?id=1S7EZ0ZDURVB5b2aVtoLItc_P5JPC9qPw"&gt;https://drive.google.com/open?id=1S7EZ0ZDURVB5b2aVtoLItc_P5JPC9qPw&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks 😄&lt;/p&gt;

</description>
      <category>career</category>
      <category>discuss</category>
      <category>help</category>
    </item>
    <item>
      <title>Handling multiple implementations of a product</title>
      <dc:creator>Jake Lewis</dc:creator>
      <pubDate>Mon, 30 Jul 2018 12:17:44 +0000</pubDate>
      <link>https://dev.to/jsjlewis96/handling-multiple-implementations-of-a-product-10f7</link>
      <guid>https://dev.to/jsjlewis96/handling-multiple-implementations-of-a-product-10f7</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;While I'm aiming for general, non-specific solutions, I am using the real example of wanting to re-write my &lt;a href="https://github.com/logdyn/logdyn-api"&gt;Java logging library&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  So you want to rewrite your Java library in Node...
&lt;/h2&gt;

&lt;p&gt;I've recently run into the case where I want to reimplement an existing project in a new language, and I'm trying to decide how best to manage the new code in relation to the existing product.&lt;/p&gt;

&lt;p&gt;My initial thoughts were to simply create a new repository; this having the advantage of clear distinctions between project history and issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java-repo
    &amp;gt; master
        - dir1
        - dir2
node-repo
    &amp;gt; master
        - dir1
        - dir2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have seen arguments made for keeping all the code in one repository, such as being able to change an algorithm and having all the languages changed in one commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-repo
    &amp;gt; master
        - java
            - dir1
            - dir2
        - node
            - dir1
            - dir2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last suggestion I saw was that you could have a 'master' branch for each language, but I think that's a bit too unconventional for my taste...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-repo
    &amp;gt; master-java
        - dir1
        - dir2
    &amp;gt; master-node
        - dir1
        - dir2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What are your thoughts on this? Is there some hot new methodology that I've missed, or is keeping it old-school with separate repos the way to go?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I might be doing a post about the re-write process at some point, so even if it fails horribly it should at least be interesting! 😄&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>discuss</category>
      <category>git</category>
      <category>help</category>
    </item>
    <item>
      <title>Introducing re-agent: Java undo/redo &amp; command delegation</title>
      <dc:creator>Jake Lewis</dc:creator>
      <pubDate>Wed, 11 Jul 2018 19:45:23 +0000</pubDate>
      <link>https://dev.to/jsjlewis96/introducing-re-agent-java-undoredo--command-delegation-56n3</link>
      <guid>https://dev.to/jsjlewis96/introducing-re-agent-java-undoredo--command-delegation-56n3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;As a preface, this is my first library, and somewhat embarrassingly, my first blog post 😱. Any feedback would be greatly appreciated! All gotta start somewhere right?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While procrastinating over my degree, I realised that my final project contained some useful command delegation code that could make for a nice little library. With no further ado, let me introduce...&lt;/p&gt;

&lt;h1&gt;
  
  
  re-agent
&lt;/h1&gt;

&lt;p&gt;For the readme (it's down below as well) and code, checkout: &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/logdyn" rel="noopener noreferrer"&gt;
        logdyn
      &lt;/a&gt; / &lt;a href="https://github.com/logdyn/re-agent" rel="noopener noreferrer"&gt;
        re-agent
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A Java command delegation library, providing undo/redo functionality
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Logdyn re-agent &lt;a href="https://travis-ci.org/logdyn/re-agent" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/6ff34db935e9226a7133dbb746e97950ef3fef459eb0562f0d9e77fb7730ac89/68747470733a2f2f7472617669732d63692e6f72672f6c6f6764796e2f72652d6167656e742e7376673f6272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;A Java command delegation &amp;amp; undo-redo library.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Features&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Undo &amp;amp; Redo&lt;/li&gt;
&lt;li&gt;Loosely coupled &lt;code&gt;Command Pattern&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Listener support&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;The current release version can be found on the maven central repository. To use it add the following dependency to your &lt;code&gt;pom.xml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight highlight-text-xml notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&amp;lt;&lt;span class="pl-ent"&gt;dependency&lt;/span&gt;&amp;gt;
  &amp;lt;&lt;span class="pl-ent"&gt;groupId&lt;/span&gt;&amp;gt;com.logdyn&amp;lt;/&lt;span class="pl-ent"&gt;groupId&lt;/span&gt;&amp;gt;
  &amp;lt;&lt;span class="pl-ent"&gt;artifactId&lt;/span&gt;&amp;gt;re-agent&amp;lt;/&lt;span class="pl-ent"&gt;artifactId&lt;/span&gt;&amp;gt;
  &amp;lt;&lt;span class="pl-ent"&gt;version&lt;/span&gt;&amp;gt;1.2&amp;lt;/&lt;span class="pl-ent"&gt;version&lt;/span&gt;&amp;gt;
&amp;lt;/&lt;span class="pl-ent"&gt;dependency&lt;/span&gt;&amp;gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The release can also be found on the &lt;a href="https://github.com/logdyn/re-agent/releases" rel="noopener noreferrer"&gt;GitHub releases&lt;/a&gt;.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How to Use&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Commands&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;A realization of the  &lt;code&gt;Command&lt;/code&gt; interface is used to trigger an event in the subscribed &lt;code&gt;Executor&lt;/code&gt;. &lt;code&gt;Command&lt;/code&gt;'s do not specify execution behaviour, rather they are used to trigger an event and to capture any information that will be needed for that event.&lt;/p&gt;
&lt;div class="highlight highlight-source-java notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;class&lt;/span&gt; &lt;span class="pl-smi"&gt;ExampleCommand&lt;/span&gt; &lt;span class="pl-k"&gt;implements&lt;/span&gt; &lt;span class="pl-smi"&gt;UndoableCommand&lt;/span&gt; {

    &lt;span class="pl-c1"&gt;@&lt;/span&gt;&lt;span class="pl-c1"&gt;Override&lt;/span&gt;
    &lt;span class="pl-k"&gt;public&lt;/span&gt; &lt;span class="pl-smi"&gt;String&lt;/span&gt; &lt;span class="pl-en"&gt;getName&lt;/span&gt;() {
        &lt;span class="pl-k"&gt;return&lt;/span&gt; &lt;span class="pl-s"&gt;"Example Undoable Command"&lt;/span&gt;;
    }
}&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;There are also &lt;code&gt;UndoableCommand&lt;/code&gt;'s, which can be…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/logdyn/re-agent" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;This library started out as the undo / redo controller for another project, and was adapted by myself and my coder-in-crime &lt;a href="https://github.com/mattihew" rel="noopener noreferrer"&gt;Matt&lt;/a&gt; as part of our collaborative work &lt;a href="https://github.com/logdyn" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The product had to do three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make command delegation easy&lt;/li&gt;
&lt;li&gt;Make undo/redo easy&lt;/li&gt;
&lt;li&gt;Be as loosely coupled as possible&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  So what do I mean by command delegation?
&lt;/h4&gt;

&lt;p&gt;Say you have a program that opens a file, and provides you with two different editor windows. Each editor window will obviously have it's own controller, but the file operations can likely be shared between them. In our case, the editors don't particularly care how the file is opened, just that they don't get forgotten... &lt;code&gt;editor.populate(text)&lt;/code&gt; will do them nicely.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;FileMenuController&lt;/code&gt; will know when you want to open a file, but we want our editors to know too, but we don't necessarily want the controller to know about the editors. This is where our command delegator comes in.&lt;/p&gt;

&lt;p&gt;The editors will subscribe to the command delegator, saying that they want to know about certain events, which in this case is a &lt;code&gt;FileOpenCommand&lt;/code&gt;. When the file controller opens a file it will publish a &lt;code&gt;FileOpenCommand&lt;/code&gt; to the delegator, with whatever information necessary to open the file. The command delegator will forward this command on to the editors, and they will worry about the execution of the command.&lt;/p&gt;

&lt;p&gt;Ta-da! Successful delegation 😄 but we're not done yet...&lt;/p&gt;

&lt;h4&gt;
  
  
  Undo &amp;amp; Redo
&lt;/h4&gt;

&lt;p&gt;As anyone who has implemented an undo/redo system before will know, possibly the trickiest aspect is reverting state. To be able to undo an action, you need methods that act in a RESTful manner (behave the same regardless of state) &lt;em&gt;or&lt;/em&gt; you need to store the state you want to go back to.&lt;/p&gt;

&lt;p&gt;Being the magnanimous developers we are, we decided we didn't care, and you should be able to do what you want. Yay, freedom! In this vein, the process of undo/redo uses four entities: delegator, publisher, command, and executor. Commands may or may not contain state, but they are always fairly tightly coupled to their executor&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Delegator: handles executor subscription, and passes around calls for &lt;code&gt;DO&lt;/code&gt;, &lt;code&gt;UNDO&lt;/code&gt;, and &lt;code&gt;REDO&lt;/code&gt; to an executor of a command&lt;/li&gt;
&lt;li&gt;Publisher: anything that sends a command to the delegator&lt;/li&gt;
&lt;li&gt;Command: basically a data packet, might have utility methods to be used by the executor&lt;/li&gt;
&lt;li&gt;Executor: Controls how commands are 'done', with the option of implementing undoing and redoing&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  So how do I install it?
&lt;/h4&gt;

&lt;p&gt;Just add it as a dependency on Maven! (The always brilliant &lt;a href="http://tutorials.jenkov.com/maven/maven-tutorial.html" rel="noopener noreferrer"&gt;Jenkov tutorials&lt;/a&gt; have you covered)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;com.logdyn&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;re-agent&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.2&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  So how do I use it?
&lt;/h4&gt;

&lt;p&gt;I'm lazy so this is coming straight out of the readme, but I'm eager for suggestions to improve it 👍&lt;/p&gt;

&lt;h5&gt;
  
  
  Commands
&lt;/h5&gt;

&lt;p&gt;A realization of the  &lt;code&gt;Command&lt;/code&gt; interface is used to trigger an event in the subscribed &lt;code&gt;Executor&lt;/code&gt;. &lt;code&gt;Command&lt;/code&gt;'s do not specify execution behaviour, rather they are used to trigger an event and to capture any information that will be needed for that event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExampleCommand&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;UndoableCommand&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Example Undoable Command"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are also &lt;code&gt;UndoableCommand&lt;/code&gt;'s, which can be executed by any &lt;code&gt;Executor&lt;/code&gt;, although if you want to make use of undo/redo an &lt;code&gt;UndoableExecutor&lt;/code&gt; must be used. By default the &lt;code&gt;reexecute()&lt;/code&gt; method calls &lt;code&gt;execute()&lt;/code&gt;, although this can be overridden. An &lt;code&gt;UndoableCommand&lt;/code&gt; must provide data necessary for undoing an action, as well as the initial execution.&lt;/p&gt;

&lt;h5&gt;
  
  
  Executors
&lt;/h5&gt;

&lt;p&gt;A realization of the &lt;code&gt;Executor&lt;/code&gt; interface is used to execute specific behaviour when a &lt;code&gt;Command&lt;/code&gt; has been published.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExampleExecutor&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;UndoableExecutor&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ExampleCommand&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ExampleCommand&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;unexecute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ExampleCommand&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Goodbye, World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="nd"&gt;@Override&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;reexecute&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ExampleCommand&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello again, World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Subscribing to a Command
&lt;/h5&gt;

&lt;p&gt;Subscribing to a &lt;code&gt;Command&lt;/code&gt; requires you to specify an &lt;code&gt;Executor&lt;/code&gt; and the &lt;code&gt;Command&lt;/code&gt; that it will execute. An &lt;code&gt;Executor&lt;/code&gt; will execute the type of &lt;code&gt;Command&lt;/code&gt; it is subscribed to, or any sub-class of that &lt;code&gt;Command&lt;/code&gt;. As a result of this, only one &lt;code&gt;Executor&lt;/code&gt; of this type or sub-type of &lt;code&gt;Command&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;CommandDelegator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getINSTANCE&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;subscribe&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ExampleExecutor&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="nc"&gt;ExampleCommand&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Publishing (&lt;code&gt;Doing&lt;/code&gt;) a Command
&lt;/h5&gt;

&lt;p&gt;Publishing a &lt;code&gt;Command&lt;/code&gt; is as simple as passing it into the &lt;code&gt;publish()&lt;/code&gt; method. This will then call the &lt;code&gt;execute()&lt;/code&gt; method of the relevant &lt;code&gt;Executor&lt;/code&gt; class. The call to &lt;code&gt;execute()&lt;/code&gt; will be on the same thread as the call to &lt;code&gt;publish&lt;/code&gt;, this means that if you want to initiate a task to run in the background it must be published from the background.&lt;/p&gt;

&lt;p&gt;If a published &lt;code&gt;Command&lt;/code&gt; is not undoable, it will clear the current undo history. Likewise if you have undone a &lt;code&gt;Command&lt;/code&gt; and a new one is published, the redo history will be cleared.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;CommandDelegator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getINSTANCE&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;publish&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ExampleCommand&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Undo &amp;amp; Redo
&lt;/h5&gt;

&lt;p&gt;Undo &amp;amp; Redo are method calls on the &lt;code&gt;CommandDelegator&lt;/code&gt;. This operates in the same manner as the &lt;code&gt;publish()&lt;/code&gt; method, it will  call the &lt;code&gt;unexecute()&lt;/code&gt; or &lt;code&gt;reexecute()&lt;/code&gt; method of the relevant &lt;code&gt;Executor&lt;/code&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;CommandDelegator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getINSTANCE&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;undo&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="nc"&gt;CommandDelegator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getINSTANCE&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;redo&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  All done!
&lt;/h1&gt;

&lt;p&gt;Any questions or suggestions would be great, either here 💬, my Twitter, or email me at &lt;a href="mailto:jake@logdyn.com"&gt;jake@logdyn.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>beginners</category>
      <category>opensource</category>
      <category>java</category>
    </item>
  </channel>
</rss>
