Coding Blocks

We dig into Google’s engineering practices documentation as we learn how to code review while Michael, er, Fives is done with proper nouns, Allen can’t get his pull request approved, and Joe prefers to take the average of his code reviews.

In case you’re reading this via your podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode132. Be sure to check it out and join the conversation.

Sponsors

Survey Says

Do you *always* include (new or updated) unit tests with your pull requests?

Take the survey at: https://www.codingblocks.net/episode132.

News

  • Thank you to everyone that left us a review:
    • iTunes: Jbarger, Podcast Devourer, Duracce
    • Stitcher: Daemyon C

How to Code Review

Code Review Developer Guide

Q: What is a code review?

A: When someone other than the author of the code examines that code.

Q: But why code review?

A: To ensure high quality standards for code as well as helping ensure more maintainable code.

What should code reviewers look for?

  • Design: Is the code well-designed and appropriate for your system?
  • Functionality: Does the code behave as the author likely intended? Is the way the code behaves good for its users?
  • Complexity: Could the code be made simpler? Would another developer be able to easily understand and use this code when they come across it in the future?
  • Tests: Does the code have correct and well-designed automated tests?
  • Naming: Did the developer choose clear names for variables, classes, methods, etc.?
  • Comments: Are the comments clear and useful?
  • Style: Does the code follow our style guides?
  • Documentation: Did the developer also update relevant documentation?

Picking the Best Reviewers

  • Get the best reviewer you can, someone who can review your code within the appropriate time frame.
    • The best reviewer is the one who can give you the most thorough review.
      • This might or might not be people in the OWNERS file.
      • Different people might need to review different portions of your changes for the same pull request.
    • If the “best” person isn’t available, they should still be CC’d on the change list.

In Person Reviews

  • If you pair-programmed with someone who was the right person for a code review, then the code is considered reviewed.
  • You can also do code reviews where the reviewer asks questions and the coder only speaks when responding to the questions.

How to do a Code Review

The Standard of a Code Review

The purpose of the code review is to make sure code quality is improving over time.

  • There are trade-offs:
    • Developers need to actually be able to complete some tasks.
    • If reviewers are a pain to work with, for example they are overly critical, then folks will be less incentivized to make good improvements or ask for good reviews in the future.
  • It is still the duty of the reviewer to make sure the code is good quality. You don’t want the health of the product or code base to degrade over time.
  • The reviewer has ownership and responsibility over the code they’re reviewing.

Reviewers should favor approving the changes when the code health is improved even if the changes aren’t perfect. There’s no such thing as perfect code, just better code.

  • Reviewers can actually reject a set of changes even if it’s quality code if they feel it doesn’t belong in “their” system.
  • Reviewers should not seek perfection but they should seek constant improvement.
    • This doesn’t mean that reviewers must stay silent. They can point out things in a comment using a prefix such as “Nit”, indicating something that could be better but doesn’t block the overall change request.

Code that worsens the overall quality or health of a system should not be admitted unless it’s under extreme/emergency circumstances.

What constitutes an emergency?

A small change that:

  • Allows a major launch to continue,
  • Fixes a significant production bug impacting users,
  • Addresses a legal issue, or
  • Patches a security hole.
What does not constitute an emergency?
  • You want the change in sooner rather than later.
  • You’ve worked hard on the feature for a long time.
  • The reviewers are away or in another timezone.
  • Because it’s Friday and you want the code merged in before the weekend.
  • A manager says that it has to be merged in today because of a soft deadline.
  • Rolling back causes test failures or breaks the build.
Mentoring

Code reviews can absolutely be used as a tool for mentoring, for example teaching design patterns, explaining algorithms, etc., but if it’s not something that needs to be changed for the PR to be completed, note it as a “Nit” or “Note”.

Principles
  • Technical facts and data overrule opinions and/or preferences.
  • The style guide is the authority. If it’s not in the style guide, it should be based on previous coding style already in the code, otherwise it’s personal preference.
  • The reviewer may request the code follow existing patterns in the code base if there isn’t a style guide.
Resolving Conflicts
  • If there are conflicts between the coder and reviewer, they should first attempt to come to a consensus based on the information discussed here as well as what’s in the CL Author’s Guide or the Reviewer Guide.
  • If the conflict remains, it’s probably worth having a face to face to discuss the issues and then make sure notes are taken to put on the code review for future reference and readers.
  • If the conflict still remains, then it’s time to escalate to a team discussion, potentially having a team leader weigh in on the decision.

NEVER let a change sit around just because the reviewer and coder can’t come to an agreement.

Resources We Like

  • Google Engineering Practices Documentation (GitHub)
  • Code Review Developer Guide (GitHub)
  • How to do a code review (GitHub)
  • The Standard of Code Review (GitHub)
  • Emergencies (GitHub)
  • The CL author’s guide to getting through code review (GitHub)
  • Technical Writing Courses (developers.google.com)
  • Ruffles Potato Chips, Cheddar and Sour Cream (Amazon)
Flawless Execution

Tip of the Week

  • William Lin’s competitive programming channel (YouTube)
  • Register for the free Microsoft Build digital event, May 19-20. (register.build.microsoft.com)
  • Apple to host virtual Worldwide Developers Conference beginning June 22 (Apple)
  • Checkstyle helps Java developers adhere to a coding standard. (checkstyle.sourceforge.io)
    • CheckStyle-IDEA – An IDEA plugin that uses Checkstyle but isn’t officially part of it. (plugins.jetbrains.com)
  • Black – The uncompromising code formatter for Python. (pypi.org)
Direct download: coding-blocks-episode-132.mp3
Category:Software Development -- posted at: 9:52pm EDT

We gather around the water cooler at 6 foot distances as Michael and Joe aren’t sure what they streamed, we finally learn who has the best fries, at least in the US, and Allen doesn’t understand evenly distributing your condiments.

For those reading this via their podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode131. Stop by and join in on the conversation.

Survey Says

Are you staying sane during these stay-at-home orders?

Take the survey at: https://www.codingblocks.net/episode131.

News

  • We really appreciate the latest reviews, so thank you!
    • iTunes: Braver1996summer, eleneshector, Dis14Joe
    • Stitcher: Nik P, Anonymous, Please HelP, Dis14Joe, thephdwasamistake
  • Be on the lookout for live streams of Joe on YouTube or Twitch!

Heard Around the Water Cooler

  • COVID-19 Pushes Up Internet Use 70% And Streaming More Than 12%, First Figures Reveal (Forbes)
  • Security at Zoom (Zoom)
  • Joe has been busy live streaming (YouTube)
    • Come learn Apache Drill with us! (YouTube)
  • Cmder – Portable console emulator for Windows.
    • We’re still learning the keyboard shortcuts.
  • 30-Day LeetCoding Challenge (LeetCode.com)
  • Coding Interview Tips, How to get better at technical interviews without practicing (InterviewCake.com)
True descriptions of languages True descriptions of languages (Reddit)

Tip of the Week

  • Interested in COBOL, game development, and Dvorak keyboards? Check out Joe’s new favorite streamer Zorchenhimer. (Twitch)
  • Using helm uninstall doesn’t remove persistent volumes nor their claims.
    • After doing helm uninstall RELEASE_NAME, delete the persistent volume claim using kubectl delete pvc PVC_NAME to remove the claim, which depending on the storage class and reclaim policy, will also remove the persistent volume. Otherwise, you’d need to manually remove the persistent volume using kubectl delete pv PV-NAME.
  • kafkacat – A generic non-JVM producer and consumer for Apache Kafka. (GitHub)
Direct download: coding-blocks-episode-131.mp3
Category:Software Development -- posted at: 8:35pm EDT

We dig into the details of how databases use B-trees as we continue our discussion of Designing Data-Intensive Applications while Michael’s description of median is awful, live streaming isn’t for Allen, and Joe really wants to bring us back from the break.

For those reading this via their podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode130 in all their glory. Check it out, as Joe would say, and join the conversation.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after install the agent.

Survey Says

What tools are you using to ease WFH?

Take the survey at: https://www.codingblocks.net/episode130.

News

  • We really appreciate the latest reviews, so thank you!
    • iTunes: Anips79, Jacobboyd23, LoadedGalaxy, JenT Avid Listener
  • Pluralsight is free for the month of April! (Pluralsight)
  • TechSmith is offering Snagit and Video Review for free through June 2020. (TechSmith)
  • Remember when we gushed over Zoom?
    • Zoom: Every security issue uncovered in the video chat app (CNET)
    • Zoom Go Boom (TWiT)
  • Maybe should use Jitsi instead of Zoom. (Jitsi)
  • Be on the lookout for live streams of Joe on YouTube or Twitch!

B-Trees are Awesome

  • B-trees are the most commonly used indexing structure.
  • Introduced in 1970, and called ubiquitous 10 years later.
  • They are the implementation used by most relational database systems, as well as a number of non-relational DB’s.
  • “Indexing” is the way databases store metadata about your data to make quick look ups.
  • Like the SSTable, the B-tree stores key/value pairs sorted by key. This makes range query look ups quick.
  • B-trees use fixed block sizes, referred to as pages, that are usually 4 KB in size which (generally) map well to the underlying hardware because disks are typically arranged in fixed block sizes.
  • Every page has an address that can be referenced from other pages. These are pointers to positions on a disk.
  • Knowing (or being able to quickly find) which page the data you are looking for is in, drastically cuts down on the amount of data you have to scan through.
  • B-trees start with a root page. All key searches start here.
    • This root will contain references to child pages based off of key ranges.
    • The child pages might contain more references to other child pages based off of more narrowly focused key ranges.
    • This continues until you reach the page that has the data for the key you searched for.
      • These pages are called leaf pages, where the values live along with the key.
  • The branching factor is the number of references to child pages in one page of a B-tree.
    • The branching factor is tied to the space needed to store the page references and the range boundaries.
      • The book states that it’s common to have a branching factor of several hundred, some even say low thousands!
    • The higher the branching factor means the fewer levels you have to go through, i.e. less pages you have to scan, when looking for your data.
  • Updating a value in a B-tree can be complicated.
    • You search for the leaf node containing the key and then update the value and write it to disk.
      • Assuming everything fits in the page, then none of the upstream references change and everything is still valid.
    • If you are inserting a new key, you find the leaf node where the key should live based on the ranges and then you add the key and value there.
      • Again, if everything fits in the page, then similar to the update, none of the upstream references need to change.
      • However, if the key/value would exceed the size of the page, the page is split into two half-pages, and the parent page’s references are updated to point to the new pages.
        • This update to the parent page might require it to also be split.
        • And this update/split pattern might continue up to and including the root page.
  • By splitting the pages into halves as data is added that exceeds the page size, this keeps the tree balanced.
  • A balanced tree is the secret to consistent lookup times.
  • It terms of big-O, a B-tree with n keys has a depth of O(log n).
  • Most DB’s only go 3 to 4 levels deep.
    • A tree with four levels, using a 4 KB page size, and a branching factor of 500 can store up to 256 TB!

Making B-Trees Reliable

  • The main notion is that writes in a B-tree occur in the same location as the original page, that way no references have to change, assuming the page size isn’t exceeded.
    • Think of this as a hardware operation.
      • These actually map to spinning drives better than SSD’s. SSD’s must rewrite large blocks of a storage chip at a time.
  • Because some operations require multiple pages to be written, in the case of splitting full pages and updating the parent, it can be dangerous because if there is a DB crash at any point during the writing of the pages, you can end up with orphaned pages.
    • To combat this, implementations usually include a write-ahead log (WAL, aka a redo log).
      • This is an append-only file where all modifications go before the tree is updated.
      • If the database crashes, this file is read first and used to put the DB back in a good, consistent state.
  • Another issue is that of concurrency.
    • Multiple threads reading and writing to the B-tree at the same time could read things that would be in an inconsistent state.
      • In order to counter this problem, latches, or lightweight locks, are typically used.

B-Tree Optimizations

  • Some databases use a copy-on-write scheme. This alleviates the need to write to an append only log like previously mentioned and instead you write each updated page to a new location including updated parents that point to it.
  • In some cases, abbreviated keys can be stored which saves space and would allow for more branching but fewer node levels, which is fewer hops to get to the leaf nodes.
    • This is technically a B+ tree.
  • Some implementations attempt to keep leaf pages next to each other in sequential order which would improve the seek speed to the data.
  • Some implementations keep additional pointers, such as references to the previous and next sibling pages so it’s quicker to scan without having to go back to the parent to find the pointer to those same nodes.
  • Variants like fractal trees, use tactics from log-structured ideas to reduce disk seeks.

Comparing B-Trees and LSM-Trees

  • B-trees are much more common and mature. We’ve ironed out the kinks and we understand the ways people use RDBMSes.
  • LSM-trees are typically faster for writes.
  • B-trees are typically faster for reads because LSM-trees have to check multiple data-structures, including SSTables that might be at different levels of compaction.
  • Use cases vary, so benchmarking your use cases are important.

LSM-Tree Advantages

  • The write amplification problem:
    • B-trees must write all data at least twice, once to the WAL and another to the page (and again if pages are split). Some storage engines go even further for redundancy.
    • LSM-trees also rewrite data, due to compaction and tree/SSTable merging.
      • This is particularly a problem for SSDs, which don’t do so well with repeated writes to the same segment.
    • LSM-trees typically have better sustained write throughput because they have lower write amplification and because of they generally sequentially write the SSTable files, which is particularly important on HDDs.
  • LSM-trees can be compressed better, and involve less space on disk.
  • LSM-trees also have lower fragmentation on writes.

LSM-Tree Downsides

  • Compaction of the SSTables can affect performance, even though the compaction can happen in another thread, because takes up disk I/O resources, i.e. the disk has a finite amount of I/O bandwidth.
  • It’s possible that the compaction can not be keep up with incoming events, causing you to run out of disk space, which also slows down reads as more SSTable files need to be read.
    • This problem is magnified in a LSM-tree because a key can exist multiple times (before compaction) unlike B-trees which have just one location for a given key.
  • The B-tree method for updating also makes it easier for B-trees to guarantee transactional isolation.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Data Structures – (some) Trees (episode 97)
  • B-Tree Visualization (USFCA)
  • SQL Server Transaction Log Architecture and Management Guide (docs.microsoft.com)
  • Log-structured merge-tree (Wikipedia)
  • Postgres Indexes Under the Hood (rcoh.me)
  • Is Docker the new Git? (Coding Blocks)

Tip of the Week

  • Chocolatey adds a PowerShell command Update-SessionEnvironment or refreshenv for short, that you can use to update the environment variables in your current PowerShell session, much like . $HOME/.profile for MacOS/Linux. (Chocolatey)
  • Use docker stats to monitor the usage of your running Docker containers. It’s like top for Docker. (Docker)
  • Click the Equivalent REST or command line link at the bottom of the Google Cloud Console to get the equivalent as a command you can script and iterate on.
  • Jupyter has a Docker image for you: Jupyter Docker Stats. (jupter-docker-stacks.readthedocs.io)
  • Apache Drill is an amazing schema-free SQL query engine for Hadoop, NoSQL, and Cloud Storage. (drill.apache.org)
  • Presto, aka Presto DB, not to be confused with Presto SQL, is distributed SQL query engine for big data originally developed by Facebook. (prestodb.io)
Direct download: coding-blocks-episode-130.mp3
Category:Software Development -- posted at: 9:04pm EDT

Since we can’t leave the house, we discuss what it takes to effectively work remote while Allen’s frail body requires an ergonomic keyboard, Joe finally takes a passionate stance, and Michael tells them why they’re wrong.

Reading these show notes via your podcast player? You can find this episode’s full show notes at https://www.codingblocks.net/episode129 and be a part of the conversation.

Sponsors

Survey Says

What's your preferred method to increase your productivity?

Take the survey at: https://www.codingblocks.net/episode129.

News

  • Thank you, krauseling, for the latest iTunes review.
  • TechSmith is offering Snagit and Video Review for free through June 2020. (TechSmith)

How to WFH

The Essentials

  • First and foremost, get a quality internet connection.
    • For video calls, favor lower latency over higher bandwidth.
  • Turn your camera on.
  • Use a comfortable headset with a good microphone
    • Wired headphones are definitely the way to go. Better audio quality, fewer problems, and no battery life issues to worry about.
  • Mute unless talking.
  • Not all video sharing is equal. Know which to use when screen sharing.
    • Screen sharing in Zoom is much better than in Hangouts. The text on the screen is crisp and readable and the screen sharing session is responsive.
  • Communicate when you will be away during normal hours.
  • Make sure your IM application status and/or availability is accurate.

Sound Good

Price Description  
$30 Sony MDRXB50AP Extra Bass Earbuds Headset with mic (Amazon)
$149 SteelSeries Arctis 7 Gaming Headphones (Amazon)
$18 Apple EarPods with 3.5mm Headphone Plug (Amazon)
Avoid these headphones
  Description Price
Sennheiser SC 130 USB Single Sided Headset (Amazon) NA
Sennheiser SC 160 USB Double-Sided Headset (Amazon) $65

Look Good, too

Price Description  
NA Logitech c930e WebCam (Amazon)

Digging Deeper

  • Don’t be afraid to spend time on calls just chatting about non work related stuff.
    • Working from home means there’s little opportunity to connect personally and that is sorely needed when working from home. Taking time to chat will help to keep the team connected.
    • Keep it light and have fun!
  • Be available and over communicate.
    • During business hours make sure you’re available. That doesn’t mean you need to be in front of your computer constantly, but it does mean to make sure you can be reached via phone, email, or chat and can participate when needed.
    • Working from home also means it is super important to communicate status and make sure people feel like progress is being made.
    • Also, if you need to be offline for any reason, send up a flare, don’t just disappear.
    • Make sure your chat application status is really your status. People will rely on you showing “Active” meaning that you are available. Don’t game your status. Take a break if you need to but if you aren’t available, don’t show available. Also, if you don’t show “Active” many will assume that you aren’t available or online.
    • We’ve also found that sometimes it is good to show “offline” or “unavailable” to give us a chance to get into a flow and get things done, so don’t be afraid to do that. Having this be a “known agreement” will signal to others that they may just want to send you an e-mail or schedule a conference later.
    • If something is urgent in email, make sure to send the subject with a prefix of “URGENT:”
      • But beware the an “urgent” email doesn’t mean you’ll get an instant reply. If you need an answer right now, consider a phone call.
      • An “urgent” email should be treated as “as soon as you read this”, knowing that it might not be read for a while.
    • Make sure your calendar is up to date. If you are busy or out of the office (OOO) then make sure you schedule that in your calendar so that people will know when they can meet with you.
    • Along with the above, when scheduling meetings, check the availability of your attendees.
  • Be flexible.
    • This goes with things mentioned above. As a manager especially, you need to be flexible and recognize that working from home sometimes means people need to be away for periods of time for personal reasons. Don’t sweat that unless these people aren’t delivering per the next point.
    • Favor shorter milestones or deliverables and an iterative approach.
      • This helps keep people focused and results oriented. Science projects are easy to squash if you define short milestones that provide quick wins on the way to a longer term goal.
        • We use the term “fail fast” a lot where we break projects into smaller bits and try to attack what’s scariest first in an effort to “fail fast” and change course.
      • We use JIRA and work in 2 week sprints.
        • Define work in small enough increments. If something exceeds two weeks, it means it needs to be reviewed and refined into smaller work streams. Spend the time to think through it.
    • Require estimates on work items to help keep thing on track.
  • Allow and encourage people to work in groups or teams if appropriate, for things like:
    • Brainstorming sessions.
    • Mini-scrums that are feature or project based.
    • Pair programming. Use of the proper video application for screen sharing is important here.
  • Conference etiquette:
    • Mute. If you’re not talking, mute.
      • Lots of participants? Mute.
      • Smaller/Team meeting? Up to you. But probably best to mute.
    • Use a microphone and verify people hear you okay. Don’t forgo a real headset or microphone and instead try to use your internal laptop microphone and speakers. You will either be super loud with background noise, for example people just hear you typing the whole time or hear your fan running, or people won’t hear you at all.
    • When you start presenting, it is a good practice to ask “can you see my screen?”
    • Give others opportunities to talk and if someone hasn’t said anything, mention it and ask for their feedback especially if you think their opinion is important on the subject at hand.
  • Use a tool to help you focus.
    • It is easy to get distracted by any number of things.
    • A technique that works well for some is the Pomodoro Technique. There’s also nifty applications and timers that you can use to reinforce it.
  • Music may not be the answer.
    • For some people just putting on noise-cancelling headphones helps with external noise (kids, TV, etc.)
  • Choose the right desktop sharing tool when needed.
    • We’ve found that Hangouts is a great tool to meet quickly and while it does provide for screen sharing, the video quality isn’t great. It does not allow people who are viewing your screen to zoom in and if you have a very high resolution monitor, people may find it hard to read/see it.
    • While Webex is a little more challenging to use, it does provide the ability for others to zoom in when you share, and the shared screens are more clear than Hangouts.
    • Additionally, Webex allows you to view all participants in one gallery view, thus reinforcing team cohesion.
    • That said though, we’ve found Zoom to be far superior to it’s competitors.
  • Develop a routine.
    • Get up and start working at roughly the same time if you can.
    • Shower and dress as if you’re going out for errands at least.
    • If possible, have a dedicated workspace.
    • Most importantly, make sure you stop work at some point and just be home. If at all possible, coupled with the dedicated workspace tip, if you can have a physical barrier, such as a door, use it, i.e close the door and “be home” and not “at work”.
    • It’s hard not to overeat at first, but try to avoid the pantry that is probably really close to your workspace.
    • Try to get out of the house for exercise or errands in the middle of day to break things up.
    • Working from home is much more sedentary than working in an office. Make it a point to get up from your desk and walk around, check the mail, do whatever you can to stretch your legs.

Resources We Like

Tip of the Week

Direct download: coding-blocks-episode-129.mp3
Category:Software Development -- posted at: 9:58pm EDT

It’s time to learn about SSTables and LSM-Trees as Joe feels pretty zacked, Michael clarifies what he was looking forward to, and Allen has opinions about Dr Who.

These show notes can be found at https://www.codingblocks.net/episode128 where you be a part of the conversation, in case you’re reading this via your podcast player.

Sponsors

Survey Says

Do you leave your laptop plugged in the majority of the time?

Take the survey at: https://www.codingblocks.net/episode128.

News

  • Thank you for all of the great reviews:
    • iTunes: devextremis, CaffinatedGamer, Matt Hussey, index out of range
    • Stitcher: Marcos Sagrado, MoarLiekCodingRokzAmirite, Asparges69
  • Sadly, due to COVID-19 (aka Coronavirus), the 15th Annual Orlando Code Camp & Tech Conference has been cancelled. We’ll keep you informed of your next opportunity to kick us in the shins. (orlandocodecamp.com)
    • During this unprecedented time, TechSmith is offering Snagit and Video Review for free through June 2020. (TechSmith)

SSTables and LSM-Trees

SSTables

  • SSTable is short for “Sorted String Table”.
  • SSTable requires that the writes be sorted by key.
    • This means we cannot append the new key/value pairs to the segment immediately because we need to make sure the data is sorted by key first.

What are the benefits of the SSTable over the hash indexed log segments?

  • Merging the segments is much faster, and simpler. It’s basically a mergesort against the segment files being merged. Look at the first key in each file, and take the lowest key (according to the sort order), add it to the new segment file … rinse-n-repeat.
    • When the same key shows in multiple segment files, keep the newer segment’s key/value pair, sticking with the notion that the last written key/value for any given key is the most up to date value.
  • To find keys, you no longer need to keep the entire hash of indexes in memory. Instead, you can use a sparse index where you store a key in memory for every few kilobytes from a segment file
    • This saves on memory.
    • This also allows for quick scans as well.
      • For example, when you search for a key, Michael and the key isn’t in the index, you can find two keys in the sparse index that Michael falls between, such as Micah and Mick, then start at the Micah offset and scan that portion of the segment until you find the Michael key.
  • Another improvement for speeding up read scans is to write chunks of data to disk in compressed blocks. Then, the keys in the sparse index point to the beginning of that compressed block.

So how do you write this to disk in the proper order?

  • If you just write them to disk as you get them, they’ll be out of order in an append only manner because you’re likely going to receive them out of order.
  • One method is to actually write them to disk in a sorted structure. B-Tree is one option. However, maintaining a sorted structure in memory is actually easier than trying to maintain it on disk though, due to well known tree data structures like red-black trees and AVL trees.
    • The keys are sorted as they’re inserted due to the way nodes are shuffled during inserts.
    • This allows you to write the data to memory in any order and retrieve it sorted.
  • When data arrives, write it to the memory balanced tree data structure, such as a red-black tree. This is also referred to as a memtable.
  • Once you’ve reached a predefined size threshold, you dump the data from memory to disk in a new SSTable file.
  • While the new segment is being written to disk, any incoming key/value pairs get written to a new memtable.
  • When serving up read requests, you search in your memtable first, then back to the most recent segment, and so on moving backwards until you find the key you’re looking for.
  • Occasionally run a merge on the segments to get rid of overwritten or deleted items.

Downside of this method?

  • If the database crashes for some reason, the data in the memtable is lost.
  • To avoid this, you can use an append-only, unsorted log for each new record that comes in. If the database crashes, that log file can be used to recreate the memtable.

LSM-Trees

This implementation is the ground work for:

  • LevelDB (GitHub) and RocksDB (GitHub),
  • Databases intended to be embedded in other applications,
    • RocksDB is embedded in Kafka Streams and is used for GlobalKTables.
  • Similar storage engines are used by Cassandra and HBase.
    • Both took some design queues from Google’s BigTable whitepaper, which introduced the terms SSTable and memtable.

All of this was initially described under the name Log-Structured Merge TreeLSM-Tree.

  • Storage engines that are based on the notion of storing compacted and sorted files are often called LSM storage engines.
    • Lucene, the indexing engine used in Solr and ElasticSearch, uses a very similar process.

Optimizing

  • One of the problems with the LSM-Tree model is that searching for keys that don’t exist can be expensive.
    • Must search the memtable first, then latest segment, then the next oldest segment, etc., all the way back through all the segments.
    • One solution for this particular problem is a Bloom filter.
      • A Bloom filter is a data structure used for approximating what is in a set of data. It can tell you if the key does not exist, saving a lot of I/O looking for the key.
  • There are competing strategies for determining when and how to perform the merge and compaction operations. The most common approaches include:
    • Leveled compaction – Key ranges are split into smaller SSTables and old data is moved to different “levels” allowing the compacting process to use less disk and done incrementally. This is the strategy used by LevelDB and RocksDB.
    • Size-tiered compaction – Smaller and newer SSTables are merged into larger and older SSTables. This is the strategy used by HBase.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Red-black trees in 5 minutes – Insertions (examples) (YouTube)
  • Data Structures – (some) Trees (episode 97)
  • B-Tree Visualization (USFCA)
  • Red Black Tree vs AVL Tree (GeeksforGeeks)
  • How to: Use Bloom Filters in Redis (YouTube)
  • A Busy Developer’s Guide to Database Storage Engines – The Basics (yugabyteDB)

Tip of the Week

  • Save time typing paths by drag-n-dropping a folder from Finder/File Explorer to your command shell. Works on Windows and macOS in Command Prompt, Powershell, Cmder, and Terminal.
  • Popular and seminal white papers curated by Papers We Love (GitHub)
    • See if there is an upcoming PWL meetup in your area (paperswelove.org)
    • And there’s a corresponding Papers We Love Conference (pwlconf.org)
  • Every find yourself in the situation where you’re asked to pivot from your current work to another task that would require you to stash your current changes and change branches? Maybe you do that. Or maybe you clone the repo into another path and work from there? But there’s a pro-tip way. Instead, you can use git worktree to work with your repo in another path without needing to re-clone the repo.
    • For example, git worktree add -b myhotfix /temp master copies the files from master to /temp and creates a new branch named myhotfix.
  • Get your Silicon Valley fix with Mythic Quest. (Apple)
  • Level up your programming skills with exercises and mentors with Exercism. (exercism.io)
    • Exercism has been worth mentioning a few times:
      • Algorithms, Puzzles, and the Technical Interview (episode 26)
      • Deliberate Practice for Programmers (episode 78)
  • Use elasticdump’s import and export tools for Elasticsearch. (GitHub)
  • Use docker run --network="NETWORK-NAME-HERE" to connect a container to an existing Docker network. (docs.docker.com)
Direct download: coding-blocks-episode-128.mp3
Category:Software Development -- posted at: 8:01pm EDT

In this episode, Allen is back, Joe knows his maff, and Michael brings the jokes, all that and more as we discuss the internals of how databases store and retrieve the data we save as we continue our deep dive into Designing Data-Intensive Applications.

If you’re reading these show notes via your podcast player, did you know that you can find them at https://www.codingblocks.net/episode127? Well you do now! Check it out and join in the conversation.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 10% off any course or annual subscription.
  • Clubhouse – The fast and enjoyable project management platform that breaks down silos and brings teams together to ship value, not features. Sign up to get two additional free months of Clubhouse on any paid plan by visiting clubhouse.io/codingblocks.

Survey Says

Which fast food restaurant makes the better fries?

Take the survey at: https://www.codingblocks.net/episode127.

News

  • We thank all of the awesome people that left us reviews:
    • iTunes: TheLunceforce, BrianMorrisonMe, Collectorofmuchstuff, Momentum Mori, brianbrifri, Isyldar, James Speaker
    • Stitcher: adigolee
  • Come see Allen, Joe, and Michael in person at the 15th Annual Orlando Code Camp & Tech Conference, March 28th. Sign up for your chance to kick them all in the shins and grab some swag. (orlandocodecamp.com)

Database Storage and Retrieval

  • A database is a collection of data.
  • A database management system includes the database, APIs for managing the data and access to it.

RDBMS Storage Data Structures

  • Generally speaking, data is written to a log in an append only fashion, which is very efficient.
    • Log: an append-only sequence of records; this doesn’t have to be human readable.
  • These write operations are typically pretty fast because writing to the end of a file is generally a very fast operation.
  • Reading for a key from a file is much more expensive though as the entire file has to be scanned for instances of the key.
  • To solve this problem, there are indexes.
    • Generally speaking, an index is just different ways to store another structure derived from the primary set of data.
    • Having indices incurs additional overhead on writes. You’re no longer just writing to the primary data file, but you’re also keeping the indices up to date at the same time.
      • This is a trade-off you incur in databases: indexes speed up reads but slow down writes.

Hash Indexes

  • One possible solution is to keep every key’s offset (which points to the location of the value of the key) in memory.
    • This is what is done for Bitcask, the default storage engine for Riak.
    • The system must have enough RAM for the index though.
  • In the example given, all the keys stay in memory, but the file is still always appended to, meaning that the key’s offset is likely to change frequently, but it’s still very efficient as you’re only ever storing a pointer to the location of the value.
  • If you’re always writing to a file, aren’t you going to run out of disk space?
    • File segmenting / compaction solves this.
      • Duplicate keys in a given file are compacted to store just the last value written for the key, and those values are written to a new file.
        • This typically happens on a background thread.
      • Once the new segment file has been created, after merging in changes from the previous file, then it becomes the new “live” log file.
      • This means while the background thread is running to create the new segment, the locations for keys are being read from the old segment files in the meantime so that processes aren’t blocked.
      • After the new segment file creation is completed, the old segment files can be deleted.
        • This is how Kafka topic retention policies work, and what happens when you run “force merge” on an Elasticsearch index (same goes for similar systems).
  • Some key factors in making this work well:
    • File format
      • CSV is not a great format for logs. Typically you want to use a binary format that encodes the length of the string in bytes with the actual string appended afterwards.
    • Deleting records requires some special attention
      • You have to add a tombstone record to the file. During the merge process, the key and values will be deleted.
    • Crash recovery
      • If things go south on the server, recovering might take some time if there are large segments or key/value pairs.
      • Bitcask makes this faster by snapshotting the in-memory hashes on occasion so that starting back up can be faster.
    • Incomplete record writes
      • Bitcask files include checksums so any corruption in the logs can be ignored.
    • Concurrency control
      • It’s common for there to only be one writer thread, but multiple reader threads, since written data is immutable.

Why not update the file, instead of only appending to it?

  • Appending and merging are sequential operations, which are particularly efficient on HDD and somewhat on SSD.
  • Concurrency and crash recovery are much simpler.
  • Merging old segments is a convenient and unintrusive way to avoid fragmentation.

Downsides to Hash Indexes

  • The hash table must fit in memory or else you have to spill over to disk which is inefficient for hash table.
  • Range queries are not efficient, you have to lookup each key.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)

Tip of the Week

  • Add authentication to your applications with minimum fuss using KeyCloak. (keycloak.org)
  • Master any major city’s transit system like a boss with CityMapper. (citymapper.com)
  • Spin up a new VM with a single command using Multipass. (GitHub)
  • Random User Generator – like Lorem Ipsum, but for people. (randomuser.me)
  • The perfect gifts for that nerd in your life. (remembertheapi.com)
  • Use CTRL+SHIFT+O in Chrome’s Sources tab to navigate to your JavaScript function by name.
  • tabs AND spaces – A new podcast that talks the topics that developers care about. (tabsandspaces.io)
Direct download: coding-blocks-episode-127.mp3
Category:Software Development -- posted at: 8:01pm EDT

Jamie from https://dotnetcore.show/ and Allen, ya know, from Coding Blocks, sat down together at NDC London to talk about the hot topics from the conference as well as how to get the most out of any conference you attend.

If you're reading this episodes show notes via your podcast player, you can find this episode's full show notes at https://www.codingblocks.net/episode126 where you can join in on the conversation.

Sponsors

  • Datadog - Sign up today at codingblocks.net/datadog for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard. Read Datadog's new State of Serverless research report that breaks down the state of Serverless, with a detailed look at AWS Lambda usage.
  • Educative.io - Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 10% off any course or annual subscription.
  • Clubhouse - The fast and enjoyable project management platform that breaks down silos and brings teams together to ship value, not features. Sign up to get two additional free months of Clubhouse on any paid plan by visiting clubhouse.io/codingblocks.

How to get the most out of a Conference

  • If the conference has an app - I highly recommend downloading it - typically latest breaking changes to venue, rooms, talks, etc. will be in the app
  • Attend talks that are outside your immediate realm of knowledge - get exposed to new things, new ideas, new ways of thinking
  • Walk away with fewer "unknown unknowns" and gain some more "known unknowns"
    • Provides you with things to search when you get back from the conference
  • Picking the talks you want to attend
    • Sometimes you have to sacrifice bigger names just to attend talks that may pique your interest
  • Know that what you're seeing on stage for an hour was probably weeks worth of effort to make it go off without a hitch - so when you try to replicate these things at home, don't lose hope when your try isn't as smooth as what you saw on stage
  • This next bit goes for Meetups, Conferences, etc - Get involved in conversations - don't just sit on the sideline - many developers are introverts, but to truly get the most out of a conference you want to have some meaningful discussions
    • Pacman effect - leave a gap when you're standing in a group having a conversation
    • Take advantage of eating times - find a table with an open spot and don't pick up your phone!!! Say good morning or good afternoon! "What's been your favorite talk today?"
    • When it's "drinking time", talk to people. If you're not a drinker, grab a water or a soda and join in on the conversation
    • Try and reach out BEFORE the conference online - Twitter, Facebook, Slack, etc - try and find out who all is going to be attending and try to make a point to meet up at the event! Makes things much less awkward when you've planned a meeting rather than just shouldering your way in.
    • Be a wingman/wingwoman or bring one along - help introduce people to your ring of contacts'
    • Maybe sign up to be a speaker at one of these things! If you watch the other folks giving presentations, you'll see they're regular people just sharing the things they're passionate about
      • The big names in the industry became big names because they took that first step - you don't become a big name overnight

Must-see Presentations

Notes from some of the Talks

  • Machine Learning - we as developers need to take much more care in what we release to the world
    • A number of talks / discussion panels revolved around this topic
    • Even with good intentions, you can make something that has consequences that aren't easy to see
    • Knowing your data intimately is the key to everything - but, you need to have different perspectives on the data - it'd be really easy to get laser focused on what you think makes for a good set of data for a model, and miss the pieces that actually provide the best model
    • Microsoft's ethical approach to AI - AI Principles
      https://www.microsoft.com/en-us/ai/responsible-ai
    • Cities with most camera coverage? Looks like Allen got it wrong - London isn't in the first spot anymore, but they're still top 10!
      https://www.comparitech.com/vpn-privacy/the-worlds-most-surveilled-cities/

Favorite part of the conference?

"Why go if you can just watch the videos?"

  • Interacting with people
  • Thanking the people who make an impact on your daily life

Miscellaneous

It's not "Steve Ardalis" as Allen said - it's Steve Smith, better known as @Ardalis online!
Twitter: @ardalis [https://twitter.com/ardalis]

App Center - DevOps Pipeline for Mobile
https://appcenter.ms/

Zac Braddy / Jamie Taylor plan to launch a new podcast!

Jamie doesn't care about tabs or spaces...what?!?!
He also has other podcasts in the work, but they're on hold at the moment...stay tuned!

Direct download: coding-blocks-episode-126.mp3
Category:Software Development -- posted at: 8:29pm EDT

We dive into declarative vs imperative query languages as we continue to dive into Designing Data-Intensive Applications while Allen is gallivanting around London, Michael had a bullish opinion, and Joe might not know about The Witcher.

If you’re reading this episodes show notes via your podcast player, you can find this episode’s full show notes at https://www.codingblocks.net/episode125 where you can join in on the conversation.

Sponsors

  • Datadog – Sign up today at codingblocks.net/datadog for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard. Read Datadog’s new State of Serverless research report that breaks down the state of Serverless, with a detailed look at AWS Lambda usage.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 10% off any course or annual subscription.
  • Clubhouse – The fast and enjoyable project management platform that breaks down silos and brings teams together to ship value, not features. Sign up to get two additional free months of Clubhouse on any paid plan by visiting clubhouse.io/codingblocks.

Survey Says

How do you pronounce data?

Take the survey at: https://www.codingblocks.net/episode125.

News

  • We thank everyone that left us some great reviews:
    • iTunes: 3divint, RyansWorld23
    • Stitcher: Thomasvc, thew_s_witcher4, DaveTheShirt, Yarpskendaya
  • Get your shin kicking shoes on and sign up for the South Florida Software Developers Conference 2020, February 29th, where Joe will be giving his talk, Streaming Architectures by Example. (fladotnet.com)
  • Come meet us at the 15th annual Orlando Code Camp & Tech Conference, March 28th. Grab some swag and kick us in the shins. (orlandocodecamp.com)

Query Languages

Declarative vs Imperative

  • The relational model introduced a declarative query language: SQL.
  • Prior models used imperative code.
  • An imperative language performs certain operations in a certain order, i.e. do this, then do that.
  • With a declarative query language, you specify the pattern of data you want, the conditions that must be met, any sorting, grouping, etc.
    • Note that you don’t specify how to retrieve the data. That is left to the optimizer to figure out.
  • Declarative languages are attractive because they are shorter and easier to work with.
    • Consider UI frameworks where you declaratively describe the UI without needing to write code that actually draws a button of a specific size in a specific place with a specific label, etc.
  • Additionally, declarative languages hide the implementation details.
    • This means it’s easier to continue using the code as the underlying engine is updated, be it a database, UI framework, etc.
    • This also means that the declarative code can take advantage of performance enhancements with little to no change (often) to the declarative code.
  • Because declarative languages only specify the result, instead of how to get the result, they are often more likely to be able to take advantage of parallel execution.
    • Conversely, because imperative code needs to happen in a specific order, it’s more difficult to parallelize.

MapReduce

  • Made popular by Google, MapReduce is a programming model meant for processing large amounts of data in bulk in a horizontally distributed fashion.
  • Some NoSQL databases, such as MongoDB and CouchDB, support MapReduce in a limited form as a way to perform read-only queries across many documents.
  • MapReduce isn’t a declarative query language but it’s also not completely an imperative query API either.
    • This is because to use it, you’re implementing the Template Pattern (episode 16).
  • With MapReduce, you implement two methods: map() and reduce().
  • The map() and reduce() functions are pure functions.
    • They can only use the data passed into them, they can’t perform additional queries, and they must not have side effects.
    • Pure functions are a concept used in functional programming.
  • From a usability perspective though, it does require writing two functions that are somewhat tied to each other, which may be more effort than just writing a single SQL query.
    • Plus a purely declarative SQL query is better able to take advantage of the optimizer.
      • For this reason, MongoDB added a declarative query language called the aggregation pipeline to wrap the MapReduce functionality.
        • It’s expessiveness is similar to a subset of SQL but in a JSON syntax.

Graph-Like Data Models

  • Relationships, particularly many-to-many, are an important feature for distinguishing between when to use which data model.
  • As relationships get even more complicated, graph models start to feel more natural.
  • Where as document databases have documents, and relational databases have tables, rows, and columns, graph databases have:
    • Vertices: Nodes in the graph
    • Edges: Define the relationships between nodes, and can contain data about those relationships.
  • Examples of graph-like data:
    • Social graphs: Vertices are the entities (people, media, articles), and edges are the relationships (friends with, likes, etc.)
    • Web graph: Vertices are the pages, and edges are the links.
    • Maps: Addresses are the vertices, and roads, rails, sidewalks are the edges.
  • There are some things that are trivial to express in a graph query that are really hard any other way.
    • For example, fetch the top 10 people that are friends with my friends, but not friends with me, and liked pages that I like sorted by the count of our common interests.
  • These queries work just like graph algorithms, you define how the graph is traversed.
  • Graph databases tend to be highly flexible since you can keep adding new vertices and nodes without changing any other relationships.
  • This makes graphs great for evolvability.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)
  • Design Patterns Part 2 – Oh behave! (episode 16)
  • Developer Survey Results 2019 (Stack Overflow)
  • Graph Algorithms (episode 85)
  • CloudSQL with Amy Krishnamohan (gcppodcast.com)

Tip of the Week

  • Is there an equivalent of tail -f on Windows? (Stack Overflow)
  • Recursively find files whose content matches a regex pattern and display the first 10 lines for context:

Get-ChildItem .\*.txt -Recurse | Select-String -Pattern 'MyPattern' -context 10,0

  • Use the Microsoft Application Inspector to identify and surface well-known features and other interesting characteristics of a component’s source code to determine what it is and/or what it does. (GitHub)
  • Automatically silence those pesky, or worse: embarrassing, notifications while screensharing on your Mac. (Muzzle)
Direct download: coding-blocks-episode-125.mp3
Category:Software Development -- posted at: 11:35pm EDT

While we continue to dig into Designing Data-Intensive Applications, we take a step back to discuss data models and relationships as Michael covers all of his bases, Allen has a survey answer just for him, and Joe really didn’t get his tip from Reddit.

This episode’s full show notes can be found at https://www.codingblocks.net/episode124, in case you’re reading this via your podcast player, where you can be a part of the conversation.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 10% off any course or annual subscription.
  • Clubhouse – The fast and enjoyable project management platform that breaks down silos and brings teams together to ship value, not features. Sign up to get two additional free months of Clubhouse on any paid plan by visiting clubhouse.io/codingblocks.

Survey Says

Which keyboard do you use?

Take the survey at: https://www.codingblocks.net/episode124.

News

  • Thank you for the awesome reviews:
    • iTunes: Kampfirez, Ameise776, JozacAlanOutlaw, skmetzger, Napalm684, Dingus the First
  • Get your tickets now for NDC { London }, January 27th – 31st, where you can kick Allen in the shins where he will be giving his talk, Big Data Analytics in Near-Real-Time with Apache Kafka Streams. (ndc-london.com)
  • Hurry and sign up for the South Florida Software Developers Conference 2020, February 29th, where Joe will be giving his talk, Streaming Architectures by Example. This is a great opportunity for you to try to kick him in the shins. (fladotnet.com)
  • The CB guys will be at the 15th Annual Orlando Code Camp & Tech Conference, March 28th. Sign up for your chance to kick them all in the shins and grab some swag. (orlandocodecamp.com)

Relationships … It’s complicated

Normalization

  • Relational databases are typically normalized.
    • A quick description of normalization would be associating meaningful data with a key and then relating data by keys rather than storing all of the data together.
  • Normalization reduces redundancy and improve data integrity.
  • Relational normalization has several benefits:
    • Consistent styling and spelling for meaningful values.
    • No ambiguity, even when text values are coincidentally the same, for example, Georgia the state vs Georgia the country.
    • Updating meaningful values is easy since there is only one spot to change.
    • Language localization support can be easier because you can associate different meaningful values with the same key for each supported language.
    • Search for hierarchical relationships can be easier, for example, getting a list of cities for a particular state.
      • This can vary based on how the data is stored. See episode 28 and episode 29 for more detailed discussions related to some strategies.
  • There are legitimate reasons for having denormalized data in a relational database, like faster searches, although there might be better tools for the specific use case.

Relationships …

In Document Databases

  • Document databases struggle as relationships get more complicated.
  • Document database designers have to make careful decisions about where data will be stored.
  • A big benefit of document databases is locality, meaning all of the relevant data for an entity is stored in one spot.
    • Fetching an order object is one simple get in a document database, while the relational database might end up being more than one query and will surely join multiple tables.

In Relational Databases

  • There are several benefits of relational database relationships, particularly Many-to-One and Many-to-Many relationships
    • To illustrate a Many-to-One example, there are many parts associated to one particular computer.
    • To illustrate a Many-to-Many example, a person can be associated to many computers and a computer can be associated to many people.
  • As your product matures, your database (typically) gets more complicated. The relational model holds up really well to these changes over time. The queries get more complicated as you add more relationships, but your flexibility remains.

Query Optimization

  • A query optimizer, a common part of popular RDBMSes, is responsible for deciding which parts of your written query to execute in which order and which indexes to use.
  • The query optimizer has a huge impact on performance and is a big part of the reason why proprietary RDBMSes like Oracle and SQL Server are so popular.
    • Imagine if you, the developer, had to be smarter about the order that you joined your tables and the order of items in your WHERE clause …
      • and then ratios of data in the tables were different in production vs development,
      • and then a new index was added, …
  • The query optimizer uses advanced statistics about your data to make smart choices about how to execute your query.
  • A key insight into the relational model is that the query optimizer only has to be built once and everybody benefits from it.
  • In document databases, the developers and data model designers have to consider their designs and querying constantly.

How to choose Document vs Relational

Document Databases …

  • Better performance in some use cases because of locality.
  • Often scale very well because of the locality.
  • Are flexible in what they can store, often called “schemaless” or “schema on read”, but put another way, this is a lack of enforced integrity.
  • Have poor support for joining because you have to fetch the whole document for a simple lookup.
  • Require extra care when designing because it’s difficult to change the document formats after the fact and because there is no generic query optimizer available.

Relational Databases …

  • Can provide powerful relationships, particularly with highly connected data.
  • However, they don’t scale horizontally very well.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)
  • Generate metrics from your logs to view historical trends and track SLOs (Datadog)
  • Hierarchical Data – Adjacency Lists and Nested Set Models (episode 28)
  • Hierarchical Data cont’d – Path Enumeration and Closure Tables (episode 29)

Tip of the Week

  • Presto – The Distributed SQL Query Engine for Big Data. (prestodb.io)
  • Use the Files app in iOS to proxy files from Box or Google Drive (support.apple.com)
  • Pin tabs in Chrome for all of your must have open tabs. (support.google.com)
  • Use the Microsoft Authenticator to keep all of your one-time passwords in sync across all of your devices. And it requires you authenticate with it to even see the OTPs! (App StoreGoogle Play)
  • Combine Poker with learning with Varianto:25’s Git playing cards. (varianto25.com)
  • Search your Gmail for unread old emails with queries like before:2019/01/01 is:unread.
  • The new JetBrains Mono font is almost as awesome as the page that describes it. (JetBrains)
Direct download: coding-blocks-episode-124.mp3
Category:Software Development -- posted at: 12:31am EDT

We’re comparing data models as we continue our deep dive into Designing Data-Intensive Applications as Coach Joe is ready to teach some basketball, Michael can’t pronounce 6NF, and Allen measured some geodesic distances just this morning.

For those reading these show notes via a podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode123 where you can also join in on the conversation.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course or, for a limited time, get 50% off an annual subscription.
  • ABOUT YOU – One of the fastest growing e-commerce companies headquartered in Hamburg, Germany that is growing fast and looking for motivated team members like you. Apply now at aboutyou.com/job.

Survey Says

Which data model do you prefer?

Take the survey at: https://www.codingblocks.net/episode123.

 

News

  • We thank everyone that took a moment to leave us a review:
    • iTunes: BoulderDude333, the pang1, fizch26
  • Hurry up and get your tickets now for NDC { London }, January 27th – 31st, where Allen will be giving his talk, Big Data Analytics in Near-Real-Time with Apache Kafka Streams. This is your chance to kick him in the shins on the other side of the pond. (ndc-london.com)
  • Sign up for your chance to kick Joe in the shins at the South Florida Software Developers Conference 2020, February 29th, where he will be giving his talk, Streaming Architectures by Example. (fladotnet.com)
  • Want a chance to kick all three Coding Blocks hosts in the shins? Sign up for the 15th Annual Orlando Code Camp & Tech Conference, March 28th, for your chance to kick them all in the shins and grab some swag. (orlandocodecamp.com)

Data Models

  • Data models are one of the most important pieces of developing software.
    • It dictates how the software is written.
    • And it dictates how we think about the problems we’re solving.
  • Software is typically written by stacking layers of modeling on top of each other.
    • We write objects and data structures to reflect the real world.
    • These then get translated into some format that will be persisted in JSON, XML, relational tables, graph db’s, etc.
      • The people that built the storage engine had to determine how to model the data on disk and in memory to support things like search, fast access, etc.
        • Even further down, those bits have to be converted to electrical current, pulses of light, magnetic fields and so on.
  • Complex applications commonly have many layers: APIs built on top of APIs.
    • What’s the purpose of these layers? To hide the complexity of the layer below it.
      • The abstractions allow different groups of people (potentially with completely different skillsets) to work together.
  • There are MANY types of data models, all with different usages and needs in mind.
    • It can take a LOT of time and effort to master just a single model.
    • Data models have a HUGE impact on how you write your applications, so its important to choose one that makes sense for what you’re trying to accomplish.

Relational Model vs Document Model

  • Best-known model today is probably the ones based on SQL.
  • The relational model was proposed by Edgar Codd back in 1970.
  • The relational model organizes data into relations (i.e. tables in SQL) where each relation contains an unordered collection of tuples (i.e. rows in SQL).
    • People originally doubted it would work but it’s dominance has lasted since the mid-80’s, which the author points out is basically an eternity in software.
  • Origins were based in business data processing, particularly transaction processing.
  • There have been a number of competing data storage and querying approaches over the years.
    • Network and Hierarchical models in 70’s and 80’s,
    • Object databases were competitors in the late 80’s and early 90’s,
    • XML databases,
    • Basically a number a competitors over the years but nobody has dethroned the relational database.
  • Almost everything you see and use today has some sort of relational database working behind it.

NoSQL

  • NoSQL is the latest competitor to Relational Databases.
    • It was originally intended as a catchy Twitter hashtag for a meetup about open source, distributed, non-relational databases.
    • It has since been re-termed to “Not only SQL”.
  • What needs does NoSQL aim to address?
    • The need for greater scalability than traditional RDBMS’s can typically achieve, including very large datasets and fast writes.
    • The desire for FOSS (free and open source software), as opposed to very expensive, commercial RDBMS’s.
    • Specialized query operations that are not supported well in the relational model.
    • Shortcomings of relational models – need for more dynamic and/or expressive data models.
  • Different applications (or even different pieces of the same application) have different needs and may require different data models. For that reason, it’s very likely that NoSQL won’t replace SQL, but rather it’ll augment it.
    • This is referred to as polyglot persistence.

Object-Relational Mismatch

  • Most applications today are written in an object oriented programming language.
  • There’s typically a translation layer required to map the relational data models to an object model.
    • The disconnect between models can be referred to as impedance mismatch.
  • Frameworks like ActiveRecord, Hibernate, Entity Framework, etc., can reduce the boilerplate code needed for the translation but typically don’t fully hide the impedance mismatch issues.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)
  • Monitor Azure DevOps workflows and pipelines with Datadog (Datadog)
  • Monitor Amazon EKS on AWS Fargate with Datadog (Datadog)
  • Best practices for tagging your infrastructure and applications (Datadog)
  • Introducing: Educative Subscriptions (Educative.io)
  • Santosh Hari – Not all data is created equal: NoSQL (YouTube)
  • TIOBE Index (tiobe.com)
  • Database Schema for Multiple Types of Products
  •  

Tip of the Week

  • Got data? Use DataGrip. One tool for many databases. (JetBrains)
  • KafkaHQ – A Kafka GUI for topics, data, consumer groups, schema registry and more. (GitHub)
  • Grafka – A GraphQL interface for Apache Kafka (GitHub)
  • Use Google Maps to measure geodesic distances (citylab.com)
  • How to undo (almost) anything with Git (GitHub)
  • Will Save the Galaxy for Food by Yahtzee Croshaw (Amazon)
Direct download: coding-blocks-episode-123.mp3
Category:Software Development -- posted at: 8:39pm EDT

We dig into what it takes to make a maintainable application as we continue to learn from Designing Data-Intensive Applications, as Allen is a big fan of baby Yoda, Michael’s index isn’t corrupt, and Joe has some latency issues.

In case you’re reading this via your podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode122 where you can join in on the conversation.

Sponsors

  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course or, for a limited time, get 50% off an annual subscription.
  • ABOUT YOU – One of the fastest growing e-commerce companies headquartered in Hamburg, Germany that is growing fast and looking for motivated team members like you. Apply now at aboutyou.com/job.

Survey Says

Which sci-fi series is best?

Take the survey at: https://www.codingblocks.net/episode122.

News

  • Thank you for taking a moment out of your day to leave us a review:
    • iTunes: Kodestar, CrouchingProbeHiddenCannon
    • Stitcher: programticalpragrammerer, Patricio Page, TheOtherOtherJZ, Luke Garrigan
  • Be careful about sharing/using code to/from Stack Overflow! You need to be aware of the licensing and what it might mean for your application.
    • What is the license for the content I post? (Stack Overflow)
    • Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (Creative Commons)
    • Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (tldrlegal.com)
    • We Still Don’t Understand Open Source Licensing (episode 5)
  • Get your tickets now for NDC { London } for your chance to kick Allen in the shins where he will be giving his talk Big Data Analytics in Near-Real-Time with Apache Kafka Streams. (ndc-london.com)

Maintainability

  • A majority of cost in software is maintaining it, not creating it in the first place.
  • Coincidentally most people dislike working on these legacy systems possibly due to one or more of the following:
    • Bad code,
    • Outdated platforms, and/or
    • Made to do things the system wasn’t designed to do.
  • We SHOULD build applications to minimize the pain during the maintenance phase which involves using the following design principals:
    • Operability – make it easy to keep the system running smoothly.
    • Simplicity – make it easy for new developers to pick up and understand what was created, remove complexity from the system.
    • Evolvability – make it easy for developers to extend, modify, and enhance the system.

Operability

  • Good operations can overcome bad software, but great software cannot overcome bad operations.
  • Operations teams are vital for making software run properly.
  • Responsibilities include:
    • Monitoring and restoring service if the system goes into a bad state.
    • Tracking down the problems.
    • Keeping the system updated and patched.
    • Keeping track of how systems impact each other.
    • Anticipating and planning for future problems, such as scale and/or capacity.
    • Establish good practices for deployments, configuration management, etc.
    • Doing complicated maintenance tasks, such as migrating from one platform to another.
    • Maintaining security.
    • Making processes and operations predictable for stability.
    • Keeping knowledge of systems in the business even as people come and go. No tribal knowledge.
  • The whole point of this is to make mundane tasks easy allowing the operations teams to focus on higher value activities.
  • This is where data systems come in.
    • Get visibility into running systems, i.e. monitoring.
    • Supporting automation and integration.
    • Avoiding dependencies on specific machines.
    • Documenting easy to understand operational models, for example, if you do this action, then this will happen.
    • Giving good default behavior with the ability to override settings.
    • Self-healing when possible but also manually controllable.
    • Predictable behavior.

Simplicity

  • As projects grow, they tend to get much more complicated over time.
    • This slows down development as it takes longer to make changes.
    • If you’re not careful, it can become a big ball of mud.
  • Indicators of complexity:
    • Explosion of state space,
    • Tight coupling,
    • Spaghetti of dependencies,
    • Inconsistent coding standards such as naming and terminology,
    • Hacking in performance improvements,
    • Code to handle one off edge cases sprinkled throughout.
  • Greater risk of introducing bugs.
  • Reducing complexity improves maintainability of software.
    • For this reason alone, we should strive to make our systems simpler to understand.
  • Reducing complexity DOES NOT mean removing or reducing functionality.

Accidental complexity – Complexity that is accidental if it is not inherent in the problem that the software solves, but arises only from the implementation.

Ben Moseley and Peter Marks, Out of the Tar Pit

How to remove accidental complexity?

  • Abstraction
    • Allows you to hide implementation details behind a facade.
    • Also allows you to reduce duplication as abstractions can allow for reuse among many implementations.
  • Examples of good abstractions:
    • Programming languages abstract system level architectures such as CPU, RAM registers, etc.
    • SQL is an abstraction over complex memory and data structures.
  • Finding good abstractions is VERY HARD.
    • This has become apparent with distributed systems as these abstractions are still being explored.

Evolvability

  • It’s VERY likely that your system will need to undergo changes as time moves on.
  • Agile methods allow you to adapt to change. Some methods include:
    • Test Driven Development
    • Refactoring
  • How easy you can modify a data system is closely linked to how simple the system is.
  • Rather than calling it agility, the book refers to it as evolvability.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)
  • All permutations of English letters with a handy search feature (libraryofbabel.info)
  • What is the license for the content I post? (Stack Overflow)
  • Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (Creative Commons)
  • Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (tldrlegal.com)
  • We Still Don’t Understand Open Source Licensing (episode 5)
  • Streaming process output to a browser, with SignalR and C# (Coding Blocksdev.to)
  • Googlewhack – A Google query using two words, without quotes, that returns a single search result. (Wikipedia)
  • The Website is Down – Sales Guy vs. Web Dude (YouTube – Explicit)
  • Software Design Anti-patterns (episode 65)
  • Clean Architecture – How to Quantify Component Coupling (episode 72)
  • Static Analysis w/ NDepends – How good is your code? (episode 15)
  • Static Analysis of Open Source .NET Projects (Coding Blocks)
  • Does Facebook still use PHP? (Quora)

Tip of the Week

  • Need to move data from here to there? Check out Fluentd. (fluentd.org)
  • Use NUnit’s Assert.Multiple to assert that multiple conditions are all met. (GitHub)
  • Turns out C#’s where generic type constraints are even cooler than you might have realized. (docs.microsoft.com)
  • Best Practices for Response Times and Latency (GitHub)
Direct download: coding-blocks-episode-122.mp3
Category:Software Development -- posted at: 8:33pm EDT

We continue to study the teachings of Designing Data-Intensive Applications, while Michael’s favorite book series might be the Twilight series, Joe blames his squeak toy chewing habit on his dogs, and Allen might be a Belieber.

Head over to https://www.codingblocks.net/episode121 to find this episode’s full show notes and join in the conversation, in case you’re reading these show notes via your podcast player.

Sponsors

  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course or, for a limited time, get 50% off an annual subscription.

Survey Says

With the new year coming, what kind of learning resolution do you plan on setting? I plan to learn ...

Take the survey at: https://www.codingblocks.net/episode121.

News

  • So many new reviews to be thankful for! Thanks for making it a point to share your review with us:
    • iTunes: bobby_richard, SeanNeedsNewGlasses, Teshiwyn, vasul007, The Jin John
    • Stitcher: HotReloadJalapeño, Leonieke, Anonymous, Juke0815
  • Joe was a guest on The Waffling Taylors. Check out the entire three episode series: Squidge The RingJay vs Doorsand Exploding Horses.
  • Be aware of “free” VPNs.
    • This iOS Security App Shares User Data With China: 8 Million Americans Impacted (Forbes)
    • Facebook shuts down Onavo VPN app following privacy scandal (Engadget)
  • Allen will be speaking at NDC { London } where he will be giving his talk Big Data Analytics in Near-Real-Time with Apache Kafka Streams. Be sure to stop by for your chance to kick him in the shins! (ndc-london.com)

Scalability

  • Increased load is a common reason for degradation of reliability.
  • Scalability is the term used to describe a system’s ability to cope with increased load.
  • It can be tempting to say X scales, or doesn’t, but referring to a system as “scalable” really means how good your options are.
  • Couple questions to ask of your system:
    • If the system grows in a particular way (more data, more users, more usage), what are our options for coping?
    • How easy is it to add computing resources?

Describing Load

  • Need to figure out how to describe load before before we can truly answer any questions.
  • “Load Parameters” are the metrics that make sense to measure for your system.
  • Load Parameters are a measure of stress, not of performance.
  • Different parameters may matter more for your system.
  • Examples for particular uses may include:
    • Web Server: requests per second
    • Database: read/write ratio
    • Application: # of simultaneous active users
    • Cache: hit/miss ratio
  • This may not be a simple number either. Sometimes you may care more about the average number, sometimes only the extremes.

Describing Performance

  • Two ways to look at describing performance:
    • How does performance change when you increase a load parameter, without changing resources?
    • How much do you need to increase resources to maintain performance when increasing a load parameter?
  • Performance numbers measure how well your system is responding.
  • Examples can include:
    • Throughput (records processed per second)
    • Response time

Latency vs Response Time

  • Latency is how long a request is waiting to be handled, awaiting service.
  • Response time is the total time it takes for the client to see the response, including any latency.

What do you mean by “numbers”?

  • Performance numbers are generally a set of numbers: i.e. minimum, maximum, average, median, percentile.
  • Sometimes the outliers are really important.
    • For example, a game may have an average of 59 FPS but that number might drop to 10 FPS when garbage collection is running.
    • Average may not be your best measure if you want to see the typical response time.
  • For this reason it’s better to use percentiles.
    • Consider the median (sort all the response times and the one in the middle is the median). Median is known as the 50th percentile or P50.
      • That means that half of your response times will be under the 50% mark and half will be over.
      • To find the outliers, you can look at the 95th, 99th and 99.9th percentiles, aka P95, P99, P999.
        • If you were to look at the P95 mark and the response time is 2s, then that means that 95% of all requests come back in under 2 seconds and 5% of all requests come back in over 2s.
          • The example provided is that Amazon describes response times in the P999 even though it only affects 1 in 1000 users. The reason? Because the slowest response times would be for the customers who’ve made the most purchases. In other words, the most valued customers!
  • Increased response times have been measured by many large companies in regards to completions of orders, leaving sites, etc.
  • Ultimately, trying to optimize for P999 is very expensive and may not make the investment worth it.
    • Not only is it expensive but it’s also difficult because you may be fighting environmental things outside of your control.
  • Percentiles are often used in:
    • SLO’s – Service Level Objectives
    • SLA’s – Service Level Agreements
    • Both are contracts that draw out the expected performance and availability of a service.
  • Queuing delays are a big part of response times in the higher percentiles.
    • Servers can only process a finite amount of things in parallel and the rest of the requests are queued.
    • A relatively small number of requests could be responsible for slowing many things down.
      • Known as head-of-the-line blocking.
        • For this reason – it’s important to make sure you’re measuring client side response times to make sure you’re getting the full picture.
        • In load testing, the client application needs to make sure it’s issuing new requests even if it’s waiting for older ones. This will more realistically mimic the real world.
  • For applications that make multiple service calls to complete a screen or page, slower response times become very critical because typically the user experience is not good even if you’re just waiting for one out of 20 requests. The slowest offender is typically what determines the user experience.
    • Compounding slow requests is known as tail latency amplification.
  • Monitoring response times can be very helpful, but also dangerous.
    • If you’re trying to calculate the real response time averages against an entire set of data every minute, the calculations can be very expensive.
      • There are approximation algorithms that are much more efficient, such as forward decay, t-digest, or HdrHistogram.
      • Averaging percentiles is meaningless. Rather you need to add the histograms.

Coping with Load

How do we retain good performance when our load increases?

  • An application that was designed for 1,000 concurrent users will likely not handle 10,000 concurrent users very well.
    • It is often necessary to rethink your architecture every time load is increased significantly.
  • The options, simplified:
    • Scaling up – adding more hardware resources to a single machine to handle additional load.
    • Scaling out – adding more machines to handle additional load.
  • One is not necessarily better than the other.
    • Scaling up can be much simpler and easier to maintain, but there is a limit to the power available on a single machine as well as the cost ramifications of creating an uber-powerful single machine.
    • Scaling out can be much cheaper in hardware costs but cost more in developer time and maintenance to make sure everything is running as expected
    • Rather than picking one over the other, consider when each makes the most sense.
  • Elasticity is when a system can dynamically resize itself based on load, i.e. adding more machines as necessary, etc.
    • Some of this happens automatically based on some load detecting criteria.
    • Some of this happens manually by a person.
      • Manually may be simpler and can protect against unexpected massive scaling that may hit the wallet hard.
  • For a long time, RDBMS’s typically ran on a single machine. Even with a failover, the load wasn’t typically distributed.
    • As distributed systems are becoming more common and the abstractions are being better built, things like this are changing, and likely to change even more.

“[T]here is no such thing as a generic, one-size-fits-all scalable architecture …”

Martin Kleppmann
  • Problems could be reads, writes, volume of data, complexity, etc.
    • A system that handles 100,000 requests per second at 1 KB in size is very different from a system that handles 3 requests per minute with each file size being 2 GB. Same throughput, but much different requirements.
  • Designing a scalable system based off of bad assumptions can be both wasted time and even worse counterproductive.
  • In early stage applications, it’s often much more important to be able to iterate quickly on the application than to design for an unknown future load.

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Grokking the System Design Interview (Educative.io)
  • HdrHistogram: A High Dynamic Range Histogram (hdrhistogram.org)
  • Performance (Stack Exchange)
  • AWS Snowmobile (aws.amazon.com)
  • Monitoring Containerized Application Health with Docker (Pluralsight)

Tip of the Week

  • Get back into slack: Instead of typing in your slack room name, just click the “Find your workspace” link and enter your email – it’ll send you all of the workspaces linked to that email.
  • Forget everything Michael said about CodeDOM in episode 112. Just use Roslyn. (GitHub)
  • The holidays are the perfect time for Advent of Code. (adventofcode.com)
Direct download: coding-blocks-episode-121.mp3
Category:Software Development -- posted at: 10:58pm EDT

We start our deep dive into Joe’s favorite new book, Designing Data-Intensive Applications as Joe can’t be stopped while running downhill, Michael might have a new spin on #fartgate, and Allen doesn’t quite have a dozen tips this episode.

If you’re reading this via your podcast player, you can always go to https://www.codingblocks.net/episode120 to read these show notes on a larger screen and participate in the conversation.

Sponsors

Survey Says

What is the single most important piece of your battlestation?

 

News

  • Thank you to those that took time out of their day to leave us a review:
    • Stitcher: Anonymous, jeoffman
  • How to get started with a SQL Server database using Docker:
    • SQL Server Tips – Run in Docker and an Amazing SSMS Tip (YouTube)
    • Sample SQL Server Database and Docker (YouTube)
  • Come see Allen at NDC { London } for your chance to kick him in the shins, where he will be giving his talk Big Data Analytics in Near-Real-Time with Apache Kafka Streams. (ndc-london.com)
  • John Deere – Customer Showcase: Perform Real-time ETL from IoT Devices into your Data Lake with Amazon Kinesis (YouTube)
  • There’s a new SSD sheriff in town and it’s the Seagate Firecuda 520 with a reported maximum 5,000 MB/s sequential reads and 4,400 MB/s sequential writes!!! (Amazon)
    • Seagate Firecuda 520 1TB NVMe PCIe Gen4 M.2 SSD Review (TweakTown)
  • Get 40% off your Pluralsight subscription! (Pluralsight)
  • Joe was a guest on The Waffling Taylors, episode 59. (wafflingtaylors.rocks)

Designing Data-Intensive Applications

About this book

What is a data-intensive application per the book?

Any application whose primary challenge is:

  • The quantity of data.
  • The complexity of the data.
  • The speed at which the data is changing.

That’s in contrast to applications that are compute intensive.

Buzzwords that seem to be synonymous with data-intensive

  • NoSQL
  • Message queues
  • Caches
  • Search indexes
  • Batch / stream processing

This book is …

This book is NOT a tutorial on how to do data-intensive applications with a particular toolset or pure theory.

What the book IS:

  • A study of successful data systems.
  • A look into the tools / technologies that enable these data intensive systems to perform, scale, and be reliable in production environments
  • Examining their algorithms and the trade-offs they made.

Why read this book?

The goal is that by going through this, you will be able to understand what’s available and why you would use various methods, algorithms, and technologies.

While this book is geared towards software engineers/architects and their managers, it will especially appeal to those that:

  • Want to learn how to make systems scalable.
  • Need to learn how to make applications highly available.
  • Want to learn how to make systems easier to maintain.
  • Are just curious how these things work.

“[B]uilding for scale that you don’t need is wasted effort and may lock you into an inflexible design.”

Martin Kleppmann
  • While building for scale can be a form of premature optimization, it is important to choose the right tool for the job and knowing these tools and their strengths and weaknesses can help you make better informed decisions.

Most of the book covers what is known as “big data” but the author doesn’t like that term for good reason: “Big data” is too vague. Big data to one person is small data to someone else.

Instead, single node vs distributed systems are the types of language used in the book.

The book is also heavily biased towards FOSS (Free Open Source Software) because it’s possible to dig in and see what’s actually going on.

Are we living in the golden age of data?

  • There are an insane number of really good database systems.
  • The cloud has made things easy for a while, but tools like K8s, Docker, and Serverless are making things even easier.
  • Tons of machine learning services taking care of common use cases, and lowering the barrier to entry: NLP, STT, and Sentiment analysis for example.

Reliability

  • Most applications today are data-intensive rather than compute-intensive.
    • CPU’s are usually not the bottleneck in modern day applications – size, complexity, and the dynamic nature of data are.
  • Most of these applications have similar needs:
    • Store data so the application can find it again later.
    • Cache expensive operations so they’ll be faster next time.
    • Allow user searches.
    • Sending messages to other processes – stream processing.
    • Process chunks of data at intervals – batch processing.
  • Designing data-intensive applications involve answering a lot of questions:
    • How do you ensure the data is correct and complete even when something goes wrong?
    • How do you provide good performance to clients even as parts of your system are struggling?
    • How do you scale to increase load?
    • How do you create a good API?

While reading this book, think about the systems that you use: How do they rate in terms of reliability, scalability, and maintainability?

What does it mean for your application to be reliable?

  • The application performs as expected.
  • The application can tolerate a user mistake or misuse.
  • The performance is good enough for the expected use case.
  • The system prevents any unauthorized access or abuse.

So in short – the application works correctly even when things go wrong.

When things go wrong, they’re called “faults”.

  • Systems that are designed to work even when there are faults are called fault-tolerant or resilient.

Faults are NOT the same as failures: a fault did something not to spec, a failure means a service is unavailable.

  • The goal is to reduce the possibility of a fault causing a failure.
  • It may be beneficial to introduce or ramp up the number of faults thrown at a system to make sure the system can handle them properly.
    • You’re basically continually testing your resiliency.
    • Netflix’s Chaos Monkey is an example.
  • The book prefers tolerating faults over preventing them (except in case of things like security), and is mostly aimed at building a system that is self healing or curable.

Hardware Faults

Typically, hardware failures are solved by adding redundancies:

  • Dual power supplies,
  • RAID configuration,
  • Hot swappable CPUs or other components.

As time has marched on, single machine resiliency has been deprioritized in favor of elasticity, i.e. the ability to scale up / down more machines. As a result, systems are now being built to be fault tolerant of machine loss.

Software Errors

Software errors usually happen by some weird event that was not planned for and can be more difficult to track down than hardware errors. Examples include:

  • Runaway processes can use up shared resources,
  • Services slow down,
  • Cascading failures that trigger a fault(s) in another component(s).

Human Errors

Humans can be the least reliable part of any system. So, how can we make systems reliable in spite of our best efforts to crash them?

  • Good UI’s, APIs, etc.
  • Create fully featured sandbox environments where people can explore safely.
  • Test thoroughly.
  • Allow for fast rollbacks in case of problems.
  • Amazing monitoring.
  • Good training / practices.

How important is reliability?

  • Obviously there are some situations where reliability is super important (e.g. nuclear power plant).
  • Other times we might choose to sacrifice reliability to reduce cost.
  • But most importantly, make sure that’s a conscious choice!

Resources We Like

  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann (Amazon)
  • Stefan Scherer has a Docker image for all your Windows needs (hub.docker.com)
  • Aspectacular with Vlad Hrybok – You down with AOP? (episode 9)
  • Grokking the System Design Interview (Educative.io)
    • Designing a URL Shortening service like TinyURL (Educative.io)
  • Looking for inspiration for your battlestation? Check out r/battlestations! (Reddit)
  • Chaos Monkey by Netflix (GitHub)
  • Pokemon Sword and Shield Are Crashing Roku Devices (GameRant)
  • #140 The Roman Mars Mazda Virus by Reply All (Gimlet Media)
  • Troubleshoot .NET apps with auto-correlated traces and logs (Datadog)
  • Your hard drives and noise:
    • Shouting at disks causes latency (RedditYouTube)
    • A Loud Sound Just Shut Down a Bank’s Data Center for 10 Hours (Vice)
    • Beware: Loud Noise Can Cause Data Loss on Hard Drives (Ontrack)
  • Backblaze Hard Drive Stats Q2 2019 (Backblaze)
  • Failure Trends in a Large Disk Drive Population (static.googleusercontent.com)

Tip of the Week

  • When using NUnit and parameterized tests, you should prefer IEnumerable<TestCastData> over something like IEnumerable<MyFancyObject> because TestCastData includes methods like .Explicit() giving you more control over each test case parameter. (NUnit wiki on GitHub)
  • Not sure which DB engine meets your needs? Check out db-engines.com.
  • Search your command history with CTRL+R in Cmder or Terminal (and possibly other shells). Continue pressing CTRL+R to “scroll” through the history that matches your current search.
  • Forgo the KVM. Use Mouse without Borders instead. (Microsoft)
    • Synergy – The Mac OS X version that Michael was referring to. Also works across Windows and Linux. (Synergy)
  • usql – A universal command-line interface for PostgreSQL, MySQL, Oracle, SQLite3, SQL Server, and others. (GitHub)
Direct download: coding-blocks-episode-120.mp3
Category:Software Development -- posted at: 3:01am EDT

We discuss this year's shopping spree only to learn that Michael spent too much, Allen spent too much, and Joe spent too much.

Direct download: coding-blocks-episode-119.mp3
Category:Software Development -- posted at: 8:01pm EDT

We debate whether DevOps is a job title or a job responsibility as Michael finally understands dev.to’s name, Allen is an infosec expert, and Joe wears his sunglasses at night.

If you aren’t already viewing this episode’s show notes in your browser, you can find these show notes at https://www.codingblocks.net/episode118 and join the conversation.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • WayScript – Sign up and build cloud hosted tools that seamlessly integrate and automate your tasks.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course.

Survey Says …

 

Is DevOps a ...

Take the survey here: https://www.codingblocks.net/episode118.

News

  • We appreciate everyone that took a moment to leave us a review and say thanks:
    • iTunes: kevo_ker, Cheiss, MathewSomers
    • Stitcher: BlockedTicket

Is DevOps a Job Title or Company Culture?

  • What is DevOps?
  • What isn’t DevOps?
  • How do you learn DevOps?
  • How mature is your DevOps?
  • The myths of DevOps …

Resources We Like

  • What Is DevOps? (New Relic)
  • The Phoenix Project: A Novel about IT, DevOps, and Helping Your Business Win (Amazon)
  • The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in Technology Organizations (Amazon)
  • The Unicorn Project: A Novel about Developers, Digital Disruption, and Thriving in the Age of Data (Amazon)
  • DevOps is a culture, not a role! (Medium)
  • Why is kubernetes source code an order of magnitude larger than other container orchestrators? (Stack Overflow)
  • Welcoming Molly – The DEV Team’s First Lead SRE! (dev.toMolly Struve)
  • The DevOps Checklist (devopschecklist.com)
  • Vagrant (vagrantup.com)

Tip of the Week

  • Edit your last Slack message by pressing the UP arrow key. That and more keyboard shortcuts available in the Slack Help Center. (Slack)
  • Integrate Linux Commands into Windows with PowerShell and the Windows Subsystem for Linux (devblogs.microsoft.com)
  • Use readlink to see where a symlink ultimately lands. (manpages.ubuntu.com)
  • What are Durable Functions? (docs.microsoft.com)
  • Change your Cmder theme to Allen’s favorite: Babun. (cmder.net)
  • My favourite Git commit (fatbusinessman.com)
Direct download: coding-blocks-episode-118.mp3
Category:Software Development -- posted at: 11:39pm EDT

We take an introspective look into what’s wrong with Michael’s life, Allen keeps taking us down random tangents, and Joe misses the chance for the perfect joke as we wrap up our deep dive into Hasura’s 3factor app architecture pattern.

For those reading these show notes via their podcast player, this episode’s full show notes can be found at https://www.codingblocks.net/episode117.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • O’Reilly Software Architecture Conference – Microservices, domain-driven design, and more. The O’Reilly Software Architecture Conference covers the skills and tools every software architect needs. Use the code BLOCKS during registration to get 20% off of most passes.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course.

Survey Says …

Which relational database is your go to?

Take the survey here: https://www.codingblocks.net/episode117

News

  • Thank you to everyone that left us a review:
    • iTunes: codeand40k, buckrivard
    • Stitcher: Jediknightluke, nmolina

Factor Tres – Async Serverless

The first two factors, realtime GraphQL and reliable eventing, provide the foundation for a decoupled architecture that paves the way for the third factor: async serverless.

These serverless processes meet two properties:

  • Idempotency: Events are delivered at least once.
  • Out of order messaging: The order the events are received is not guaranteed.

Traditional vs 3factor app

Traditional application 3factor application
Synchronous procedure code. Loosely coupled event handlers.
Deployed on VMs or containers. Deployed on serverless platforms.
You manage the platform. The platform is managed for you.
Requires operational expertise. No operational expertise necessary.
Auto-scale when possible. Auto-scales by default.

 

Benefits of serverless architectures

  • No-ops: no run time to manage.
  • Free scale: scales based on utilization.
  • Cost: you pay for utilization.

Sample serverless providers

When to use the 3 Factor app?

  • Multiple subsystems that need to subscribe to the same events.
  • Low latency events.
  • Complex event processing.
  • High volume, velocity data.

Benefits

  • Producers and consumers are decoupled.
  • No point-to point-integrations.
  • Consumers can respond to events immediately as they arrive.
  • Highly scalable and distributed.
  • Subsystems have independent views of the event stream.

Challenges

  • Guaranteed event delivery.
  • Processing events in order.
  • Processing events exactly once.
  • Latency related to initial serverless start up time.
The five key phases of software development.

Resources We Like

Tip of the Week

  • Keep your email address private in your GitHub repo’s git log by setting your email address to github_username@users.noreply.github.com like git config user.email janedoe@users.noreply.github.com. (GitHub)
  • Darknet Diaries: True stories from the dark side of the Internet (darknetdiaries.com)
  • ARM Template Viewer for VS Code displays a graphical preview of Azure Resource Manager (ARM) templates. (marketplace.visualstudio.com)
  • WSL Support Framework for IntelliJ and RubyMine (plugins.jetbrains.com)
    • Visual Studio Code Remote – WSL extension lets you use the Windows Subsystem for Linux as your development environment within VS Code. (code.visualstudio.com)
  • What is Azure Data Studio? (docs.microsoft.com)
  • The DevOps Handbook is available on Audible! (AudibleAmazon)
Direct download: coding-blocks-episode-117.mp3
Category:Software Development -- posted at: 10:50pm EDT

We discuss the second factor of Hasura’s 3factor app, Reliable Eventing, as Allen says he still _surfs_ the Internet (but really, does he?), it’s never too late for pizza according to Joe, and Michael wants to un-hear things.

This episode’s full show notes can be found at https://www.codingblocks.net/episode116, just in case you’re using your podcast player to read this.

Sponsors

Survey Says …

What's the first thing you do when picking up a new technology or stack?

 

News

  • Thank you to everyone that left us a review:
    • iTunes: !theBestCoder, guacamoly, Fishslider
    • Stitcher: SpottieDog
  • We have photographic evidence that we were in the same room with Beej from Complete Developer at Atlanta Code Camp. 

The Second Factor – Reliable Eventing

  • Don’t allow for mutable state. Get rid of in memory state manipulation in APIs.
  • Persist everything in atomic events.
  • The event system should have the following characteristics:
    • Atomic – the entire operation must succeed and be isolated from other operations.
    • Reliable – events should be delivered to subscribers at least once.

Comparing the 3factor app Eventing to Traditional Transactions

Traditional application 3factor application
Request is issued, data loaded from various storage areas, apply business logic, and finally commit the data to storage. Request is issued and all events are stored individually.
Avoid using async features because it’s difficult to rollback when there are problems. Due to the use of the event system, async operations are much easier to implement.
Have to implement custom recovery logic to rewind the business logic. Recovery logic isn’t required since the events are atomic.

Benefits of an Immutable Event Log

  • Primary benefit is simplicity when dealing with recovery. There’s no custom business logic because all the event data is available for replayability.
  • Due to the nature of persisting the individual event data, you have a built in audit trail, without the need for additional logging.
  • Replicating the application is as simple as taking the events and replaying the business logic on top of them.

Downsides of the Immutable Event Log

  • Information isn’t (instantly) queryable, not taking into account snapshotting.
    • CQRS (command query responsibility segregation) helps to answer this particular problem.
  • Forcing event sourcing on every part of the system introduces significant complexity where it may not be needed.
  • For evolving applications, changing business needs require changes to the event schema and this can become very complex and difficult to maintain.
    • Upcasting: converting an event record on the fly to reflect a newer schema. Problem with this is you’ve now defeated the purpose of immutable events.
    • Lazy upcasting is evolving the event records over time, but that means you’re now maintaining code that knows how to understand each version of the event records in the system, making it very difficult to maintain.
    • Converting the entire set of data any time a schema needs to change. Keeps things in sync but at a potentially large cost of taking the hit to update everything.
  • Considerations of event granularity, i.e. how many isolated events are too much and how few are not enough?
    • Too many and there won’t be enough information attached to the event to be meaningful and useful.
    • Too few and you take a major hit on serialization/deserialization and you run the risk of not having any domain value.
    • So what’s the best granularity? Keep the events closely tied to the DDD intent.
  • Fixing bugs in the system may be quite a bit more difficult than a simple update query in a database because events are supposed to be immutable.

Resources We Like

Tip of the Week

  • Use docker system to manage your Docker environment.
    • Use docker system df to see the the disk usage.
    • Use docker system prune to clean up your environment.
  • How To View Clipboard History On Windows 10 (AddictiveTips.com)
  • Use docker-compose down -v to also remove the volumes when stopping your containers.
  • Intel 660p M.2 2TB NVMe PCIe SSD (Amazon)
  • Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems (Amazon)
Direct download: coding-blocks-episode-116.mp3
Category:Software Development -- posted at: 10:53pm EDT

We begin to twitch as we review the first factor of Hasura’s 3factor app, Realtime GraphQL, while Allen gets distrac … SQUIRREL!, Michael might own some bell bottoms, and Joe is stuck with cobalt.

If you’re reading these notes via your podcast app, you can find this episode’s full show notes and join in on the conversation at https://www.codingblocks.net/episode115.

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
  • O’Reilly Software Architecture Conference – Microservices, domain-driven design, and more. The O’Reilly Software Architecture Conference covers the skills and tools every software architect needs. Use the code BLOCKS during registration to get 20% off of most passes.
  • Educative.io – Level up your coding skills, quickly and efficiently. Visit educative.io/codingblocks to get 20% off any course.

Survey Says …

Would you be interested in doing a Coding Blocks Fantasy Football League?

Take the survey here: https://www.codingblocks.net/episode115.

News

  • To everyone that took a moment to leave us a review, thank you. We really appreciate it.
    • iTunes: Zj, Who farted? Not me., Markus Johansson, this jus10, siftycat, Runs-With-Scissors
    • Stitcher: wuddadid, unclescooter
  • Zach Ingbretsen gives us a Vim tutorial: RAW Vim Workshop/Tutorial (YouTube)

3factor app and the First Factor

3factor app

  • The 3factor app is a modern architecture for full stack applications, described by the folks at Hasura.
  • High feature velocity and scalability from the start:
    • Real time GraphQL
    • Reliable eventing
    • Async serverless
  • Kinda boils down to …
    • Have an API gateway (for them, GraphQL).
    • Store state in a (most likely distributed) store.
    • Have services interact with state via an event system.
  • Versus how did we used to do things using a REST API for each individual entity.
    • Let’s be honest though. We probably created a single very specialized REST API for a particular page all in the name of performance. But it was only used for that page.
  • Related technologies:
    • Web Sockets
    • Serverless
    • Lambda / Kappa – Types Streaming architectures
    • Event based architectures
    • Microservices

Factor 1 – Realtime GraphQL

Use Realtime GraphQL as the Data API Layer
  • Must be low-latency.
    • Less than 100 ms is ideal.
  • Must support subscriptions.
    • Allows the application to consume information from the GraphQL API in real-time.
Some Comparisons to Typical Backend API Calls
Traditional application 3factor application
Uses REST calls. Uses GraphQL API.
May require multiple calls to retrieve all data (customer, order, order details) – OR a complex purpose built call that will return all three in one call. Uses GraphQL query to return data needed in a single call defined by the caller.
Uses something like Swagger to generate API documentation. GraphQL will auto-generate entire schema and related documents.
For realtime you’ll set up WebSocket based APIs. Use GraphQL’s native subscriptions.
Continuously poll backend for updates. Use GraphQL’s event based subscriptions to receive updates.
Major Benefits of GraphQL
  • Massively accelerates front-end development speed because developers can get the data they want without any need to build additional APIs.
  • GraphQL APIs are strongly typed.
  • Don’t need to maintain additional documenting tools. Using a UI like GraphiQL, you can explore data by writing queries with an Intellisense like auto-complete experience.
  • Realtime built in natively.
  • Prevents over-fetching. Sorta. To the client, yes. Not necessarily so though on the server side.
A Little More About GraphQL
  • GraphQL is a Query Language for your API.
  • It isn’t tied to any particular database or storage engine.
  • It’s backed by your existing code and data.
  • Queries are all about asking for specific fields on objects.
  • The shape of your query will match the shape of the results.
  • Queries allow for traversing relationships, so you can get all the data you need in a single request.
    • Every field and nested object has its own set of arguments that can be passed.
      • Many types are supported, including enums.
  • Aliases
    • GraphQL has the ability to alias fields to return multiple results of the same type but with different return names (think of aliasing tables in a database query).
  • Fragments
    • Fragments allow you to save a set of query fields to retrieve, allowing you to later reuse those fragments in simpler queries. This allows you to create complex queries with a much smaller syntax.
    • There’s even the ability to use variables within the fragments for further queries requiring more flexibility.
  • Operations
    • Three types of operations are supported: query, mutation, and subscription.
    • Providing an operation name is not required, except for multi-operation documents, but is recommended to aid debugging and server side logging.
  • Variables
    • Queries are typically dynamic by way of variables.
    • Supported variable types are scalars, enums, and input object types.
      • Input object types must map to server defined objects.
    • Can be optional or required.
    • Default values are supported.
    • Using variables, you can shape the results of a query.
  • Mutations
    • Mutations allow for modifying data.
    • Nesting objects allows you to return data after the mutation occurs,
    • Mutations, unlike queries, run sequentially, meaning mutation1 will finish before mutation2 runs.
      • In contrast, queries run in parallel.
  • Meta fields
    • GraphQL also provides meta fields that you can use to inspect the schema that are part of the introspection system.
    • These meta fields are preceded by a double underscore, like __schema or __typename.
  • GraphQL schema language
    • Objects are the building blocks of a schema.
    • Fields are properties that are available on the object.
    • Field return types are defined as well – scalar, enum or objects.
      • Scalar types: Int, Float, String Boolean, ID (special use case), or User Defined – must specify serializer, deserializer and validator.
    • Fields can also be defined as non-nullable with an exclamation after the type like String!.
      • This can be done on array types as well after the square brackets to indicate that an array will always be returned, with zero or more elements, like [String]!.
    • Each field can have zero or more arguments and those arguments can have default values.
    • Lists are supported by using square brackets.
    • GraphQL’s type system supports interfaces.
    • Complex objects can also be passed as input types, however, they are defined as input rather than type.

Resources We Like

Tip of the Week

  • From Google’s Engineering Practices documentation: How to do a code review (GitHub.io).
    • This is part of the larger Google Engineering Practices Documentation (GitHub.io).
  • Use CTRL+SHIFT+V to access Visual Studio’s Clipboard Ring.
  • Take control of your tab usage in your browser with Workona.
  • Theme your Chrome DevTools!
Direct download: coding-blocks-episode-115.mp3
Category:Software Development -- posted at: 10:10pm EDT

We learn how to apply the concepts of The Pragmatic Programmer to teams while Michael uses his advertisement voice, Joe has a list, and Allen doesn't want anyone up in his Wheaties.

Direct download: coding-blocks-episode-114.mp3
Category:Software Development -- posted at: 8:01pm EDT

After 112 episodes, Michael can’t introduce the show, Allen pronounces it “ma-meee”, and don’t make Joe run your janky tests as The Pragmatic Programmer teaches us how we should use exceptions and program deliberately.

How are you reading this? If you answered via your podcast player, you can find this episode’s full show notes and join the conversation at https://www.codingblocks.net/episode113.

 

Sponsors

  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.

Survey Says …

When you want to bring in a new technology or take a new approach when implementing something new or add to the tech stack, do you ...?

Take the survey here:
https://www.codingblocks.net/episode113

 

News

  • Thank you for taking a moment out of your day to leave us a review.
    • iTunes: MatteKarla, WinnerOfTheRaceCondition, michael_mancuso
    • Stitcher: rundevcycle, Canmichaelpronouncethis, WinnerOfTheRaceCondition, C_Flat_Fella, UncleBobsNephew, alexUnique
  • Autonomous ErgoChair 2 Review (YouTube)
  • Come see us Saturday, September 14, 2019 at the Atlanta Code Camp 2019 (atlantacodecamp.com)
  • Are they cakes, cookies, or biscuits? (Wikipedia)

Intentional Code

When to use Exceptions

  • In an earlier chapter, Dead Programs Tell No Lies, the book recommends:
    • Checking for every possible error.
    • Favor crashing your program over running into an inconsistent state.
  • This can get really ugly! Especially if you believe in the “one return at the bottom” methodology for your methods.
  • You can accomplish the same thing by just catching an exception for a block of code, and throwing your own with additional information.
  • This is nice, but it brings up the question? When should you return a failed status, and when should you throw an exception?
  • Do you tend to throw more exceptions in one layer more than another, such as throwing more in your C# layer than your JS layer?
  • The authors advise throwing exceptions for unexpected events.
  • Ask yourself, will the code still work if I remove the exception handlers? If you answered “no”, then maybe your throwing exceptions for non-exceptional circumstances.
Tip 34
  • Use exceptions for exceptional problems

Exceptions vs Error Handling

  • Should you throw an exception if you try to open a file, and it doesn’t exist?
    • If it should be there, i.e. a config, yes, throw the exception.
    • If it might be OK for it not to be there, i.e. you’re polling for a file to be created, then no, you should handle the error condition.
  • Is it dangerous to rely on implicit exception throwing, i.e. opening a file that isn’t there?
    • On the one hand, it’s cleaner without checking for the exceptions, but there’s no signaling to your co-coders that you did this intentionally.
    • Exceptions are a kind of coupling because they break the normal input/output contract.
  • Some languages / frameworks allow you to register error handlers that are outside the flow of the normal problem.
    • This is great for certain types of problems, like serialization problems, particularly when there is a prescribed flow, such as error pages, serialization, or SSL errors.

Programming by Coincidence

  • What does it mean to “program by coincidence”?
    • Getting lured into a false sense of security and then getting hit by what you were trying to avoid.
  • Avoid programming by coincidence and instead program deliberately. Don’t rely on being lucky.
  • Writing code and seeing that it works without fully understanding why is how you program by coincidence.
    • This really becomes a problem when something goes wrong and you can’t figure out why because you never knew why it worked to start off with.
  • We may not be innocent …
    • What if you write code that adheres to some other code that was done in error … if that code is eventually fixed, your own code may fail.
  • So if it’s working, why would you touch it?
    • It might not actually be working …
      • Maybe it doesn’t work with a different resolution.
      • Undocumented code might change, thus changing your “luck”.
      • Unnecessary method calls slow down the code.
      • Those extra calls increase the risk of bugs.
  • Write code that others implement with well documented code that adheres to a contract.

Accidents of Context

  • You can also make the mistake that you assume certain things are a given, such as that there’s a UI or that there’s a given language.

Implicit Assumptions

  • Don’t assume something, prove it.
  • Assumptions that aren’t based on fact become a major sticking point in many cases.
Tip 44
  • Don’t Program by Coincidence

How to Program Deliberately

  • Always be aware of what you’re doing.
  • Don’t code blindfolded, Make sure you understand what you’re programming in, both business domain related and programming language.
  • Code from a plan.
  • Rely on reliable things. Don’t code based on assumptions.
  • Document assumptions.
  • Test your code _and_ your assumptions.
  • Prioritize and spend time on the most important aspects first.
  • Don’t let old code dictate new code. Be prepared to refactor if necessary.

Resources We Like

  • The Pragmatic Programmer by Andrew Hunt, David Thomas (Amazon)
  • The Pragmatic Bookshelf (pragprog.com)
  • Oh mother… | Family Feud (YouTube)
    • OMG! It’s here! Oh mother… the ON-AIR VERSION!!! | Family Feud (YouTube)
  • Thunder Talks (episode 87)
  • Spotify engineering culture (part 1) (labs.spotify.com)

Tip of the Week

Direct download: coding-blocks-episode-113.mp3
Category:Software Development -- posted at: 8:01pm EDT

We continue our dive into The Pragmatic Programmer and debate when is it text manipulation vs code generation as Joe can’t read his bill, Michael makes a painful recommendation, and Allen’s gaming lives up to Southern expectations.

In case you’re reading these show notes via your podcast player, you can find this episode’s full show notes at https://www.codingblocks.net/episode112 and join in on the conversation.

Sponsors

  • Clubhouse – The first project management platform for software development that brings everyone on every team together to build better products. Sign up for two free months of Clubhouse by visiting clubhouse.io/codingblocks.
  • Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.

Survey Says …

What native language are you most interested in?

Take the survey here:
https://www.codingblocks.net/episode112

News

  • We really appreciate every review we get. Thank you for taking the time.
    • iTunes: AsIRoseOneMorn, MrBramme, MP7373, tbone189, BernieF1982, Davidwrpayne, mldennison
    • Stitcher: Ben T, moreginger, Tomski, Java Joe

Blurring the Text Manipulation Line

Text Manipulation

  • Programmers manipulate text the same way woodworkers shape wood.
    • Text manipulation tools are like routers: noisy, messy, brutish.
  • You can use text manipulation tools to trim the data into shape.
    • Once you master them, they can provide an impressive amount of finesse.
  • Alternative is to build a more polished tool, check it in, test it, etc.
Tip 28
  • Learn a Text Manipulation Language.

Code Generators

  • When you have a repetitive task, why not generate it?
  • The generated code takes away complexity and reduces errors.
  • And it’s reuse has little to no additional cost.
Tip 29
  • Write Code That Writes Code.

There are two types of code generators:

  1. Passive code generators are run once (scaffolding).
  2. Active code generators are used each time they are required.

Passive code generators save typing by automating…

  • New files from a template, i.e. the “File -> New” experience.
  • One off conversions (one language to another).
    • These don’t need to be completely perfect.
  • Producing lookup tables and other resources that are expensive to compute.
  • Full-fledged source file.

You get to pick how accurate you want the generators to be. Maybe it writes 80% of the code for you and you do the rest by hand.

Active code generators

  • Active code generators are necessary if you want to adhere to the DRY principle.
    • This form is not considered duplication because it’s generated as needed by taking a single representation and converting it to all of the forms you need.
  • Great for system boundaries (think databases or web services).
  • Great for keeping things in sync.
  • Recommend creating your own parser.

Why generate when you can just … program?

  • Scaffolding, so it’s a starting off point that you edit.
  • Performance.
  • System boundaries.
  • Some uses work best when built into your build pipeline.
    • Think about automatically generating code to match your DB at compile time, like a T4 generator for Entity Framework.
  • It’s often easier to express the code to be generated in a language neutral representation so that it can be output in multiple languages.
    • Something like System.CodeDom comes to mind.
  • These generators don’t need to be complex.
  • And the output doesn’t always need to be code. It could be XML, JSON, etc.

Resources We Like

Tip of the Week

  • Within Visual Studio Code, after you use CTRL+F to find some text in your current document, you can take it a step further by pressing ALT+ENTER to enter into block selection/edit mode.
  • Turn learning Vi into a game with VIM Adventures. (vim-adventures.com)
  • Never confuse forward Slash with back Slash again.
Direct download: coding-blocks-episode-112.mp3
Category:Software Development -- posted at: 8:01pm EDT

It's about time we finally learn how to debug by taking take a page from The Pragmatic Programmer playbook, while Michael replaces a developer's cheat sheet, Joe judges the H-O-R-S-E competition for VI, and Allen stabs you in the front.

Direct download: coding-blocks-episode-111.mp3
Category:Software Development -- posted at: 10:21pm EDT

We dig into the details of the basic tools while continuing our journey into The Pragmatic Programmer while Joe programs by coincidence, Michael can't pronounce numbers, and Allen makes a point.

Direct download: coding-blocks-episode-110.mp3
Category:Software Development -- posted at: 8:20pm EDT

Joe is distracted by all of the announcements from E3, Allen is on the run from the Feebs, and Michael counts debugging as coding. All this and more as we continue discussing The Pragmatic Programmer.

Direct download: coding-blocks-episode-109.mp3
Category:Software Development -- posted at: 9:15pm EDT

The Pragmatic Programmer teaches us how to use tracer bullets versus prototyping while Joe doesn't know who won the Game of Thrones, Allen thought he knew about road numbers, and Michael thinks 475 is four letters.

Direct download: coding-blocks-episode-108.mp3
Category:Software Development -- posted at: 9:24pm EDT

The dad jokes are back as we learn about orthogonal code while JZ (the 8-mile guy) has spaghetti on him, Michael's Harry Potter references fail, and Allen voice goes up a couple octaves.

Direct download: coding-blocks-episode-107.mp3
Category:Software Development -- posted at: 8:01pm EDT

We take a deep dive into the various forms of duplication and jump aboard the complain train as Allen complains about Confluent's documentation, Michael complains about Docker's documentation, and Joe complains about curl.

Direct download: coding-blocks-episode-106.mp3
Category:Software Development -- posted at: 11:01pm EDT

We begin our journey into the wisdom of The Pragmatic Programmer, which as Joe puts it, it's less about type-y type-y and more about think-y think-y, while Allen is not quite as pessimistic as Joe, and Michael can't wait to say his smart words.

Direct download: coding-blocks-episode-105.mp3
Category:Software Development -- posted at: 8:01pm EDT

We dig into the nitty gritty details of what a Progressive Web App (PWA) is and why you should care, while Allen isn't sure if he is recording, Michael was the only one prepared to talk about Flo and the Progressive Price Gun, and Joe has to get his headphones.

Direct download: coding-blocks-episode-104.mp3
Category:Software Development -- posted at: 8:01pm EDT

The Date deep dive continues as we focus in on C# and JavaScript, while Michael reminisces about the fluorescent crayons, Joe needs a new tip of the week, and Allen confuses time zones.

Direct download: coding-blocks-episode-103.mp3
Category:Software Development -- posted at: 10:26pm EDT

We take a deep dive into understanding why all Date-s are not created equal while learning that Joe is not a fan of months, King Kong has nothing on Allen, and Michael still uses GETDATE. Oops.

Direct download: coding-blocks-episode-102.mp3
Category:Software Development -- posted at: 11:35pm EDT

After being asked to quiet down, our friend, John Stone, joins us again as we move the conversation to the nearest cubicle while Michael reminds us of Bing, Joe regrets getting a cellphone, and Allen's accent might surprise you.

Direct download: coding-blocks-episode-101.mp3
Category:Software Development -- posted at: 8:23pm EDT

We gather around the water cooler to celebrate our 100th episode with our friend John Stone for some random developer discussions as Michael goes off script, Joe needs his techno while coding, and Allen sings some sweet sounds.

Direct download: coding-blocks-episode-100.mp3
Category:Software Development -- posted at: 8:01pm EDT

We learn all about JAMstack in real-time as Michael lowers the bar with new jokes, Allen submits a pull request, and Joe still owes us a tattoo.

Direct download: coding-blocks-episode-99.mp3
Category:Software Development -- posted at: 8:01pm EDT

We dig into heaps and tries as Allen gives us an up to date movie review while Joe and Michael compare how the bands measure up.

Direct download: coding-blocks-episode-98.mp3
Category:Software Development -- posted at: 1:16am EDT

We ring in 2019 with a discussion of various trees as Allen questions when should you abstract while Michael and Joe introduce us to the Groot Tree.

Direct download: coding-blocks-episode-97.mp3
Category:Software Development -- posted at: 7:40pm EDT

Just in time to help you spread some cheer this holiday season, the dad jokes are back as we dig into the details of hash tables and dictionaries.

Direct download: coding-blocks-episode-96.mp3
Category:Software Development -- posted at: 10:58pm EDT

We continue our deep dive into data structures, this time focusing in on arrays and array-like types as Allen gives Shania Twain some singing competition, Joe is going to owe us another tattoo, and wait ... when does Michael think C++ was invented?

Direct download: coding-blocks-episode-95.mp3
Category:Software Development -- posted at: 10:55pm EDT

We begin our journey into data structures by taking a deep dive into primitives while Allen makes Michael blush and Joe crashes his browser.

Direct download: coding-blocks-episode-94.mp3
Category:Software Development -- posted at: 10:10pm EDT

With the holiday season soon approaching, we address the most important requirements list of all ... our wish lists as Joe has to disclose a cheese powder incident, Michael hopes his Bitcoin gains some value, and Allen researches his purchases to the extreme.

Direct download: coding-blocks-episode-93.mp3
Category:Software Development -- posted at: 9:43pm EDT

This is a special collaboration featuring John Calloway of The Six Figure Developer and our own Allen Underwood. The episode was recorded out at Microsoft Ignite 2018, and features talk about the future of cloudy infrastructures with a particular focus on Azure Functions and Azure Cosmos DB.

Direct download: coding-blocks-episode-92.mp3
Category:Software Development -- posted at: 8:12pm EDT

We continue our dive into how to learn things while Michael's voice sounds an awful lot like Joe's, Joe says it's a square, and Allen says it's as triangle ... oh, and Google Feud is back!

Direct download: coding-blocks-episode-91.mp3
Category:Software Development -- posted at: 9:14pm EDT

We have some fun with our names, get ahead of ourselves during Survey Says, and vet Michael's tip on-air as we take a deep dive into comparing some popular Git workflows and when should we use which.

Direct download: coding-blocks-episode-90.mp3
Category:Software Development -- posted at: 8:51pm EDT

We wrap up our conversation on complexity and play some more over/under as Allen thinks learning is backwards, Michael doesn't write clean code, and Joe brings his dog to the discussion.

Direct download: coding-blocks-episode-89.mp3
Category:Software Development -- posted at: 8:59pm EDT

We continue our dive into Rob Conery's The Imposter's Handbook as Allen is Allen, Joe is Michael, Michael is Joe.

Direct download: coding-blocks-episode-88.mp3
Category:Software Development -- posted at: 8:51pm EDT

Joe's voice sounds funny, Allen has a theme, and Michael pours one out for Media Play as Michael's and Allen's impersonation of Joe is on point (#NailedIt).

Direct download: coding-blocks-episode-87.mp3
Category:Software Development -- posted at: 9:50pm EDT

We meet up around the water cooler for a quick round of lightning talks as Allen and Michael sing FizzBuzz while Joe passes the caching buck.

Direct download: coding-blocks-episode-86.mp3
Category:Software Development -- posted at: 10:52pm EDT

We continue digging into Rob Conery's The Imposter's Handbook as Joe explains Florida time, Allen likes greedy algorithms, and Michael shares his geography knowledge.

Direct download: coding-blocks-episode-85.mp3
Category:Software Development -- posted at: 11:40pm EDT

It's time we discuss algorithms we all need to know as we continue diving into Rob Conery's The Imposter's Handbook while Michael will read anything, Allen questions Greenland's name, and Joe talks wormholes.

Direct download: coding-blocks-episode-84.mp3
Category:Software Development -- posted at: 11:34pm EDT

We're talking databases, indexes, search engines, and why they're basically microwaves in this episode while Joe wears a polo, Allen's quick brown fox jumps over whatever, and Michael gives out fake URLs.

Direct download: coding-blocks-episode-83.mp3
Category:Software Development -- posted at: 9:20pm EDT

Inspired by Rob Conery's The Imposter's Handbook, we take an introspective look at ourselves to find two weaknesses and one strength while Allen shows off his vocal prowess in song, Joe needs a list, and Michael is a dash.

Direct download: coding-blocks-episode-82.mp3
Category:Software Development -- posted at: 1:49pm EDT

This episode we talk complexity theory while digging into Rob Conery's The Imposter's Handbook as Allen channels his inner Austin Powers, Michael finds linearly to complex to pronounce, and Joe ruins Batman for the rest of us.

Direct download: coding-blocks-episode-81.mp3
Category:Software Development -- posted at: 10:09pm EDT

This episode we're talking about server naming conventions, confusing command line arguments, and how high we can get our voices. Huge thanks to the NSA and the freedom of information act for making this episode possible.

Direct download: codingblocks-episode-080.mp3
Category:Software Development -- posted at: 10:07pm EDT

This week we're talking about some software anti-patterns, and the kinds of maintenance problems that arise from them. There are some anti-patterns we're very familiar with, and some we aren't so familiar with.

Direct download: codingblocks-episode-079-64.mp3
Category:Software Development -- posted at: 8:00pm EDT

It's time for more cowbell as we have a special guest in the studio, Will Madison (@IAmWillMadison), join us as Allen finally gets tripped up trying to pronounce a name, Joe teaches us the value of practice, and Michael evacuates in a rainbow colored straight line.

Direct download: coding-blocks-episode-78.mp3
Category:Software Development -- posted at: 10:49pm EDT

We're back with our last deep dive into Robert C. Martin's latest book, Clean Architecture, while Allen suffers from sleep deprivation, Joe shows us his dance moves, and Michael's mind is blown on how to unit test.

Direct download: coding-blocks-episode-77.mp3
Category:Software Development -- posted at: 10:15pm EDT

It's time for another deep dive into Robert C. Martin's Clean Architecture as Joe puts us on the spot, Allen has a new mission, and Michael shares his Easter eggs.

Direct download: coding-blocks-episode-76.mp3
Category:Software Development -- posted at: 10:32pm EDT

Michael can't tell higher from lower, Allen puts his views where he wants them, and Joe snaps it to a Slim Jim as we discuss how to make our architectures scream while discussing Robert C. Martin's Clean Architecture.

Direct download: coding-blocks-episode-75.mp3
Category:Software Development -- posted at: 7:08pm EDT

It's time for another deep dive into Robert C. Martin's Clean Architecture as Allen warns us about driving in front of him, Joe tries to describe a diagram again, and Michael can't understand the survey results.

Direct download: coding-blocks-episode-74.mp3
Category:Software Development -- posted at: 7:56pm EDT

Joe drinks too much coffee, Allen spits his coffee out, and Michael feels vindicated as the discussions about Robert C. Martin's latest book, Clean Architecture, continues.

Direct download: coding-blocks-episode-73.mp3
Category:Software Development -- posted at: 9:59pm EDT

Joe baits Michael, Michael takes the bait, and Allen lets it happen, as Uncle Bob explains how we can quantify the coupling between our components from his latest book, Clean Architecture.

Direct download: coding-blocks-episode-72.mp3
Category:Software Development -- posted at: 8:28pm EDT

Joe is down with OCP, Michael argues DRY, and Allen deletes our show notes as we dig into Components and Component Cohesion from Robert C. Martin's (aka Uncle Bob) Clean Architecture.

Direct download: coding-blocks-episode-71.mp3
Category:Software Development -- posted at: 9:40pm EDT

We're back with another installment as we challenge ourselves to compare how we'd each spend $2,500 on developer gear as Allen waxes on about the loudest quiet keyboard, Joe teaches us how cheese is made, and Michael puts some neon on his computer.

Direct download: coding-blocks-episode-70.mp3
Category:Software Development -- posted at: 11:52pm EDT

Michael forgets what his favorite part of the show is, Joe makes us wait to learn what his favorite part is, and Allen pronounces it "pair-a-dig-'ems" as we continue our deep dive into Uncle Bob's latest book: Clean Architecture.

Direct download: coding-blocks-episode-69.mp3
Category:Software Development -- posted at: 9:50pm EDT

Joe learns of our harebrained idea, Michael learns of Eisenhower's matrix, and Allen explains polyfills as we begin our dive into Uncle Bob's latest book, Clean Architecture.

Direct download: coding-blocks-episode-68.mp3
Category:Software Development -- posted at: 9:33pm EDT

Allen brings the dad jokes, Michael unplugs, and Joe gets a second wind as we discuss the anti-patterns found in object oriented programming.

Direct download: coding-blocks-episode-67.mp3
Category:Software Development -- posted at: 8:03pm EDT

It's time for another episode as Joe wants to choke a developer, Michael scraps his new social networking platform, and Allen finally learns of dad jokes while we continuing the anti-pattern conversation.

Direct download: coding-blocks-episode-66.mp3
Category:Software Development -- posted at: 8:01pm EDT

We've discussed design patterns too much. Now it's time for some discussion about anti-patterns as Joe has dark visions about robots, Allen has to take sensitivity training, and Michael picks Arial.

Direct download: coding-blocks-episode-65.mp3
Category:Software Development -- posted at: 6:05pm EDT

More Domain Driven Design talk this week: Supple Design, Declarative(ish?) Programming, and Ohio Envy.

Direct download: coding-blocks-episode-64.mp3
Category:Software Development -- posted at: 6:19pm EDT

Know what Joe and Waldo have in common? We can't find either, as this week, it's just Allen and Michael to continue the dive into Domain Driven Design.

Direct download: coding-blocks-episode-63.mp3
Category:Software Development -- posted at: 10:06pm EDT

We're not saying that Michael is Carmen Sandiego. We're just saying that nobody has ever seen them in a room together. And this week, we don't know where in the world either are, as Allen and Joe continue the Domain Driven Design discussion without Michael. Nor Carmen.

Direct download: coding-blocks-episode-62.mp3
Category:Software Development -- posted at: 10:16pm EDT

Stitcher is back and so are we as Michael proves he doesn't have a career as a rapper, Allen can't type on his phone, and Joe tweets with famous authors as we continue our dive into Domain Driven Design talking about aggregate roots, factories, and repositories.

Direct download: coding-blocks-episode-61.mp3
Category:Software Development -- posted at: 11:10pm EDT

We continue our Domain Driven Design conversation this week as Allen is indecisive, Michael decides for him, and Joe can't handle the night life.

Direct download: coding-blocks-episode-60.mp3
Category:Software Development -- posted at: 12:21am EDT

We're back with another exciting episode as Michael questions Hollywood, Allen dreams of his Hackintosh, and Joe is surrounded by Star Wars as we talk about how to jumpstart your next app with Michael Crump (@mbcrump) and Clint Rutkas (@clintrutkas).

Direct download: coding-blocks-episode-59.mp3
Category:Software Development -- posted at: 1:39pm EDT

This week, Michael asks his customers about their anemic domain model, Allen talks in front of people, and Joe plays Rocket League as we begin our dive into understanding domain driven design.

Direct download: coding-blocks-episode-58.mp3
Category:Software Development -- posted at: 8:43pm EDT

This week we talk about all of the bad things we've done while making software. The good, the bad, ... oh wait, it compiles, never mind.

Direct download: coding-blocks-episode-57.mp3
Category:Software Development -- posted at: 11:12pm EDT

We're back with another deep dive into the infamous book Clean Code by Uncle Bob as Joe alters columns, Michael misreads things, and Allen has a positive customer service experience.

Direct download: coding-blocks-episode-56.mp3
Category:Software Development -- posted at: 7:54pm EDT

This week Allen is troubled by circles, Michael talks like a game show host, and Joe announces it's twins as we continue our deep dive into the classic Clean Code book by Robert C. Martin.

Direct download: coding-blocks-episode-55.mp3
Category:Software Development -- posted at: 4:58pm EDT

When and why should you write unit tests, and just how important are they? Take a listen and see what YOU think.

For the full show notes visit:
http://www.codingblocks.net/episode54

Direct download: coding-blocks-episode-054.mp3
Category:Software Development -- posted at: 7:02pm EDT

Clean Code - Integrating with Third Party Libraries the Right Way

For the full show notes visit:

http://www.codingblocks.net/episode53

Direct download: coding-blocks-episode-053.mp3
Category:general -- posted at: 4:37pm EDT

This week, we continue our Clean Code discussion as we dive into the joys and pains of error handing.

Direct download: coding-blocks-episode-52.mp3
Category:Software Development -- posted at: 9:30pm EDT

Direct download: coding-blocks-episode-051.mp3
Category:general -- posted at: 10:06pm EDT

Clean Code - Formatting Matters

For the full show notes visit:
http://www.codingblocks.net/episode50

News

  • Husain and Mike - Check your email!
  • Shout out to AngryZoot! We just haven’t mentioned her in a while, and she’s awesome - and does martial arts
  • Cynical Developer - James Studdart - Cake, XAML, React (Zac Braddy)
  • Mark McDow - Winner of the O’Reilly Software Architecture Convention - $1700
  • Maurizio Pozzobon - Code Maid retraction
  • O’Reilly discount code - 50% off print, 40% off e-books! (Soft Skills - JavaScript: The Good Parts)

So - you should probably follow us on twitter, or join the mailing list!

Michael attended DevFest 2016 - Google Developer Group
http://www.gdgatl.xyz/

Secret Back Door in Some U.S. Phones Sent Data to China, Analysts Say
http://www.nytimes.com/2016/11/16/us/politics/china-phones-software-security.html

Allen attended MVP Summit - amazing

Reply All - Pepe the Frog
https://gimletmedia.com/episode/77-the-grand-tapestry-of-pepe/

Want a Coding Blocks sticker?
Send us a Self-Addressed-Stamped-Envelope

Clean Code - Drawing!
Oddvar Tengesdal won a copy of Clean Code!

Programming Beyond Practices
http://shop.oreilly.com/product/0636920047391.do

Survey

[yop_poll id="26"]

Formatting

  • If your code is a mess, then people will assume that your attention to detail in how the app was coded is also a mess - perception
  • Teams should adopt formatting rules and follow them
  • Automated tools help with the process
  • “Code formatting is important”
  • Code formatting has a direct affect on maintainability and extensibility of code over time

Vertical Formatting

  • Try to keep max length around 500 lines long and smaller is better - FitNesse app is in this range
  • Tomcat and Ant - several thousand lines long and at least half are over 200
  • Newspaper metaphor - read it vertically - headlines at the top detail increases as we go down the page
  • Separate concepts with blank lines
  • Closely associated code should be grouped together so it’s dense
  • Concepts (methods) that are closely related should be grouped as closely together as possible to keep from hunting through files
  • Variable declarations should be as close to their usage as possible
  • If the methods are short, then the variable declarations should be at the top of the function!
  • Control variables for loop should be defined within the loop
  • Instance variables should be declared at the top of a class
  • When one function calls another, those should be close vertically in the file
  • Conceptual affinity - when methods do similar things or are named similarly, they should also appear close to each other
  • Vertical ordering of methods - the caller should be first, then the callee, and that method’s callee, etc…on down the page

New Survey
New Macbooks
- Death of Macbook Pro?
- The beginning of a new awesome era?

Horizontal Formatting

  • How wide should a line be?!
  • In the popular projects examined, it appeared that 40% of lines were between 20 and 60 characters
  • Another 30% of lines were less than 10 characters…
  • Author suggests that beyond 100-120 is careless
  • Put spaces on both sides of an assignment operator (equals sign)
  • Don’t put spaces between the function name and the parens
  • DO put spaces after individual arguments / parameters in a list - shows they are separate
  • Also use spacing to indicate the precedence of operations - think of spacing in math equations with several parentheses - author calls it out for order of precedence, I actually don’t like this one - I prefer grouping with parens
  • Lining up variable declarations, names, types - found that it was distracting to the “story” of the code….I agree
  • Hierarchically lining up code based on it’s scope - super important
  • Author would sometimes condense multiple lines into one (like a get; set;) eventually set it back for readability (breaking indentation)
  • What about for PRINT statements in SQL???
    while statements - indent the semicolon on the next line…otherwise they’re hidden
  • Follow the team’s formatting rules…don’t go vigilante
  • He threw in Uncle Bob’s formatting rules

Resources we Like

Clean Code
Clean Code

Tip of the Week

Direct download: coding-blocks-episode-050.mp3
Category:general -- posted at: 11:59pm EDT

This week, Michael fails geography, Allen introduces us to Croom, and Joe has to potty as we head into our third installment of the Clean Code series.

Direct download: coding-blocks-episode-49.mp3
Category:Software Development -- posted at: 8:04pm EDT

We continue talking our way through Clean Code, taking a deep look at the building blocks of programming in the quest to write the best functions. Oh, and everybody sings.

The original version of the show notes can be found at:
http://www.codingblocks.net/episode48

Direct download: coding-blocks-episode-048.mp3
Category:programming -- posted at: 8:40pm EDT

Clean Code - Writing Meaningful Names

In this episode, we take our first dive into the book Clean Code by Robert Martin and specifically we talk about writing meaningful names for all things code related.  You'll be amazed at how following some decent rules that you can start naming things that will help you and fellow coders understand your code at a glance.

Clean Code - Writing Meaningful Names

You can see the original show notes and put your own stamp on our survey here:
http://www.codingblocks.net/episode47

News

Samsung 960 Pro
http://www.anandtech.com/show/10698/samsung-announces-960-pro-and-960-evo-m2-pcie-ssds

SQL Server 2016 Columnstore for real time operational analytics
https://msdn.microsoft.com/en-us/library/dn817827.aspx

Krebs site taken off Akamai
http://www.zdnet.com/article/krebs-on-security-booted-off-akamai-network-after-ddos-attack-proves-pricey/

The best Android distribution is iOS?
Outlaw’s thoughts on various phone OS’s

Survey

[yop_poll id="23"]

Meaningful Names - Clean Code Chapter 2

“If a name requires a comment, then the name does not reveal its intent”

  • Write explicit code - naming variables and methods can reveal the entire intent of the code
  • Avoid using words that would be confusing like “List” as they refer to programming types and could be misleading : accountList should be accounts
  • Avoid using characters that look like numbers i and L or capital o
  • disinformative vs noninformative
    • noise words “data” “info” - noninformative
  • Types should almost never be in a name “table” “string” “object”
  • Names should be distinguished so a user can look at them and understand the differences
  • Use pronounceable names
  • Use searcheable names - longer names trump shorter names
  • Author’s pref - single letter names should only be used as local variables inside small methods - length of the name should correspond to the size of its scope
  • Avoid encoding names
  • Avoid Hungarian Notation with typing as part of the variable name - simply not needed nowadays
  • Stop prefixing member (instance) variables with m_ or _
  • Decorating Interfaces vs Classes with a prefix / suffix - opinion - he prefers
    • ClassImp or vs IType
  • Don’t force someone to map variable names in their mind - n = username…smart programmer vs professional programmer - clarity is king
  • Class names should be nouns - English 101 - NOT VERBS
  • Method names should be verbs
  • Use get, set, is - javabean standard
  • When constructors are overloaded, use static factory methods with explicit names - liked this one, possibly make the constructors private
  • Don’t get cute with naming by means of jokes (inside or well known)
  • Use consistent naming - Get, Set, Controller - makes it easier to understand and code various parts of an application
  • Avoid puns - add for a collection vs add for setting a value - two different meanings with the same name
  • Use technical names such as pattern names or CS terms in your names - other programmers will understand them better than the problem domain in some cases
  • Fall back to the problem domain for a name if there is no suitable technical name
  • Adding context to naming can clarify their use - prefixes can work but putting variables into classes may work out better

“Hardest thing about choosing good names is that it requires good descriptive skills and a shared cultural background”

Renaming things that don’t make sense as you work in code is a good thing.

Resources we Like

Clean Code

Clean Code by Robert C. Martin

Even though we’re giving our thoughts on the various ideas throughout the book, Clean Code has tons of excellent sample code that really helps drive the points home. We can’t recommend it enough - it’s probably one of the few books EVERY developer should read and revisit from time to time.
http://amzn.to/2cryvJR

Tip of the Week

Allen: Implementing OAuth in ASP.NET for a number of providers
http://www.oauthforaspnet.com/

Michael: Get out there! Go to conferences, meetups, do it all!
http://www.connect.tech/
https://www.atlantacodecamp.com/2016

Direct download: coding-blocks-episode-047-mono.mp3
Category:general -- posted at: 10:05pm EDT

Storing smaller subsets of data in a faster, closer memory can make astronomical differences in performance. This episode we're talking about the caching tools and techniques that application frameworks provide.

The original version of the shownotes can be found at:
http://www.codingblocks.net/episode46

Direct download: coding-blocks-episode-046.mp3
Category:Software Development -- posted at: 10:42pm EDT

Caching Overview and Hardware

In this episode we give a general overview of caching, where it's used, why it's used, and what the differences in hardware implementations mean in terms we can understand.  This will be foundational to understanding caching at a software level in an upcoming episode.  There's also something about the number 37 that may be the most important number to remember...ever...

Podcast News

You can see all the show notes in their original form by visiting:
http://www.codingblocks.net/episode45

Thanks for your patience, we had a couple of rough audio situations - and we appreciate you sticking with us!

iTunes Reviews
Hedgehog, Thiagoramos.ai, Btn1992, Jonajonlee, UndeadCodemonkey, zmckinnon, hillsidecruzr, Dibjibjub, ddurose

Stitcher Reviews
pchtsp, rafaelh, CK142, TheMiddleMan124, LocalJoost

Clean Code episodes coming soon + book giveaway - Stay Tuned!

Caching: Turtles all the way down

Turtles all the way down???
https://en.wikipedia.org/wiki/Turtles_all_the_way_down

  • Storing a subset of information for faster retrieval
  • The hit ratio dramatically increases as the cache size increases
  • Think about a simple web request…
  • Browser cache
  • DNS cache
  • ISP caching
  • CDN
  • Whatever your application is doing (redis, framework, database, etc)
  • PLUS whatever the various computers are doing

Why don’t we cache everything?

  • Fast is expensive!
  • Cache Invalidation is hard!

Caching at the hardware level

Interactive Cache Visualization
Interactive Cache Visualization

Latency Numbers Every Programmer Should Know
https://gist.github.com/jboner/2841832

Relative Memory Access Interactive Demo
http://www.overbyte.com.au/misc/Lesson3/CacheFun.html

Caching is a strategy that computers use going all the way down to the processor

L1

  • .5ns
  • As quick as a it gets, how long it takes light to travel 6"
  • Managed by the CPU itself, no assembly available!

L2

  • 7ns
  • 14 x slower than L1
  • L3 / L4 / Scratch etc

Main Memory

  • Have numbers for a “reference” and a 1mb sequential read
  • 100ns - 250,000ns
  • 14 - 35,714 x slower than L2
  • 200 - 500,000 x slower than L1

Network

  • Sending is quick, there are numbers for that
  • In general, a lot of variability here
    Same datacenter
  • 500,000 ns
  • 2 x slower than Main Memory
  • 1 million times slower than L1

SSD

  • Wait, network faster than the hd??? Yes, but no
  • 1mb sequential
  • 1 million ns
  • 2 x slower than Network
  • 2 million x slower than L1

Spinning Disk

  • Get your employer to get you an ssd!
  • 1mb sequential read
  • 20 million ns
  • 20 x slower than SSD
  • 40 million x slower than L1

Internet

  • Rough gauge of internet speeds
  • Highly variable (CDN + ISP caching, for example), but gives you a sense of scale
  • 150 million ns
  • 7.5 x slower than spinning disk
  • 300 million times slower than L1

In more relatable terms.

  • 1 second for L1 Cache
  • 5 days for memory
  • 11 days for data center
  • 23 days for SSD
  • 15 months for HD
  • Almost 10 years for internet!

Think about how those numbers cache

  • RAM / Application cache
  • Local Hard drive
  • Network storage
  • Cache Server
  • DB

Summary

Hope we gave you a good idea of the importance and scale of caching in computing at the hardware level

Things we didn’t talk about coming in a future episode:

  • Application / Software caching and caching algorithms

Resources we Like

Latency Numbers Every Programmer Should Know
https://gist.github.com/jboner/2841832

How L1 and L2 caching work
http://www.extremetech.com/extreme/188776-how-l1-and-l2-cpu-caches-work-and-why-theyre-an-essential-part-of-modern-chips

Relative Memory Access Interactive Demo
http://www.overbyte.com.au/misc/Lesson3/CacheFun.html

Miscellaneous

Michael’s Favorite Meetup Ever
The Atlanta JavaScript Meetup
http://www.meetup.com/AtlantaJavaScript/events/222696324/?a=cr1_grp&rv=cr1

Hacking Interviews with:
Nick Larsen - http://cultureofdevelopment.com/
Sam Lawrence - http://www.samelawrence.com/

Tip of the Week

Algorithms to Live By
Algorithms to Live By

Joe: Algorithms to Live By
There's something about the number 37%...
http://amzn.to/2aX1iJk

Michael: Use Sublime to replace \n with an actual new line by turning on RegEx search and replace. Or in Michael’s case, replace
with actual \n\t characters.
http://stackoverflow.com/questions/20515670/replace-n-with-actual-new-line-in-sublime-text

Allen: Collaborative Markdown Editor - What?!
http://www.hackmd.io

 

Direct download: coding-blocks-episode-045.mp3
Category:general -- posted at: 12:39am EDT

This week on Coding Blocks, Allen says www as best he can, Joe eats the microphone, and Michael does something crazy as we discuss Stack Overflow's Salary Calculator and our experiences in landing the job - what to do and what not to do.

Direct download: coding-blocks-episode-44.mp3
Category:general -- posted at: 1:09am EDT

This time we're talking about problems with nulls, stored procedures, and impostor syndrome.

Link to Episode 43’s Full Show Notes:
http://www.codingblocks.net/episode43

Direct download: coding-blocks-episode-043.mp3
Category:general -- posted at: 8:03pm EDT

Command, Repository and Mediator Design Patterns

In this episode we go back to the design pattern well that we've been away from for so long.  We cover the Command, Repository and Mediator design patterns.  It was hard for us to believe, but it's been almost a year since our last design patterns episode!!!  Come on in for fun, learning, and of course, our tips of the week.

See the original show notes at:
http://www.codingblocks.net/epsiode42

Leave us a review here:
http://www.codingblocks.net/review

News

Stitcher Reviews:

Spectre013, Christoffer, Genius, HAM3rtag, joe_recursion_joe, Gearhead2k, Manriquey2k, Mike North, AndrewM, MildManneredCalvin, Freeleeks

iTunes Reviews:

Sid Savara, J. Mair, tonicorb, Nmkel999, Eschwartz20, mochadwi, Banjammin, wisco_cmo, NewZeroRiot, Nate_the_DBA, Pauloispaulo

Joe’s chess game!

Joe on Hello Tech Pros

Software Engineering Radio #256 on Unit Testing

!important is a CSS code smell.

Do you name your IIFEs? You should.

This is our 5th, Design Patterns Episode. Last one was in July 2015.

30: Adapter, Facade, and Memento
19: Iterators, Observers, and Chains
16: Strategy, Template, Null Object
11: Factories, Factory Methods, Builder, Prototype

What type of development do you prefer?

Front-End
Back-End
Full Stack

Design Patterns - Command, Repository, and Mediator

Command Pattern

  • Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo.
  • It's not "method()" it's "new Object(), and later...object.invoke()
  • Why? Nice, clean way of organizing your code. Especially if….
  • OO replacement for callbacks - meh
    • Specify, queue, execute
    • Undo
    • Transactions/Logging
    • Not mentioned:
      • Macros
      • Async
  • Real World Applications
    • GUI/Menus - copy/paste/undo/photoshop
    • Video Games
      • Age of Empires sent commands rather than the game state!
      • It’s not if("B") { jump(); }, if(input[k]) { input[k].invoke() }
        • Great for different contexts, like menus
    • Parallel / Tasks
      • Async/Await
    • Queues / Multi-Step Wizards
      • Queue up the commands, execute all at once
    • Restaurants????
  • How it’s done:
    • Client: Customer
    • Receiver: Waiter
    • I/Command: Order
    • Invoker: Cook
  • Great example on sourcemaking.com
  • What about callbacks?
  • Why not the observer pattern?
  • Challenge for the listeners, program the command pattern - do it “by the book”

Repository Pattern

Why?

  • Testable with isolated data layer
  • Centrally managed access rules and logic
  • Centralized caching strategy
  • Allows you to separate business logic from data access logic
  • Strongly typed entities
  • Business entity associations
  • Can apply a domain model to simplify business logic
  • Decouple business entity from data storage technology - the repository doesn’t expose where it gets its data

What?

  • Sits between the data source and the business layer
    • Maps data from the data source to an entity
    • Persists changes from the entity back to the data source
      • Can use the Unit of Work pattern for complex, multi-step operations
    • Typically utilizes a Data Mapper Pattern, or an ORM such as Entity Framework in .NET

Mediator Pattern

What is it?

  • The mediator pattern defines an object that encapsulates how a set of objects interact
  • Promotes loose coupling by keeping objects from referring to each other explicitly
  • Promotes the Single Responsibility Principle by allowing communication to be offloaded to a class that handles just that.
  • Similar to the Observer pattern
    • Mediator pattern can be implemented during the observer pattern,
    • The Observer pattern distributes communication by introducing “observer” and “subject” objects.
  • Also similar to the Facade pattern in that it abstracts functionality of the classes.

Examples

  • Chat room
  • Air Traffic Control
  • Button events?

Resources We Like

http://gameprogrammingpatterns.com/
https://msdn.microsoft.com/en-us/library/ff649690.aspx?f=255&MSPPError=-2147217396
https://genericunitofworkandrepositories.codeplex.com/
http://blog.falafel.com/implement-step-step-generic-repository-pattern-c/
http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php
https://sourcemaking.com/design_patterns/command
https://sourcemaking.com/design-patterns-book
http://www.codeproject.com/Articles/526874/Repository-pattern-done-right
https://en.wikipedia.org/wiki/Mediator_pattern
https://sourcemaking.com/design_patterns/mediator
http://programmers.stackexchange.com/questions/134432/mediator-vs-observer

Tips of this Episode

Allen:

Want a JavaScript tip per day?!
http://www.jstips.co/

Bonus!!!  Want tons of cheap stuff?!
App called "Geek" - download it on iOS or Android

Michael:

Use Nunit's TestCaseSource to test objects in your test cases

How to delete/forget about a wireless network in Win8.1

  • netsh wlan show profiles
  • netsh wlan delete profile name="gogoinflight"

SOURCE: http://www.digitalcitizen.life/how-delete-forget-wireless-network-profiles-windows-81

Joe:

Learn a new language! Stretch the brain, learn new concepts and see old concepts in a new light! Scripting, Compiled, Functional - Conway’s Game of Life!

Direct download: coding-blocks-episode-042.mp3
Category:programming -- posted at: 11:49pm EDT

This week on Coding Blocks, Joe changes a different kind of string, Allen drools over the Hellcat, and Michael shares his random thoughts. We span a collection of topics including GraphQL framework envy, bash on Windows, and whether it takes two to Django.

Direct download: coding-blocks-episode-41.mp3
Category:general -- posted at: 10:23pm EDT

Are you an Advanced Programmer? We dig into the final section of Robert Read’s fantastic writing: How to be a programmer. Also, how to cheat at Jira, a lazy butcher and if learning web development is worth it.

Link to Episode 40’s Full Show Notes
http://www.codingblocks.net/episode40

Direct download: coding-blocks-episode-040.mp3
Category:Software Development -- posted at: 9:33pm EDT

How to be an Intermediate Programmer

Link to Episode 39's Full Show Notes
http://www.codingblocks.net/episode39

T-Shirt Giveaway - The winner is...
Manrique Logan - please contact us to send us your ship-to information!

This Episode's Survey
Suggested by: https://twitter.com/CatcheNameHere/status/700507429390274560

Princess rap battle: GALADRIEL vs LEIA
https://www.youtube.com/watch?v=RL52R7m8b7w

How to be an Intermediate Programmer

Personal Skills

Team Skills

Judgement

Resources We Like

How to be a Programmer: A Short, Comprehensive, and Personal Summary by Robert L Read
Make a Pull Request to get your thoughts in here:
https://github.com/RobertLRead/HowToBeAProgrammer
Or buy your copy here from Amazon:
http://amzn.to/1WzbIxs

Succinctness is Power - Paul Graham
http://www.paulgraham.com/power.html

You Don't Know JS
https://github.com/getify/You-Dont-Know-JS/blob/master/README.md

Want to know how fast you type?
http://www.typingtest.com/

Allen's Typing Speed on the Microsoft Sculpt Ergonomic

Microsoft Sculpt Ergonomic Keyboard
Microsoft Sculpt Ergonomic Keyboard

http://www.typingtest.com/result.html?acc=100&nwpm=90&gwpm=90&ncpm=452&gcpm=452&dur=60&time=60&chksum=45213&unit=wpm&kh=998&td=null&err=0&hits=452

specflow - Binding business requirements to .NET code
http://www.specflow.org/

 

Tips for this Episode

Allen Underwood: Execution plan for a running query in Microsoft SQL Server
Preface: You can click a button in Microsoft SQL Server Management Studio (SSMS) to see the execution plan of a query to identify any performance problems.  The biggest issue with this is that if there's a query that NEVER returns, or takes an insanely long time to return, then you're stuck waiting for the query to finish.  This tip shows you how to find the ACTUAL (not estimated) query plan of the query that is actively running:

How To:

EXEC sp_who2 'active' -- Find the SPID of the query you're running

DECLARE @spid INT = 123 -- From above

SELECT EQP.query_plan, *
FROM sys.dm_exec_requests AS ER
   CROSS APPLY sys.dm_exec_query_plan(ER.plan_handle) AS EQP
WHERE ER.session_id = @spid

Once that bottom query runs, you'll be provided a link in the results grid that you can click to open up the graphical execution plan.

Michael Outlaw: Have Git ignore changes you make to a specific file like you didn't make the changes, but still have it be part of the tracked files in Git.
Preface: Let's say you have a connection string configuration file that you change to point to your local database.  That config file needs to be tracked in Git, but you don't want your changes to accidentally get committed and pushed up to the remote repo, then this command is for you.

How To:

git update-index /path/to/file --assume-unchanged

Joe Zack: Life Tip -  Pay attention to the warnings in your IDE.  It's easy to get used to seeing several warnings and ignoring them because they're not errors.  Eventually a new one that actually matters will show up and by ignoring it, you could be creating heartache for yourself.  If you can, resolve the warnings that are currently showing up so that if a new one surfaces, it'll jump out at you like a sore thumb.

Direct download: coding-blocks-episode-039.mp3
Category:programming -- posted at: 5:29pm EDT

Talking about the short book "How to be a Programmer", which covers a huge spectrum of important topics for developers of all levels.

Direct download: coding-blocks-episode-038.mp3
Category:programming -- posted at: 12:36am EDT

Our Favorite Developer Tools for 2015

We wrapped up 2015 with another favorites of 2015.  This go around it's the tools that we feel are invaluable as developers.  This can be anything from hardware, to software or a service that we feel is integral in our daily needs as programmers.  

If you're on mobile, you can visit the show notes page for this episode by going here:
Episode 37 Show Notes

[yop_poll id="12"]

News and Random Discussions

Are static methods a cod / code smell?

Maybe we should go full on OO and use Microtypes?
http://www.michael-snell.com/2015/03/microtyping-in-java-revisited.html

Win the other pre-worn, gently broken in, gray T-Shirt!  Just leave a comment on this episode!

Nicholas wrote back in Ep. 21 - how is the renaming with ReSharper different than the refactoring option in Visual Studio?
http://www.codingblocks.net/podcast/episode-21-our-favorite-tools/#comment-1987021142

Our Favorite Tools

Individual Picks

Number 5 - Last but not least:
Allen: Simple Mind
Description: Mind mapping tool for getting your ideas out in a somewhat organized state.

Main Site: http://www.simpleapps.eu/simplemind/
Android (free): https://play.google.com/store/apps/details?id=com.modelmakertools.simplemindfree
Android (paid): https://play.google.com/store/apps/details?id=com.modelmakertools.simplemindpro
Apple iOS (free): https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=305727658&mt=8
Apple iOS (paid): https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=378174507&mt=8

Michael:  UBlock Origin
Description: An ad-blocking plugin for various browsers that allows your web experience to be much faster and less intrusive by ad-agencies.

Main Site: https://www.ublock.org/
Chrome Plugin: https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en
Mozilla Plugin: https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/
Apple iOS: https://itunes.apple.com/us/app/purify-blocker-fast-clutter/id1030156203?ls=1&mt=8

Joe: Gliphy
Description: Workflow diagrams, wireframes, mockups, etc., all online.  Integrates with Atlassian products extremely nicely for wikis, Jira tickets, etc.
Main Site: https://www.gliffy.com/

#4
Allen: Codecademy
Description: Learn how to code for FREE - Interactively!  HTML, CSS, Javascript, Ruby, Python, PHP and more.  Go there...now...

Main Site: https://www.codecademy.com/

Michael: .NET Fiddle
Description: Site that allows you to write your .NET code online in a web browser, similar to JSFiddle, execute and share your code

Main Site: https://dotnetfiddle.net/

Joe: Office 365
Description: There are several subscription options so you'd definitely want to make sure you're picking the one that's right for you.  For personal (one person) use, the cost is (currently either $69.99/year or $6.99/month and you get access to Microsoft Word, Excel, PowerPoint, OneNote, Outlook, Publisher and Access on PC / Mac plus one phone and a tablet.  For family use, you'd probably want to go with the "Home" plan as you get all the same perks as the "Personal" plan times 5 for just $9.99/month or $99.99/year.  So that means you get to install Office on up to 5 PCs or Macs, five tablets, and five phones.  And you also get 1TB of storage per user, for a total of 5TB of cloud storage.

Office 365 Personal (individual user): https://products.office.com/en-us/office-365-personal
Office 365 Home (for 5 users): https://products.office.com/en-us/office-365-home

#3
Allen: Netgear R7000 AC1900
Description: Rock solid, great performing wireless router.

Product Link: http://www.amazon.com/gp/product/B00F0DD0I6/?tag=codingblocks-20

Michael: Hours Tracker
Description: Especially useful for freelancers or consultants, this application allows you to track your hours worked with a ton of features: geofencing, tagging, switching projects, multiple rates, multiple clients.

Main Site: http://www.hourstrackerapp.com/
Apple iOS: https://itunes.apple.com/us/app/hourstracker-time-tracking/id336456412?mt=8&ign-mpt=uo%3D4
Android: https://play.google.com/store/apps/details?id=com.cribasoft.HoursTrackerFree.Android&hl=en

Joe: JQuery Injector
Description: Chrome plugin that allows you to interact programmatically with a web page - basically friendly hacking to achieve things that maybe weren't meant to be achieved.

Main Site: https://chrome.google.com/webstore/detail/jquery-injector/indebdooekgjhkncmgbkeopjebofdoid

#2
Allen: Snagit
Description: For both Mac and PC, this is an excellent utility for taking and marking up your screenshots with some easy to use tools and you can even record your screen which can be saved off in standard video formats that are easily shared.  NOTE: You cannot edit the videos as with a ScreenFlow or a Camtasia, but it's great for quick little recordings for how-to's or to demonstrate problems.

Main Site: https://www.techsmith.com/snagit.html

Michael: Briggs & Riley Verb Backpack
Description: Excellent laptop bag especially for those who travel a lot for their work.  It holds up remarkably well, comes with a Lifetime warranty and is attractive to boot.  This bag has a ton of features that are made to help expedite your trip through airports.

Product Link: http://www.amazon.com/Briggs-Riley-Advance-Backpack-Black/dp/B016JQUYMM/ref=sr_1_3?ie=UTF8&qid=1451846799&sr=8-3&keywords=briggs+and+riley+verb&tag=codingblocks-20
More Information: http://www.briggs-riley.com/shop/collections/verb/advance-backpack-1

Joe: FitBit
Description: Turn your fitness into a bit of a game to help you stay active.  If you've not heard of this company, you're probably living in a box, but Joe definitely stands behind this product as something that motivates him to get his daily activity in.

Product Link: http://www.amazon.com/Fitbit-Wireless-Activity-Sleep-Tracker/dp/B0095PZHPE/ref=sr_1_8?ie=UTF8&qid=1451847290&sr=8-8&keywords=fitbit&tag=codingblocks-20

#1 - Our top individual picks
Allen: MeteorJS
Description: An isomorphic approach to applications.  It's a full stack javascript application framework - write your Server, Client and Middleware in Javascript.  It's so quick and easy to get up and running that it's really not fair to compare it to any other "frameworks" out there.  It's done incredibly well.

Main Site: https://www.meteor.com/

Michael: WebStorm by JetBrains
Description: Web development IDE that has evolved incredibly well with the latest JavaScript frameworks.  It supports many of the latest frameworks, it's cross platform (PC, Mac and Linux), has a ton of useful development features and is relatively speedy.  Also, they've updated their buying options so it starts at $60/year for individuals and is well worth the price of entry.

Product Link: https://www.jetbrains.com/webstorm/

Joe: Spotify
Description: One of the many streaming music services around, but arguably one of the best.  They have a HUGE selection of music.  If you're a subscriber you get access to their higher bit-rate streams for the audiophiles at heart.  As a developer, is there anything more necessary than some tunes to help you tune out everything around you and make some killer progress on your task at hand?

Main Site: https://www.spotify.com/

Group Picks

Number 5: Gulp
Description: A Javascript tool made to enhance and automate your workflow.  Works by piping output to other tasks and is configured by writing simple code pipelines.  Not only that, but there is a rather large library of tasks written for Gulp that can allow you to do most of what you could possibly want.

Main Site: http://gulpjs.com/
Plugin Site: http://gulpjs.com/plugins/

Number 4: NUnit
Description: A unit testing framework for all .NET languages.  Originally a port from JUnit, but has since been rewritten specifically for the .NET framework.  Why we picked this over MSTest - simply put: parameterized tests.

Main Site: http://www.nunit.org/

Number 3: JSFiddle
Description: Similar to Michael's pick for dotnetfiddle, JSFiddle provides you a place online where you can write some Javascript in the browser and share that code with a URL that's created for you.  This is an excellent way to share examples or help others out with working examples of Javascript code.  One of the downsides of JSFiddle is the lack of ability to create multiple files which means it's difficult to show structure along with code samples.

Main Site: https://jsfiddle.net/

Number 2: The Book - Design Patterns: Elements of Reusable Object-Oriented Software 
Description: Still in its first printing, the book includes 23 of the classic design patterns with context as to what the uses are as well as clear code examples.

Product Link: http://www.codingblocks.net/get/gang-of-four-book

Our Consensus Top Pick: Slack
Description: Productivity enhancing as well as time wasting service, Slack is a means of communicating with teams of folks quickly and easily.  Not only is it a great chat platform, it has a ton of useful (and fun) plugins for enhancing your work environment.  An example would be the Visual Studio Online plugin where you can see when a particular branch of code has been updated.  

Main Site: https://slack.com

OUR Slack Channel!  https://codingblocks.slack.com/

Come Join in on the conversation!

Resources We Like

Beyond Legacy Code: Nine Practices to Extend the Life (and Value) of Your Software
Product Link: http://amzn.to/1JtdMzR

Tips for this Episode

Allen: ProgrammableWeb.com - Well known public API's for developers
http://www.programmableweb.com/apis/directory

Michael: Find your mouse - for those with too much monitor real estate!
Mac El Capitan - Just shake your mouse around and it shows up nice and big!
PC Windows - Go into your mouse properties in the control panel, and select "Show location of pointer when pressing the control key" - doing this will allow you to locate your mouse by clicking the control key and a ring will radiate from the mouse pointer.

ApexSQL Refactor - format your SQL within Management Studio for SQL Server
http://www.apexsql.com/sql_tools_refactor.aspx

Use the FORCESEEK Luke - Index hint for SQL Server Queries
https://technet.microsoft.com/en-us/library/bb510478(v=sql.105).aspx

Use the Index Luke - SQL Tips and Tricks
http://use-the-index-luke.com/

Joe: Indigo Studio by Infragistics - Rapid prototyping tool - Wireframing on steroids!
http://www.infragistics.com/products/indigo-studio

Has support for different resolutions so you can see how your app behaves.Also has really nice support for behaviors, swiping here navigates, or double clicking changes the page. Much better than getting psd! Also has a timeline so it’s easier to see the relationship between frames automatically
Alternatives:
http://www.justinmind.com/
http://www.axure.com/

Direct download: coding-blocks-episode-037.mp3
Category:tools -- posted at: 5:44pm EDT

Welcome back to the dramatic conclusion of our discussion on the 12 factor app. This time we're talking dev/prod parity, logs, and admin processes. Oh, and Call of Duty!

Direct download: coding-blocks-episode-36.mp3
Category:programming -- posted at: 1:41pm EDT

It's time for more DevOps fun as we continue learning about the Twelve-Factor app. This week we dive into the next three chapters: port binding, concurrency, and disposability.

Direct download: coding-blocks-episode-35.mp3
Category:general -- posted at: 11:57pm EDT

The holidays are coming sooner than we realized, so we gotta get our wish lists together. After all, no one wants to sit around the Festivus Pole without their favorite dev toys. This week we discuss some of the toys we love, as well as the ones we drool over, and even the ones we're not so crazy about.

Direct download: coding-blocks-episode-34.mp3
Category:general -- posted at: 9:39pm EDT

The Twelve-Factor App: Backing Services, Building and Releasing, Stateless Processes

 

Surveys – Wow we forget about them and ramble...sorry guys!

 

Mark Tinsley – PHP Composer – thanks for the tip!
https://getcomposer.org/

 

Joe made a game in Javascript (using dozens of libraries):

Box Pusher! (game name of the year)
https://github.com/THEjoezack/BoxPusher

 

Allen's cry for writing black-boxed, encapsulated code...
Episode on Encapsulation: http://www.codingblocks.net/episode23

Episode on SOLID Design: http://www.codingblocks.net/episode7

 

Probably want to listen to the first three parts of the 12 Factor App if you missed it:

http://www.codingblocks.net/episode32


IV. Backing Services

  • Any resource consumed over the network: databases, mail servers, cloud services, etc.

  • Anything external to your app (but could be local to your environment)

  • Should not have to change any code to redeploy – should be config changes if anything

  • Clearly Tech – Importance Rating: High

 

We've mentioned Splunk, and if you're not familiar, it's an enterprise piece of software that will aggregate logs from multiple sources (servers, computers, etc):
http://www.splunk.com/en_us/products/splunk-enterprise.html

 

Bug in Visual Studio that cost one person $6,500 in a few hours:

https://www.humankode.com/security/how-a-bug-in-visual-studio-2015-exposed-my-source-code-on-github-and-cost-me-6500-in-a-few-hours

 

V. Build, Release, Run

  • Build stage – transform which converts the code repo into an executable bundle

  • Release stage – combines the build with the required config and deposits it somewhere

  • Run – runs the app in the execution environment (development, staging, production, other)

  • Rolling back may be more complicated when you start talking about database schemas / data changes

  • Clearly Tech – Importance Rating: Conceptual???

 

Version numbers? What do you prefer? Version numbers with major and minor revisions? Or do you prefer timestamps?

 

 

VI. Processes

  • Stateless and Share Nothing

    • No local session

    • Make sure saving files go to an available repository

  • Clearly Tech – Importance Rating: High (Joe wants higher than high)

 

Resources We Like

Tips

 

Allen: Find problematic queries that are killing your SQL Server...replace 123 with the spid from sp_who2.

 

sp_who2 'active'

DBCC INPUTBUFFER(123)

 

If you want to be mean....replace 123 with the spid from sp_who2

KILL 123

 

Additionally, if there's high CPU and low I/O, it's likely either a missing or a fragmented index.

 

Joe: Tortoise Git

https://tortoisegit.org/

 

Mike: Tip of the week is the Pseudocode podcast
http://pseudocode.fm/

 

And...don't be lazy. We can't seem to get off our tails and get a business card made!