Skip to main content

FizzBuzz - part 3

 Team Lead 

In part 2, I looked at the additional items you would look for in a FizzBuzz discussion for a lead developer.  Without getting too much into what job title means what, the next level up is a team lead.

The road not yet discussed

My discussion here isn't meant to be exhaustive, there are additional areas an interview can and should go; however, this one is really the last one that I think could possibly have source code up on a white board.  After this, I really think you should start using boxes and arrows.

RTFM - Read the F*#cking Manual won't cut it

When I started my career, you really could get by with your K&R C manual and the various man pages.  That really ended in my SunOS world (we hadn't converted to Solaris yet) when we started developing in X-Windows R4/Motif.  You really could not actually do your work without an O'Reilly set of books or the equivalent.

Today, being able to not only code using a library or framework, but also direct those under you in the use of a framework is a essential skill for a team lean.

FizzBuzz on Apache Camel and Spring Boot

I've been using the very popular Spring Boot framework so far, but I've been commenting out it's true power.  In this post I will be adding Apache Camel, an integration library that allows for abstracting processing into items called "routes" with input and output being handled by "components" with named endpoints. The code is deceptively simple:

@Component
public class MySpringBootRouter extends RouteBuilder {
    @Autowired
    FizzBuzz fb;

    @Override
    public void configure() {
   
    restConfiguration().component("netty-http")
           .host("0.0.0.0").port(8888)
           .bindingMode(RestBindingMode.json);
            
        rest("/camel").get("/hello/{i}").to("direct:fizzbuzz");
        
        from("direct:fizzbuzz").bean(fb, "process(${header.i})");
        
        // Needed for auto generated unit test only
        from("timer:hello?period={{timer.period}}").routeId("hello")
        .transform().method("myBean", "saySomething")
        .filter(simple("${body} contains 'foo'"))
            .to("log:foo")
        .end()
        .to("stream:out");
    }
}

and it's test:

@SpringBootTest
@CamelSpringBootTest
class MySpringRouterTest  {

@Autowired
    protected CamelContext camelContext;
@Autowired
private ProducerTemplate producerTemplate;

@Test
void test() throws Exception {
// invoking consumer
producerTemplate.sendBodyAndHeader("direct:fizzbuzz",
                                  null, "i", "15");
Object o = producerTemplate.requestBodyAndHeader(
                                    "direct:fizzbuzz", 
                                    null, "i", "15");
assertEquals("FizzBuzz", o);
o = producerTemplate.requestBodyAndHeader(
                                 "direct:fizzbuzz", null, "i", "1");
assertEquals("1", o);
o = producerTemplate.requestBodyAndHeader(
                                 "direct:fizzbuzz", null, "i", "3");
assertEquals("Fizz", o);
}
}

Why a framework like Camel?

Assuming they provided something like the fragments colored above, I would expect that a candidate would be able to discuss why they would use Camel:
  • The ability to name a route like "direct:fizzbuzz", allows testing of the FizzBuzz business logic without having to test the input or the output.
  • We added a REST endpoint into the FizzBuzz logic, but we wouldn't have to.  We could use many of the Camel components like:
    • "file" -  this could allow a set of test input files for complicated inputs to be kept by those testing the code (developers in a DevOps environment, or a dedicated QA group).
    • "kafka" - this could allow for queueing, asynchronous or a multitude of other use cases.
    • Custom components - I've developed a component to be used with TIBCO Rv, because the steps to develop your own component are well documented.
  • We get manageability.  
    • Spring Boot  comes with the /actuator 
    • Apache Camel allows you to specify thread pools, metrics and other items on a per-route basis.

Why not a framework like Camel?

A developer at this level should also be able to discuss why you might not want to have a framework:
  • Team doesn't know it.
  • Problem is too small to have a ROI for using a framework.
  • Other components around FizzBuzz will be doing the platform level functionality.

Next

The next item I'm going to discuss is deployment.  Again, the order isn't important.  What is important is that the person being interviewed can cogently discuss things like this and that they can communicate what they have done in the past, and now with the wisdom of hindsight, done differently.

Comments

Popular posts from this blog

Spring Boot native builds when internet downloads are blocked made simple

 No direct access to the internet If you work at a company that controls their software bill of materials, it's quite common to be blocked from directly downloading from: Maven Central Docker hub GitHub (the public parts) Getting the bits Maven Maven is first, because without it, you won't be able to compile your Spring Boot application, let alone move on to turning it into a native docker image. I will be showing changes need to work with artifactory, but you should be able to adapt it to other mirror solutions.  repositories {   maven {     name = "central"     url = "https://artifactory.example.com/central"     credentials {       username = "${project.ext.properties.artifactory_username}"       password = "${project.ext.properties.artifactory_apikey}"     }   } } With this configuration change, you should be able to download your plugins and dependencies, allowing you to compile and ...

Kotlin Notebook when you're blocked from Maven Central

 TLDR; If you are blocked getting to maven central when first using Kotlin Notebooks because of company firewalls, you can use a tool like Fiddler Tool to redirect to a different network location. Kotlin Notebooks Kotlin Notebooks are a JDK based environment that brings the Python based Jupyter Notebooks  expressiveness to IntelliJ. From the blog post announcing the plugin, it looks like this: At home, the installation of jar files looked like this: I played around with it at home, but I couldn't use it at work.  Many companies, mine included, do not allow software components to be used when downloaded directly from the internet. In my companies case, we use a product called Artifactory, which allows you to mirror the content from Maven Central while still applying policies like CVE scanning, tracking, etc. The way it should work IntelliJ, as one of the leading IDE's, generally supports this quite well.  In fact, there is a whole setting page dedicated to dealing wi...

Active vs. Passive Log4jShell remediation

 Log4jShell  All computer professionals should be aware of the Log4jShell ( CVE-2021-44228 ) and it follow on defects.  There is no shortage of opinions and lessons to be be learned: The difficulty of performing safe interpretation The problems when assumptions are not clearly documented.  I, for one, was completely shocked to find out that a logging system would actually attempt to do variable substitution in an actual message. The difficulty of finding and resolving issues with such a common library that is not provided by an OS package manager. IT'S A LOG4J CHRISTMAS One of my favorite podcasts, Security Now - episode 850 , discussed an analysis by Google regarding the depth of log4j dependencies.  From the show notes : One contributing reason is because Log4j is, more often than not, an indirect dependency. Java libraries are built by writing some code which uses functions from other Java libraries, which are built by writing some code which uses functions f...