Everything’s better nice and clean and tidy, right? We’ve never, ever had that debate before.
Okay, sarcasm aside, developers can strive toward making sure that their code is as clean, tidy, and efficient as possible, and this week, Dan Abramov says goodbye to clean code in a blog post that looks at this desire for clean code and how it arrives at a less than desirable outcome.
While examining a colleague’s code, Abramov sees an obvious chance to break things down into reusable pieces and composing their behaviors.
“The code is half the total size, and the duplication is gone completely! So clean,” he writes. Unfortunately, his elation would only last so long, until his boss asked him to revert those changes. “I begrudgingly complied, but it took me years to see they were right.”
Abramov offers a lesson to those developers out there still harping on “clean” code at every turn:
Once we learn how to create abstractions, it is tempting to get high on that ability, and pull abstractions out of thin air whenever we see repetitive code. After a few years of coding, we see repetition everywhere — and abstracting is our new superpower. If someone tells us that abstraction is a virtue, we’ll eat it. And we’ll start judging other people for not worshipping “cleanliness” […]
Don’t be a clean code zealot. Clean code is not a goal. It’s an attempt to make some sense out of the immense complexity of systems we’re dealing with. It’s a defense mechanism when you’re not yet sure how a change would affect the codebase but you need guidance in a sea of unknowns.
Now, onto the latest news in the world of programming because, after several weeks of holidays, we have some stuff to talk about.
This Week in Programming
- Pandas 1.0 Python Package Brings Breaking Changes: The Pandas Python data analysis package, whose name is derived from “panel data”, is moving to 1.0 and bringing with it some big breaking changes, reports InfoWorld. The arrival of the 1.0 release candidate, writes InfoWorld, “removes many features and deprecates many others” and requires Python 3.6.1 or better, so if you’re still lagging on that point… more on that in a moment. Overall, the number of changes to Pandas 1.0 means that some of Pandas’ APIs are now backwards-incompatible, and there’s a list of all of the features to be deprecated. As for future deprecations, Pandas has adopted a new support policy for future versions of Pandas, which ensures that deprecation and Python version support changes will be limited to major releases — “minor releases will deprecate features, but not remove them; major releases will remove features,” writes InfoWorld. If you’re using an old version of Pandas, the article offers the various ways that you might go about updating, and we’d recommend giving it a read through before just going ahead with the update.
- What’s Your Plan for Python 2 End of Life? A survey on the topic of Python 2’s finally arrived end-of-life finds that around half of respondents don’t have a plan for Python 2 EOL and that 31% of organizations have no Python 3 migration plans. If you’re in the position of being, oh, a decade behind the times with your Python updates, perhaps this blog post about Mercurial’s journey to and reflections on Python 3 will be helpful to take you out of that 50% that finds itself totally unprepared for this long-coming update. In the post, the author offers “a mostly factual recount of Mercurial’s Python 3 porting effort and a more opinionated commentary of the transition to Python 3 and the Python language ecosystem as a whole.”
Some person: you need a CS degree to understand computers
Me: Hi, I don't have a CS degree and I understand computers
The way it ought to work:
Person: Oh, my assumptions about this are wrong
The way it does work:
Person: Oh, then you must not understand computers
— Ian Coldwater (@IanColdwater) January 16, 2020
- GitHub for Android Beta Arrives: Oh, technology — it’s a double-edged sword, isn’t it? As someone who’s been a remote worker for the better part of the last decade, I know only too well how useful it is to have access to my email and Slack and all that work stuff on my phone, while at the same time, how much of a ball and chain it can be. Well, your next favorite ball and chain has just arrived on Android, dear developer, with the arrival of GitHub for Android beta. “With GitHub for mobile, you have the flexibility to move work forward and stay in touch with your team, wherever you are,” GitHub writes on its blog, not mentioning how terrible and great, all at once, it will be to be able to comment on GitHub issues directly from your day at the beach. The company introduced GitHub for mobile during its 2019 GitHub Universe event, launching a beta for iOS and has now made the GitHub for Android beta available.
- On the Way to PHP 8: PHP 7 was a big departure from the PHP of the past, as any PHP developer will let you know, and the next version of PHP is expected to be released sometime this year. If you’re actively developing in PHP, it may be something to keep an eye on, and this blog post of what’s new in PHP 8 says it will be “an up-to-date list of what’s expected to come: new features, performance improvements and breaking changes.” Beyond breaking changes, some features to look forward to with PHP 8 include the JIT compiler and union types, and if you’re concerned about breaking changes, they’re listed in full in the UPGRADING document, though the author notes that it’s not too much to be worried about, as “many of these breaking changes have been deprecated in previous 7.* versions though, so I’ve you been staying up-to-date over the years, it shouldn’t be all that hard to upgrade to PHP 8.”
- Git 2.25 Intros Partial Clones & Sparse Checkout: The latest version of git — that version management tool that lies behind services like GitHub and GitLab — has a new version on the way and the GitHub blog offers some highlights from git 2.25. With the release of git 2.25, there are new features and bug fixes, the most notable of which being “partial clone support” and “sparse checkouts.” A “partial clone” is precisely that, a clone of a repo that only clones some, not all, of the repo, but the execution of this, and its implications, can be a bit more complicated. The feature is still experimental in Git, and not supported yet by GitHub. Sparse checkouts, meanwhile, allows a similar functionality in that it allows you to check out some, not all, of a particular repo. in blog posts such as these. In 2.25, Git takes another step closer to bringing mature and configurable partial clone support to all users. “The idea behind the git sparse-checkout command is simple: allow users to play with partial clones and sparse-checkouts as easily as possible,” they write. “It can do four things: set the list of paths to checkout, print the current list, and enable or disable sparse checkouts entirely.” For full details on what else is new in git 2.25, check out the full blog post.
When non-tech people ask me to describe my job pic.twitter.com/dgkWa7zVNz
— Cassidy Williams (@cassidoo) January 13, 2020
- Oooh, A(nother) Font for Developers: JetBrains, the makers of Kotlin and the IntelliJ IDE, have introduced JetBrains Mono, a free and open source typeface for developers — and given developers affinity for things like fonts and dark mode, we figured we couldn’t pass up including it here. The font is designed to improve readability in code and does things like putting a dot inside a zero, to help distinguish it from a capital “O.” The most controversial aspect, it would appear, comes from the font’s use of “ligatures,” which are characters consisting of two or more joined symbols — in other words, your comment code would no longer be several dashes, but rather appear as merged dashes.
is your child texting about infosec? what their texts REALLY mean:
brb = basic testing, bro
lol = lots of logging
smh = so much hashing
tbh = trapped by honeypot
stfu = scanning to find u
tfw = this firewall works
idc = in da cloud
btw = blue team win
— gabsmashh (@gabsmashh) January 14, 2020
The New Stack is a wholly owned subsidiary of Insight Partners. TNS owner Insight Partners is an investor in the following companies: MADE, Bit.