Sun, 4 November 2018
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
-- posted at: 9:43pm EST
Sat, 20 October 2018
This is a special episode recorded at Microsoft Ignite 2018 where John Callaway from The 6 Figure Developer Podcast joins Allen Underwood to talk about Azure Functions and CosmosDB. Find out what they are and why you might want to try them out for yourself. Using your podcast player to read these show notes? You can view this episode’s full show notes and participate in the discussion over at https://www.codingblocks.net/episode92
- Datadog.com/codingblocks – Sign up today for a free 14 day trial and get a free Datadog t-shirt after creating your first dashboard.
- Huge thank you to all those that left us a review, we really do appreciate it.
- iTunes: Rick Wolter, Nikola Jankovic
Big Thanks to Microsoft
- Huge thanks to Microsoft for having us out here to record an episode at Microsoft Ignite in their podcast booths!
If you’ve not heard of Ignite, here’s why you might care…
- Over 700 deep dive sessions
- Over 100 self-paced workshops
- Watch demos, check out the latest technology, meet the experts
- Keynotes from speakers such as Satya Nadella
- Swag…of course you come for the swag
What are they?
- Serverless - just means you don’t have a server running 24/7 that you’re paying for
- No provisioning or maintaining servers - all handled by Azure managed compute platform
- Scales on demand
- Supports multiple languages (depending on trigger types)
Why should you care?
- Easy and inexpensive way to get familiar with the cloud
- Ability to create powerful, low-cost micro services
- Worry about your application functionality, and not your infrastructure
- Azure Functions 2.0 is out as of Ignite (September 24th, 2018)!
How do you use them?
- Through the use of Triggers
- Service Bus Queue
- Service Bus Topic
- Event Hub
- IoT Hubs (Event / Service Bus)
- Generic Webhook
- External File
- And More…
- There is also support for additional languages in experimental mode such as: Bash, Batch, PHP, PowerShell, Python and Typescript
- Avoid long running functions - under 5 minutes from what I’ve seen
- If not using “Durable Functions”, use storage queues for cross function communication
- There are limits on storage queue size - 64KB - if that’s a problem, utilize storage blobs
- Write functions to be stateless
- If state needs to be maintained, use state on the data itself, such as having a state member or property
- Write the function to be idempotent - it will return the same value with the same inputs
- Write defensive functions
- Plan for failures at each step
- Scalability and how function scaling works https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale
- Assuming the “Consumption Plan”
- CPU and RAM scale up automatically - up to 1.5GB of RAM
- Function apps that share the same consumption plan scale independently
- Function files are stored on the main storage account associated with the function
- Interesting gotcha - when using a blob trigger, it can take up to 10 minutes for a blob to be processed if the function went to sleep
- Can avoid this by having an App Service plan with Always Enabled turned on, or use an Event Grid trigger
- A scale controller automatically scales up the number of instances of the function to meet demand
- Maximum number of 200 instances - created 10 seconds apart
- There is no maximum number of concurrent requests a function can handle though
- Need to be concerned with number of connections being used - 300 is the limit
- Billing is in gigabyte-seconds - combination of the memory size and execution time of the function
- At the time of this writing…
- Consumption plan pricing includes a monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month
- GB-s = Average memory size in Gigabytes (rounded up to the nearest 128MB) times the execution time in milliseconds
- Minimum is 100ms and 128MB
- 1 million executions is $0.20 https://azure.microsoft.com/en-us/pricing/details/functions/
- Best Practices https://docs.microsoft.com/en-us/azure/azure-functions/functions-best-practices
Useful Tools for Azure Functions and CosmosDB (and Azure in general)
What is it?
- Globally distributed, multi-model database for any scale
- It offers throughput, latency, availability, and consistency guarantees with comprehensive service level agreements (SLAs), something no other database service can offer
- Can distribute your data to any azure regions with the click of a button
- Multi-homing API’s can detect your nearest enabled data center and route traffic there for lowest possible latency
- All you do is add regions you want to scale to, no application changes necessary
- Uses the Atom-Record-Sequence (ARS) based data model - this just means it natively supports multi-models
- Document, Graph, Key-Value, Table, Column-Family, and others
- A number of API’s are available in multiple language SDKs
- SQL - schema-less JSON database storage with SQL querying capability
- MongoDB - MongoDB as a service - scalable and expressive document database
- Cassandra - CassandraDB as a service - highly available, document database
- Gremlin - Graph Database
- Table - Key-Value storage - similar to Azure Table Storage but with lower latency, globally available, automatic-indexing with little to no code changes
- Scales at per second granularity
- Storage scales transparently and automatically
- For a typical 1KB item, Cosmos DB guarantees end-to-end latency of reads under 10 ms and indexed writes under 15 ms at the 99th percentile, within the same Azure region. The median latencies are significantly lower (under 5 ms).
- 99.99% availability SLA for all single region database accounts, and all 99.999% read availability on all multi-region database accounts.
- Tunable consistency levels - allows you to choose how important consistent reads and writes are
Don’t Worry About Performance
- Wait, what?!
- Rapidly iterate the schema of your application without worrying about database schema and/or index management.
- Azure Cosmos DB’s database engine is fully schema-agnostic – it automatically indexes all the data it ingests without requiring any schema or indexes and serves blazing fast queries.
Who’s it For?
- Any web, mobile, gaming, and IoT application that needs to handle massive amounts of data, reads, and writes at a global scale with near-real response times for a variety of data will benefit from Azure Cosmos DB’s guaranteed high availability, high throughput, low latency, and tunable consistency.
- Built in monitoring using function storage for logging - limited information
- Azure Application Insights - preferred method
- There’s a daily limit for free monitoring, so pay close attention to your caps
- Configure via an instrumentation key
- Simply choose the Metrics page of the Cosmos DB to watch
- Can also pull the performance information using the SQL API’s
Resources we Like
https://functionschallenge.azure.com/ https://microsoft.com/learn If you don’t have a PluralSight account, start a free trial and then check out the courses below: https://www.codingblocks.net/pluralsight https://app.pluralsight.com/library/courses/azure-functions-fundamentals https://app.pluralsight.com/library/courses/csharp-code-azure-functions-reducing-duplication
Tip of the Week
Direct download: coding-blocks-episode-92.mp3
-- posted at: 8:12pm EST
Sun, 7 October 2018
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
-- posted at: 9:14pm EST
Sun, 23 September 2018
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
-- posted at: 8:51pm EST
Sun, 9 September 2018
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
-- posted at: 8:59pm EST
Sun, 26 August 2018
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
-- posted at: 8:51pm EST
Sun, 12 August 2018
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
-- posted at: 9:50pm EST
Sun, 29 July 2018
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
-- posted at: 10:52pm EST
Sun, 15 July 2018
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
-- posted at: 11:40pm EST
Sun, 24 June 2018
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
-- posted at: 11:34pm EST
Sun, 10 June 2018
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
-- posted at: 9:20pm EST
Mon, 28 May 2018
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
-- posted at: 1:49pm EST
Sun, 13 May 2018
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
-- posted at: 10:09pm EST
Mon, 30 April 2018
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
-- posted at: 10:07pm EST
Sun, 15 April 2018
- Concentrating too many functions in a single part of the design (class)
- Typically knows everything about what’s happening in the application and knows how to interact with all the data in the application
- Often gets incredibly difficult to maintain over time because making changes to the God object has far-reaching side-effects
- Overly complicated because it knows about and maintains the state for much of the application - becomes a mediator of all things in the app
- Pattern is used in micro-controllers where centralized control is more important than elegance and ease of maintainability
- Reusing objects whose state does not conform to the (possibly implicit) contract for re-use
- This happens when you’re re-using objects (for example Pooling/Flyweight) and you either don’t fully clean up before/after
- Example: I get a db connection from the pool, set the command timeout really high, use it, then return it…if my code doesn’t reset that…then every other call that uses that object may have that new timeout
- Example: You install a blog engine like WordPress, create a new post and save it…then you go to write your second post and some of the information is not reset between uses…so you may end up setting a category, tag etc that you didn’t realize
- Can also get into this problem if you’re working in a multi-thread environment and aren’t being thread-safe
- How do you know when you’re doing this? Are you re-using objects or creating them on the fly? Do your objects have a “reset” method?
- What to do about it? Try to centralize “reset” type code, use thread-safe tools/practices
- Failing to properly encapsulate objects permitting unrestricted access to their internals
- Meaning, that other objects are able to “reach” into parts of your object that they really shouldn’t be able to
- The worst consequence is that it becomes difficult to maintain and change.
- An example of how this happens would be by declaring internal members public or providing public getter/setter methods on your properties.
- This anti-pattern could be a symptom of coding to an immature design, laziness or haste while implementing the design, and/or reluctance to refactor the design as it matures.
- How to fix this? Recognize the problem and refactor. This will be especially easier before any interfaces are made public.
- favor private over public
- OCP maybe?
- The example we talked about with the RGB color space is directly to Joe’s own creation:
Please leave us a review!
- Objects whose sole purpose is to pass information to another object
- Also known as: Gypsy , Proliferation of Classes , and Big Do It Controller Class
- Typical cause is poor object design
- Often found by names like manager, controller, startProcess, initialize…
- They are short lived objects that have no apparent reason to exist other than to initialize a class or invoke a method in a more useful object
- To remove one - get rid of it and move its functionality into the invoked class, through either inheritance or as a mixin
A mixin can be viewed as an interface with implemented methods
- A class that requires its methods to be called in a particular order
- Imagine an SDK like a credit card processor where you have to…Initialize your sdk, Create an Order, Add Items To the Order, Submit the Order for Authorization, Submit a Capture
- How do you know when you’re doing this? If you catch you’re self saying “Oh, it’s because you didn’t…”, if you have an “Initialize” method, if you feel obligated to look for an example of how to do something
- How do you fix it? Consider the template method pattern, create one method that does that stuff and have hooks like “initialize” and “before” / “after” events that implimenters can fill in - but not be responsible for calling
- A structure (e.g., of inheritance) that is hard to understand due to excessive fragmentation
- Ever read some code, program, etc. that was so complicated you had to bounce between files, classes, etc. to understand it? That’s the yo-yo problem.
- How can we avoid this?
** Maybe the S from SOLID to (help) keep your objects smaller?
** Favor composition over inheritance to keep the inheritance tree as shallow as possible.
Resources We Like
Tip of the Week
Direct download: codingblocks-episode-079-64.mp3
-- posted at: 8:00pm EST
Mon, 2 April 2018
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
-- posted at: 10:49pm EST
Sun, 18 March 2018
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
-- posted at: 10:15pm EST
Tue, 6 March 2018
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
-- posted at: 10:32pm EST
Sun, 18 February 2018
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
-- posted at: 7:08pm EST
Sun, 4 February 2018
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
-- posted at: 7:56pm EST
Mon, 22 January 2018
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
-- posted at: 9:59pm EST
Sun, 7 January 2018
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
-- posted at: 8:28pm EST