Develpreneur: Become a Better Developer and Entrepreneur

Rob Broadhead
undefined
Oct 10, 2018 • 20min

Software Design - The Singleton Pattern

The last of the creation patterns we will cover is the Singleton.  This is a pattern that has a little controversy around it and may even be an anti-pattern.  It is easy to implement, but the reason for needing one can trip you up. The Singleton Pattern Defined It helps to start with the "Gang of Four" definition and then we will dig into that. "Ensure a class only has one instance, and provide a global point of access to it." This is what we use when we need one and only one instance.  An example might be the application settings or an instance that represents a real-world device (keyboard, mouse, maybe even a printer or hard drive).  When we access values on an instance, they will be the same no matter which "instance" we utilize, and any changes will impact all code that uses it.  The good and bad properties of a Singleton is that is a global instance. Applying The Pattern Global variables have been around as long as applications.  The uses are countless, and some of those are even good programming practices.  However, there are a lot of applications of global values that are due to laziness or at least sloppy coding.  I will not go into all of the pros and cons of global values here (although they are touched on in the podcast). The pattern is simple to implement.  You set the constructors all to private access and then create a "getInstance"  method.  When "getInstance" is called it either creates an instance and returns that, or it returns the current instance.  You will often see the one instance as a private property of the class, or it can even be a static property in some cases. Java, PHP, C#, etc. Java uses singletons for some of the utility functions and to hold methods that need no properties.  Of course, this can also be done with static classes and methods.  That takes away some of the need for a Singleton.  When your language does not support static methods and classes, then you may be forced to go the singleton route. A good use of this pattern is when you truly need to store values, and the object they represent will only ever have one instance in the scope of an application.  A log file or logging system may be configured this way or a similar serial processing structure.  User and session values may require a singleton.  On the other hand, you may find yourself limited if you only allow a single session or user in the application.  This works on a desktop application but is rarely going to work on a web application.  Take a look at the arguments for and against using a singleton before you dive in with this particular pattern.
undefined
Oct 8, 2018 • 24min

AWS Developer Tools - Your Entire Environment

As we move through the groups of AWS services, the developer tools group is one of the most impressive.  Amazon does an excellent job of providing you everything you need to jump right in and get into writing code.  Buckle up as we look into this broad group of services. Code Commit The options for version control go beyond Git.  However, it seems like the other choices are becoming less and less viable.  Thus, Amazon skips looking at any other option.  They have provided Code Commit as a way to give you a personal git repository that is integrated in with several of the other tools we will be looking at.  It is not much more than a robust git solution.  Nevertheless, it is maybe all you need for your version control requirements. Command Line Interface, SDK Libraries, and API The user interface of AWS services is often compelling and easy to learn.  However, the power you are given to code solutions that integrate with AWS goes far beyond a nifty UI.  The CLI (Command Line Interface), SDK and API all combine to provide you access to control AWS services from anywhere.  These tools are all pretty easy to use, and there are a vast number of tutorials and examples to get you started.  You can be a substantial user of AWS without these developer features but why settle?  Take advantage of these services and the various guides to kick your development and automation up a notch. Pipeline, Deploy, Cloud9, and CodeStar The next bunch of services for developers are your IDE, build engine, a deployment tool, and an overall management tool.  These make it easy to set up a full enterprise-grade development in the cloud in a short time.  There is a slight warning though that the pricing can be a surprise.  I highly recommend you look at the pricing calculator once your environment is built to make sure you know what you are getting into.  These developer tools are not just a nod to coders.  They are solid and nicely featured solutions.  Cloud9, in particular, was a stand-alone product that used AWS services and Amazon decided they needed to purchase it for their offerings.  Take a look as it might free you up to do all of your development in the cloud.  
undefined
Oct 5, 2018 • 23min

Content Management Tools (Free and Low-cost)

Content management systems were all the rage about a decade ago.  However, that market has settled down a lot and has only a few top contenders.  That may not matter to you or your customers.  A CMS is going to be a tool that can provide a large amount of value if it works closely to how you do.  Therefore, it is worth your time to stay up to speed with the latest offerings.  There are significant differences in how they approach managing content. Content Management Usually Means WordPress To be honest, WordPress is the winner of popular and useful CMS tools.  It leads the market in a way that it makes little sense to develop extensions and integrations with any other solution in the market.  Therefore, it may very well be the case that selecting any other option should only occur when you have made a good argument against using WordPress. That being said, there are other options available.  There are also good reasons to choose one of the other platforms for you or your customer.  The most important things to consider through your evaluation process are the administrative and content tools.  These vary in ease of adding, editing and removing material.  There are secondary requirements to consider as well.  These include the user experience and technical considerations.  However, a CMS is going to be a success or failure based on those first two requirements more often than not. The List Here are the tools we cover in this episode.  Almost all of these can be installed and ready for you to assess within an hour or less.  Take advantage of this hands-on approach to review the options.  Save yourself time and skip marketing or third-party opinions. The market share by percentages list can be found here: https://colorlib.com/wp/most-popular-content-management-systems/. Wordpress: https://wordpress.org/ Joomla: https://www.joomla.org/: This platform is PHP-based and loved by developers.  However, it is not as easy to administer as Wordpress.  There is a far more complex level of administration required and a lot of built-in extensions/plugins.  In the end, it is easier to do complex customization than Wordpress.  On the other hand, it will take a longer time to get started. Drupal: https://www.drupal.org/ This is another popular PHP solution similar to Joomla.  However, It is not as easy to install.  Consequently, I ran into snags in my testing that may have been my lack of familiarity with the tool.  On the other hand, this solution has an impressive amount of extensions and plugins Blogger: https://www.blogger.com/home: This is free, quick and easy to launch but very ad-filled.  It leaves you with little control over customization.  There are no real extensions available.  For better or worse, it is owned by Google. Typo3: http://typo3.org/: This is aimed more at a website than a blogging tool.  It is a solution well-suited for creating online documentation as well as traditional marketing focused sites.  This tool has a relatively simple and easy to understand UI. vBulletin: https://www.vbulletin.com/. This is not a free solution.  However, it has a solid history.  It also has better community tools than the other options here.
undefined
Oct 3, 2018 • 17min

Software Design - The Prototype Pattern

Our tour of the creational patterns takes us to one of the fastest ways to create a new instance.  The prototype pattern provides an option to clone an instance rather than create and then set values.  This approach has a variety of uses that can reduce coding and execution time. The Prototype Pattern Defined It helps to start with the "Gang of Four" definition and then we will dig into that. "Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype." The benefit of this pattern is that we replace the constructor with a clone method.  This approach can include parameters for the clone to limit/specify the values to clone.  On the other hand, it can do an exact clone.  Thus, we have a path to creating instances quickly at runtime based on the source instance. Applying The Pattern There is a wide range of uses for this pattern.  We have already mentioned the reduced code to instantiate and initialize an instance.  This pattern also makes transactions easy.  We can clone an object, make changes, and then eventually go back to save those changes.  Serial processes can get a boost as we can clone from a source object rather than a hard-coded initialization routine.  Therefore, the runtime values can be used to define that source instance. A typical use of this pattern is when you have a portion of class properties that remain the same across multiple instances.  Think of a family.  Each member has the same address.  You could create an instance for each member and set the address for each case.  However, the prototype pattern can be used to set the values once and then clone that base instance before setting member-specific data.  When this approach is taken, you have instances with identical values, yet each one is entirely self-contained.  This can be excellent for reducing the costs of high repetition processes like recursion. Java, PHP, C#, etc. A prototype pattern is not much more than an interface.  You define the clone method and then the classes that use the interface implement a clone method.  There are even built-in clone methods for some of the modern languages to assist.  Of course, those do a full-instance clone, and you may not want to go to that level.  Properties like creation stamps, modified dates, and identifiers (among others) would be an annoyance to clone and then have to reset them.  There could also be a danger in cloning those values as they might not get correctly set after a clone and essentially duplicate data.  This is an error I have seen caught a lot of times when attempting to save data to a database.  Primary key errors get raised and improper cloning is the culprit. This pattern is one that is worth utilizing often.  There is a lot that can be done through cloning instead of constructors that eases development effort and makes instantiation much easier at runtime.  You might even find some ways to use cloning as a mechanism for lazy loading or just-in-time initialization of values.
undefined
Oct 1, 2018 • 24min

The AWS Networking and Content Delivery Services

The AWS networking and content delivery services provide you the means to put your infrastructure in the cloud.  These offerings are focused on the networking side of things (as the name tells us) rather than the actual servers.  This is where we go to direct users to our solutions or and protect our systems from outsiders. AWS Networking In general, the Amazon services are on the Internet and open to the world.  That is why most of them start out in a "locked down" mode.  Amazon assumes we do not want to let everyone in the world access our services.  In the legacy world, we would only have a few points of access to the Internet from our network.  The bulk of our devices and resources are behind those access points.  Amazon allows us to do the same thing.  We can set up a virtual network where our resources can easily access each other, but the "outside world" is limited in ways to access that network. The concepts of a virtual network are nothing new.  If you have spent any time putting together an infrastructure, then you will see similarities in the Cloud.  This even includes direct and high-speed connections into your environment as opposed to the slower speed access via the Internet. Abstraction and Direction Outside of providing a way to define your network in the cloud, the services we look at this week allow you to direct users to services.  This goal is accomplished through layers of abstraction.  We get some benefits from taking this path.  These may not be obvious, but they are the types of features one expects from an enterprise environment. When we add a layer of abstraction, it makes our systems more secure.  We limit the number of access points and options to our systems from hackers.  A layer of abstraction can even provide a firewall to access that can be completely turned off if needed.  We are all familiar with the concept of a firewall.  Sometimes it helps to remember how we construct a structure that provides that feature. We also get to direct traffic in ways that improve performance.  The limited options for flow make it easier to catalog and evaluate how to best direct that traffic.  This can be done through some load balancing techniques.  The best part about the virtual network and services is that we can also dynamically create new resources and direct traffic to them as needed.  Think about a busy road where we can magically build another route to carry traffic during rush hour. Complex Pricing Although these services can be tested at a low cost, the pricing is not as straightforward as others in the AWS world.  The pricing calculator is always helpful, but only if you understand your needs in detail.  I would set some pricing alerts or do short-term tests to get comfortable with what these services will cost to implement.  Better safe than sorry.  
undefined
Sep 28, 2018 • 28min

Web Tracking and Visitor Recording Tools

A few years ago I stumbled across the ideas of heatmaps and recording for websites.  This is one of the most potent user experience improvement tools available.  The ability for visitor recording alone brings the task of watching a room full of users to your fingertips. Visitor Recording If you have not experienced this sort of tool, it is a game-changer.  The way visitor recording works with these tools is that you place a javascript snippet on your web page.  That is it.  The code is typically only a line or two, and it sends information back to the tool for you to see what users do.  You can see where they come from, what browser they use, and even where they move the mouse.  You can also see this in real time.  That allows you to see where users get "stuck" figuring something out or spend a lot of time with something on their screen.  You can take this data to develop incredibly accurate A/B tests or tweak your calls to action.  If you are not using these tools, then I highly recommend you try them out. The List Here are the tools we cover in this episode.  Take advantage of the free trials and memberships to get the best idea for which tool is best for you. Crazy Egg: crazyegg.com Great heatmaps and $30/month (billed annually) FullStory: Fullstory.com $199/month.  It has a huge amount of functionality.  The free option is limited to one thousand sessions/month. Lucky Orange: luckyorange.com $10/month. It has several useful features and tracks mentions.  The dashboard is excellent, and it is easy to add multiple sites to the membership. MouseFlow: https://mouseflow.com $29/month.  The free option only allows one hundred sessions/month.  However, the interface for recordings is one of the best. Hotjar: www.hotjar.com $29/month.  The free option allows two thousand pageviews per day.  They have several features included with free including user polls, surveys, and instant feedback (which provides for rating with an ability to select parts of the page). Inspectlet: https:inspectlet.com $33/month.  The free allows one thousand sessions and roughly ten thousand page views each month. SmartLook: www.smartlook.com 10 day trial.  $32/month.  The limited free option is not bad.  It allows three heat maps, up to one hundred thousand monthly visits, but only three days history of history.
undefined
Sep 26, 2018 • 19min

Software Patterns - Factory Method

We continue our exploration of the creation patterns with a look at the Factory Method.  This is a pattern where we see that instantiation is sometimes better when deferred.  We do not always know all we need to at instantiation time.  Thus, we need a pattern to address holding off on that step until we have the required information. The Factory Method Defined It helps to start with the "Gang of Four" definition and then we will dig into that. Define an interface for creating an object, but let subclasses decide which class to instantiate. The Factory method lets a class defer instantiation it uses to subclasses. This pattern allows us to roughly replace the constructor for a class with retrieving an instance of some subclass.  For example, let's consider a candy machine.  Each item would have a "GetContents" method.  In some cases that may mean a handful of nuts, a candy bar, a stick of gum, etc.  When "purchaseCandy" is called it will deliver a candy subclass and the "GetContents" method would return a different class of food depending on the type purchased. Applying The Pattern The common usage of this is a sort of circular reference.  We find this in solutions that require an instance of an object, but that instance is different depending on the situation.  Much like the other creation patterns, we see this in database connectors (getConnection will be a different class for Oracle than MySQL), controls (getParent will be different for a button than a page), and almost any other sizable hierarchy. I like the example that Wikipedia includes.  In that case, there is a maze game.  The maze creates a series of rooms based on a collection sent in.  The rooms may be magical or normal.  Thus, you want the room to be able to provide a concrete instance as opposed to the maze creating it.  You might want to use an abstract factory, but this is a simpler pattern to implement. Java, PHP, C#, etc. A Factory Method is an interface in some cases, but a subclass can work as well.  In the case of an interface you create a base called Room (for the above example).  Then you implement the Room interface in a MagicRoom and a StandardRoom class.  Both of these have a getRoom method that is required of the Room interface. The inheritance approach is very similar.  You create a Room class as the base.  The MagicRoom and StandardRoom classes inherit from Room and override the getRoom method.  This approach works best when the base object (Room) makes sense on its own while the interface approach is better when the base is always abstract.  A DatabaseConnector would be such an example.  There is no way to properly construct a DatabaseConnector without specifying a concrete class that connects to a specific database. The Factory Method pattern is very similar to the ones we have seen before.  However, it is at the method level instead of the class level patterns we have looked at before this.
undefined
Sep 24, 2018 • 18min

The Amazon Migration Services

In this episode, we look at the migration group of services.  We have already discussed a few of these and will focus on the ones that are new to us.  These services are the Migration Hub, Application Discovery,  and the Application Migration Service. We looked at the database migration service and the "snow" family of services in prior episodes.  These make it easy to move a database to the cloud or large amounts of data.  The "snow" (ball, edge, mobile) services make it easy to move data without using all your network pipe for hours, days, or weeks. Migration Hub - Your Dashboard The number of us that will need to migrate a large number of servers out to the cloud is small.  Even when this is required, it is not something we will use daily.  The exception to his assumption is a hybrid environment.  The nice thing about Amazon services is that they cover even these edge cases.  If you do happen to need to do a massive migration, then you will be happy to be able to centrally manage them.  That is what the hub provides you.  The processes in progress and those that are planned can all be viewed from one point.  You will be happy to use this over a bunch of scripts. Environmental Smarts It is always best to understand your environment.  This knowledge includes both the size of your systems and utilization of them.  The good news is that Amazon has discovery tools to help you if you are not sure of your current situation.  These allow for a migration to be created manually with the details you know or to use their tools for that information.  Who knows, it might even teach you a few things about your environment. Migrating data to the cloud is not the most common challenge in using AWS.  Let's face it, this is usually a one and done type of project.  However, these tools make the whole process easier to manage and reduces errors.  
undefined
Sep 21, 2018 • 26min

Code Review and Analysis Tools (Free and Low-Cost)

There have been a lot of excellent free and low-cost reviewed already.  However, this week we continue our "shopping" with a look at code review and analysis applications.  This used to be an area where all of the solutions were pricey.  Fortunately, SAAS options, improved automation, and well-defined best practices (with a touch of open source) have made these affordable.  Yes, even the individual developer can find affordable options. Keep It Cheap There are a lot of great tools available in this area that also have a high price tag.  We will skip those this time as we want to focus on options for small teams down to individuals.  I have found these useful even in little applications like the one created in Season 2.  A project like that is not going to be worth a $10,000 tool.  However, a free one does fit the budget.  The ROI is incredible in that case as well. The List Although the tools we cover is in the single digits, there are a lot of others you might want to review in deciding on the one for you.  A good starting list can be found at this link: https://www.softwaretestinghelp.com/code-review-tools/.  I would take a look at those results just to see what kind of options are out there. Here are the tools discussed and a brief note on each. Codacy: https://www.codacy.com/product free and free for small teams, easy to grow with your team Sider: https://sider.review/features $12/month per seat GitHub only Has a good number of languages supported and works well with GitHub process Crucible: https://www.atlassian.com/software/crucible $10 one time, on-prem only Gerrit: https://www.gerritcodereview.com/ Web-based code review system with useful tools for comparisons and notes UpSource: https://www.jetbrains.com/upsource This is a code review tool from the team at JetBrains. If you want code analysis tools, then check out PMD (or PHPMD),  RIPS, and FindBugs.  You can also Google "Static Code Analysis Tools" for some good options and add your favorite coding language for more specific results.
undefined
Sep 19, 2018 • 21min

Software Patterns - The Builder

In this episode, we look at the Builder pattern.  This one is another creational pattern that helps us construct the class instances for our application.  It is another pattern that could be skipped through brute-force and a wide range of constructors, but I think you will see this is a much better approach. The Builder Defined It helps to start with the "Gang of Four" definition and then we will dig into that. Separate the construction of a complex object from its representation so that the same construction process can create different representations. This is a pattern that I think we can all easily buy into.  When you have a class that is more than a few values, and it has actual pieces that it is comprised of then the constructor becomes a challenge.  You will either end up with a confusing bunch of constructors or a lot of frustrating side effects.  It is important to note that a Builder is an interface and there will be concrete builders under the covers.  You can see a lot of real-world examples in tools like parsers, readers, and writers. Applying The Pattern The Builder is often a sort of meta-class that has internal classes as part of its functionality.  This usually occurs in an application when there is a process to execute that has various implementations.  The parser mentioned above is an excellent example.  You will have some steps along the lines of the list below. Start a block (line or lines) Find end of block Tokenize or Process tags Find subsections List blocks (or iterator of blocks) Move to next block In our example, think about whether you are parsing a file that is CSV, XML, or fixed-width.  The way you parse each of these is very different with the blocks being defined by an end of line character, XML close tags, or a count of characters.  Then, within each block, the way you parse the data is very different.  If you are building a document reader class, then you probably do not want to load it up with all of the methods required for this.  The Builder allows you to group those methods based on the type of file to be processed. Java, PHP, C#, etc. A Builder is an interface.  That makes it easy to implement in any of these languages. You may want to create a base class for your concrete builders as well that has the order of the steps to be processed.  I have seen this handled a couple of different ways so your goals should drive your approach.  The example we looked at is one that is best approached with the most complex solution used as a guideline for the core interface.  Then you can have a success value returned for the steps that are not needed. As a creation pattern, the Builder is very similar to the others in this group.  That can prompt the question of when to use which.  There is no hard and fast rule for which to use when.  However, you will often find that you start with a factory for simpler classes and move towards builders for the more complex ones.  

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app