Podcast: Play in new window | Download
Subscribe: Apple Podcasts | Spotify | TuneIn | RSS
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.
Care to join in on the conversation? Become a member of our Slack community by signing up at http://www.codingblocks.net/slack.
Viewing these show notes through your podcast player? For the full show notes, visit: http://www.codingblocks.net/episode56.
Survey
The week’s survey: Why did you start programming?
News
- Huge thanks to those that left us a review!
- iTunes Reviews: Chuck O’Halloran, Haddoc67, mhender24, jeremyunderwood, runartrollet, ksklmiller, tuplesteve, JoeR8975, Compninja, Thomas Cooper CA, SWFMac, yvesmh, Diana
- Stitcher Reviews: rionmonster, mhender24, Cpt_Coathanger, oopmichael, JKBob11, BrandonHartman, TerranZima, Matthew Lazarow, yetAnotherCleverNickname, SkyKrynn, NguTron
- What’s the difference between a Code Technician and an Engineer
- Programming is the New Blue Collar Job
- Allen buys an Ecobee 3.
- New version of GlyphFriend is available.
- Joe and Allen are famous (GitHub)
- Allen digs into the details of public variables vs public properties. Watch at YouTube.
- Joe uses the Interface Segregation Principle to reduce his technical debt. Watch at YouTube.
- Joe was on Productivity in Tech.
- Requirements for dev laptops.
Stickers
Like stickers? Want some Coding Blocks stickers? Of course you do, who can blame you? Head to http://www.codingblocks.net/swag to learn about sending us a SASE to get some of the best stickers ever made.
Systems
“Complexity kills.” – Ray Ozzie
Separate your concerns with Dependency Injection
- Separate constructing a system from using it
- Just because it’s startup code, doesn’t mean you should abandon abstraction
- Dependencies should be passed down from main…
- Factories should create instances, not other classes
- Gather your data, process your data, format your output
- Consistency is good!
Dependency injection
- Dependency injection – a class takes no steps to resolve its dependencies – it’s completely passive
- “Dependency Injection, the application of Inversion of Control to dependency management”
- IoC vs DI: http://stackoverflow.com/questions/6550700/inversion-of-control-vs-dependency-injection
- Setter or constructor methods take care of the instance creation
- Spring Framework for Java – objects are wired together in XML configurations
- .NET DI Frameworks: Unity vs Ninject vs StructureMap
- https://www.nuget.org/packages?q=dependency+injection
- Most DI frameworks won’t construct an object until you need it – THIS IS HUGE – i.e. lazy initialization
- Additionally, most frameworks allow for plugging in factories to help with the idea of lazy evaluation
- The myth about getting it “right the first time”
- Focus on today’s needs today. Refactor and expand for tomorrow’s needs tomorrow.
- We should iterate on stories today, and do more in the future as they come along – TDD and clean code enable this
Manage Cross Cutting Concerns with AOP
- Analogies of cities growing and the pains involved – parallel to software
- You wouldn’t build a 6 lane highway through a tiny town
- Cross cutting concerns (Wikipedia)
- Aspect Oriented programming – and how it helps with cross-cutting concerns
- “The real value of an AOP system is the ability to specify systemic behaviors in a concise and modular way”
- Proxies aka wrappers – fairly complicated code (and hard to code cleanly) – and don’t provide system-wide execution points
- Typically proxies are created by tooling
- In Spring, you write business logic as POJO’s – plain old java objects
- POJO’s focus ONLY on their domain – no dependencies on external domains
- Interesting point made in the book – XML is typically hard to read and the conventions might be difficult to follow, but it’s still easier than reading proxy code and is usually preferred for that reason
- “The power of separating concerns through aspect-like approaches can’t be overstated. If you can write your application’s domain logic using POJO’s, decoupled from any architecture concerns at the code level, then it is possible to truly test drive your architecture.”
- Start with small, simple pieces and fulfill user stories – this does not mean to go into a project rudderless – but don’t do Big Design Up Front (BDUF) – too inflexible
- Avoid BDUF.
- “A good API should largely disappear from view most of the time” – allows you to focus on your core
- What about REST?
- If not, the constraints will inhibit the efficient delivery of value to the customer
Be quick or be dead, keep things ready and plan for change
- In large systems, no one person can make all of the decisions.
- Postpone decisions until the last possible moment
- Don’t fall in love with standards or frameworks just because they exist – EJB2 as an example – focus on the core and use what makes sense
- Domain Specific Languages – popular for the reason that business users can write / understand the language
- Systems must be clean too – failing to do so can impact agility and tie you to the architecture
- “Never forget to use the simplest thing that can possibly work”
Resources We Like
We’d be remiss if we didn’t include Clean Code as a Resource We Like.
Tip of the Week
- Use Snippets in your IDE to save time writing boiler plate templates. Curiosity of Sebastian Greenholtz.
- Atom
- IntelliJ
- Sublime
- Visual Studio (or via Snippet Designer plugin)
- Debug your SQL query inside SQL Management Studio like a boss instead of using PRINT.
- Paste without any formatting in MacOS by using CMD+SHIFT+OPTION+V to paste. (Although, Michael had success with just CMD+SHIFT+V.)
Developer Confessions
So, there’s a recent Twitter trend that has been gaining notoriety where seasoned developers are confessing their sins. And we thought we’d throw out some of ours.
- Michael habitually refers back to this Stack Overflow answer before undo a Git commit.
- Long ago, Joe has previously stored credit card numbers in clear text. Gasp! And then he changed the column type from textual to numerical. Hilarity ensued.
- Allen may have forgotten to add a WHERE clause to his UPDATE/DELETE SQL statements. Recently.
Developer confessions has been a popular topic within our Slack community as well.
Imagine having to pass a technical interview just to get into the country?!
Share with a Friend!
Want to do your friends a solid? Tell them about the show! You’ll be their hero for like a year or so, I think. They’ll probably owe you something big. It’s that big of a deal. So what are you waiting for? Get out there and tell them.
And, if you haven’t yet left us a review, we’d super, duper appreciate it if you would. We’ll even be your best friend if you do. Head over to http://www.codingblocks.net/review to make it happen!