• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. The Fitnessgram Pacer Test

      Warning: this post may contain spoilers

      The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal bodeboop. A sing lap should be completed every time you hear this sound. ding Remember to run in a straight line and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark. Get ready!… Start. ding

      9 votes
    2. Gab is throwing away their existing code and switching to a modified version of Mastodon

      Posting this as a text post so that nobody has to go to Gab, but the source is here if you really want to. Full post copied below: An update on "New Gab" and what to expect: Progress on our new...

      Posting this as a text post so that nobody has to go to Gab, but the source is here if you really want to. Full post copied below:

      An update on "New Gab" and what to expect:

      Progress on our new codebase is going well. For those who don't know, our plan is to fork existing open source software, Mastodon, which is based on the ActivityPub social networking protocol.

      What does this mean in layman's terms?

      • Gab will become an open source project, meaning developers from around the world can contribute the project and help us build.
      • Gab will get several new features and PRO benefits, such as video uploading.
      • You'll be able to log into and use dozens of existing mobile apps that exist on both App Stores with your Gab account and use Gab through these apps.
      • We will be porting over all of your Gab posts, followers, etc to this new codebase.
      • Gab will be getting a fresh paint job and be much more "user friendly." (See a mockup below, which isn't final.) Don't worry, it won't look anything like Mastodon (for those of you who know it is,) it will look like Gab.

      What does the timeline look like for this going live?

      At the moment we are working on building in Gab features that this open source social networking protocol does not currently have. Things like Gab Groups and editing. We are also finalizing a fresh redesign of the Gab interface. Once these two things are done, we will start porting over all existing Gab data. During this time we will invite Gabbers to beta test New Gab and give us feedback. Once Gabbers give us the go ahead we will finalize the transition and push it to Gab.com. All of these steps will occur over the next few weeks.

      Why are you doing this?

      • Moving Gab to open source brings transparency and additional help from developers in our community from around the world.
      • Moving to the ActivityPub protocol as our base allows us to get into mobile App Stores without even having to submit and get approval of our own apps, whether Apple and Google like it or not.
      • Ultimately we want to make Gab more user friendly, perform better, and be a product you all love. This will accomplish all of those things.

      We are excited to share this with you and will have more information soon.

      Thank you

      This is a pretty interesting move by Gab. They had been kicked out of app stores, and like the post mentions, this will allow them to just piggyback on existing apps that work with Mastodon instead of needing their own. I saw at least one app dev say that they'd specifically block it from being used on Gab, but they probably won't all do that, and I'm sure they'll probably end up with some options.

      People in the fediverse don't seem very happy about this overall, but it's probably also not a big deal. The main dev of Mastodon posted:

      So Gab has decided that their own code that they spent $5M of investor money developing is so unsalvageably bad that they're going to use Mastodon's code instead, with the added bonus of leeching off of our apps (with Gab apps being banned from app stores)

      This is an early warning to fellow admins to be vigilant and domain-block them on sight, when/if they appear (unconfirmed whether they intend to federate), and to app devs to consider if blocking Gab's domains from their app is necessary.

      Remember that Gab is a sinking ship and they're basically grabbing onto Mastodon like a parasite in a desperate attempt to get attention from the "drama" of doing so.

      https://www.thedailybeast.com/gab-is-in-full-meltdown-and-founder-andrew-torba-blames-the-deep-state

      Torba has no self-awareness to see how pathetic it looks that his master race ass is incompetent at making a working website so he has to resort to using software made by a Jew instead.

      App devs will block their domains, server admins will block their domains, and that'll be the end of that.

      35 votes
    3. testing my precious linksies markdown

      no https://, link to news.ycombinator.com Link to HN with https://, same link Link to HN I think the first one will link to tildes.net/abc/news.ycombinator.com which is wrong, but hey what do I...
      1. no https://, link to news.ycombinator.com Link to HN

      2. with https://, same link Link to HN

      I think the first one will link to tildes.net/abc/news.ycombinator.com which is wrong, but hey what do I know.

      edit1: OK, so yeah.. correct assumption. Prolly normal?

      edit2: new link, no subdomain, no https:// YC Link

      So yeah always need a properly formatted URL, otherwise will assume that it's a relative link.. prolly how the web works, but is it ideal? I will check on reddit for comparison.

      edit3: reddit test: Using markdown, reddit requires a fully valid url which includes the protocol. But using the new fancy editor, it does not.

      Not sure what I accomplished here :)

      1 vote
    4. Long form visual storytelling - the best of TV

      We've had a few threads recently criticising the direction of various shows cough Game of Thrones cough and @Amarok suggested a thread celebrating the good stuff on TV instead. Personally,...

      We've had a few threads recently criticising the direction of various shows cough Game of Thrones cough and @Amarok suggested a thread celebrating the good stuff on TV instead. Personally, television is by far my favourite means of visual storytelling, a good TV show can go into the kind of depth and complexity that the more time-limited format of movies just can't touch.

      A few of my favourite shows then, in no particular order:

      House MD - recently rewatched this and it definitely stands the test of time. Sure, there are a few weak episodes here and there but on balance it's solid. Hugh Laurie absolutely nails the role of Sherlock Holmes Greg House and the supporting cast are excellent too. It has one of my all-time favourite endings of all television shows, even knowing what was coming I still ended up a little moist of eye by the end. Also they grade the colour with increasing desaturation throughout season 8, almost to the point of it being monochrome - until the final scene is in glorious, bright colour and I love little touches like that. TV shouldn't just be actors reading lines, there is a whole medium to tell stories with (Game of Thrones also did this kind of thing well).

      Detectorists - BBC show about two metal detectorists. Gloriously paced, slow and gentle but insistent in telling it's tale, with really strong characters. Finishes beautifully, at just the right time. A gem of a show, it's very well written and nearly flawless throughout. Mackenzie Crook (writer, director) was offered more seasons but he declined because the show was finished and that takes guts to do but I love that he did. Also features Diana Rigg (Olenna Tyrell) who is never not brilliant.

      Buffy The Vampire Slayer - I mean what can you even say about Buffy. Might have been the last show where my friends would meet up for a watch party every week, hanging out for hours discussing it and enjoying herbal cigarettes for the evening. Streaming is great and so convenient but in some ways I do miss TV being an event. There was someone very special about getting everyone together once a week to share in that world, and especially with Buffy because the characters were so close in age to me (I'm slightly younger than Alyson Hannigan and I had such a crush on Willow). Sure, it had it's wobbles (the entire Adam story arc, for example) but also some of the best TV moments of the 90s/early 2000s. Once More With Feeling and Hush are fan favourites for a reason.

      Hannibal - Produced by Bryan Fuller, who is always good, but absolutely outdoes himself here, and Mads Mikkelson is terrifying in the titular role. Visually it's stunning, the plot is engaging and deeply disturbing, the characters well drawn and believable (Hannibal particularly so, which is all the more horrifying) and the sound design is absolutely astonishing. I bought a whole new sound system literally just for this show and it was totally worth it. Sound design is one of those things which you only notice when it's particularly bad or particularly good and Hannibal is definitely the latter. It's such a well-rounded piece of television, it uses colour and light and sound and all the tools in the TV maker's box. the ending is a little on the weak side but they got axed early - Bryan Fuller had five seasons planned but they only got three.

      I could go on, but I won't because I'll go on for ages! Please add a couple of your favourite shows and maybe we can all find a few new things to watch.

      20 votes
    5. How would you guys feel if Youtube followed Instagram and made views/likes/etc. private?

      Curious how you guys feel about this as users, uploaders etc? Its an interesting question because this was generally viewed as a good move by instagram, would it be the same with Youtube. Also,...

      Curious how you guys feel about this as users, uploaders etc? Its an interesting question because this was generally viewed as a good move by instagram, would it be the same with Youtube.

      Also, from what I understand a lot of drama on Youtube has been elevated because of public seeing the subs go up/down, maybe this would change how we analyse drama. I dont say this in the sense of someone who enjoys drama, but some of these things reflect social trends/situations.

      Edit: I just want to add for clarification; Instagram is currently beta testing a feature where only you the poster can view how many likes and comments you get, the public cannot. The Youtube version would be hiding views/likes/subs from the audience, but not the content creator.

      5 votes
    6. tildes.net is inaccessible over IPv6?

      When I try to access tildes.net over an IPv6-enabled network, the connection simply times out. Running ping -4 tildes.net responds but ping -6 tildes.net times out. I've tested this on multiple...

      When I try to access tildes.net over an IPv6-enabled network, the connection simply times out.

      Running ping -4 tildes.net responds but ping -6 tildes.net times out. I've tested this on multiple networks (residential and commercial) but it doesn't work on any.

      It looks like tildes.net has an AAAA record but the IP doesn't work.

      Can anyone reproduce?

      27 votes
    7. Any developers/designers interested in a helping build a proof-of-concept for a new type of data-centric app?

      Wow it was hard to describe this in the title! I should have said "data-centric APP" not UI. Sorry! LOL I have had an idea for 25 years that I keep NOT pursuing because I was convinced that the...

      Wow it was hard to describe this in the title! I should have said "data-centric APP" not UI. Sorry! LOL
      I have had an idea for 25 years that I keep NOT pursuing because I was convinced that the next big version of Linux/Windows/etc would include a more civilized way to manage data. It just seems obvious in my strange mind, I guess that means intuitive. I've discussed the idea and worked on refining the concepts with about 20 people and they all agreed.

      My idea is based on a huge paradigm shift about managing all forms of data by the user. It's about how we manage data, not just file-system stuff or yet-another Windows/File Explorer or any of the numerous current Linux varieties. I'm honestly shocked that in 2019, the most original idea that's come about is to remove all the menus and toolbars (freeman) or add a bunch of tabs and hundreds of buttons (pretty much everything on Windows).

      I am a software engineer and designer with 35 years experience - but with business class apps, not OS stuff. I am semi-retired and have a great deal of time to work on whatever interests me. And please note: Despite my advanced years ;-) LOL I am very current on the technologies I work with daily, which is mainly .net/c#. However, I just finished a year-long project that had a Java client running on a Raspberry Pi (which I love) paired with a WCF service running in IIS, along with an asp.net web client. Now I'm not an expert in any of that, but I'm not too shabby I don't think as I've made a good living and do mostly volunteer work right now.

      I currently manage a massive amount of data, from files/dirs on Windows and Linux file-systems, to MSSQL and mySQL on both Windows and Linux, and of course some cloud data. And it takes several tools as you know, and it's incredibly inefficient and painful. And of course on Windows, Windows/File Explorer is - eh, I can't find a word strong enough. On Linux not much better. And I've spent the past two years searching, researching, testing, and praying.

      My idea is to build an app that allows users - not just developers like me - but mostly aimed at business users - to manage data from various sources/technologies in a single unified and intuitive manner. The physical aspect is divorced from the UI which is divorced from the management engine. And it's grouped the way the user THINKS and WORKS with it. For example, let's say for PROJECT-A (and Client-1) I have various source code locations on 2 local hard drives, but also documents (technical specs, or maybe letters to the client, spreadsheets or timelines), and of course likely a database or two, some web-site links. How many places and how many apps would I have to use today to keep them all close by so I could get to them? Well, there'd be a couple of drive letters probably, maybe a few sub-folder levels deep, maybe documents on a network share, some collaborative docs in the cloud, and some web-site links in whatever-browser-you-use. You get the idea.

      No file manager on any OS can give you much more than "Places" or file-system - drive letters on Windows or some mount points on Linux. Things like MyDocuments, MyMusic, MyInsanity - that stuff makes no sense because it's not how people work. What I want is a "work-space" where I can have any number of what I call "Data Sources" - and it doesn't matter what physical technology is underneath it - local hard drive, local sub-folder, mapped drive, unc mount, cloud, ftp - don't care - don't need to. I create a work-space, add data sources, order them however I want, name them whatever I want, and each "Data Source" has a manager or provider. A filesystem provider would make your data source look like Windows Explorer. But a database provider could look like MS SQL Server Manager or other db admin tool. And you put that workspace in a tab if you want, and have as many others in other tabs - or you put them on a menu, or on a popup that a middle-click brings up - doesn't matter. And everything I've just written, plus it's settings, is represented by Viewer objects. A hierarchical - tree-view or the likes - a flat view - a list-view - a preview pane, or editor pane - navigation tool (path/breadcrumbs) - a command line shell pane - drag/dock wherever in the tab you want. A main menu/toolbar + status-bar would be global and shared. And all THAT is bundled into a PARENT object - which contains the work-spaces, which contains the tabs, which contains the data sources + provider views/panes. And you can have as many of THOSE - parent objects - as you need, easily accessible in the custom titlebar at the top, or bottom, etc..

      The point is - when I am working on PROJECT-A I manage it in a tab that contains ONLY the drive letters, or mount points, that are relevant (and named what I choose, meaning no drive letters forced on me even if that is the underlying reality nor any full paths or full URLs - just logical names I assign). This will NOT be some massive file manager with every folder on the system or 18 drive letters I'll never use. It will have all the web-site bookmarks I need, as well as databases I'm working with. This won't be an ALL-IN-ONE type of thing - you will STILL use your external apps, web browser, IDE or editor, mail app - but it will be a SINGLE place where ALL those data items get represented and where you can manage them in exactly the same way. I can copy/paste an email message to a file on my workstation, or copy a file from a network share to some machine remotely using ftp or http.

      I hope this makes some kinda sense and doesn't just sound like the ramblings of yet-another aging geek who thinks he's got a great new idea. My usage scenarios are literally based on things I do every day, and are the result of observing myself as I work to see what my mind is doing. I do realize that we all work in our own way, and I've taken that into account. But there are basic things we all do concerning data management. And as I have hired, trained, and worked with a huge number of fellow programmers over my 35 years - without exception this was the most common soft point for them all. Keeping track of data. The same applies to all my clients. I've written software for accountants and attorneys, and a wide variety of business types - and without exception - every one of them had trouble with managing their data. One look at their Desktop or MyDocuments - or just watching them trying to find a letter in MS-Word - tells the whole story.

      Ok there's my pitch - I'm looking for anyone who has interest, no matter what your skill level or how much time you can or cannot devote. We need people who can contribute only opinion and advice, as well as hardcore keyboard jocks like me who love to code for 36 hours at a clip ;-) LOL

      12 votes
    8. Study shows "the risk of HIV transmission through anal sex when HIV viral load is suppressed is effectively zero".

      Risk of HIV transmission through condomless sex in serodifferent gay couples with the HIV-positive partner taking suppressive antiretroviral therapy (PARTNER): final results of a multicentre,...

      Risk of HIV transmission through condomless sex in serodifferent gay couples with the HIV-positive partner taking suppressive antiretroviral therapy (PARTNER): final results of a multicentre, prospective, observational study

      Our results provide a similar level of evidence on viral suppression and HIV transmission risk for gay men to that previously generated for heterosexual couples and suggest that the risk of HIV transmission in gay couples through condomless sex when HIV viral load is suppressed is effectively zero. Our findings support the message of the U=U (undetectable equals untransmittable) campaign, and the benefits of early testing and treatment for HIV.

      9 votes
    9. Does your city have civil defense/fire/air raid sirens or similar systems?

      Heya, fellow Tildees! Given how my city (Celle in northern-ish Germany) just did the monthly test of them, I wonder how widespread they are in the rest of the world and what they're used for. Here...

      Heya, fellow Tildees!
      Given how my city (Celle in northern-ish Germany) just did the monthly test of them, I wonder how widespread they are in the rest of the world and what they're used for. Here the system's used for alerting firefighters, though they all have pagers or similar by now.
      Also I'd assume there are more modern solutions to quickly warn the population. Tell us all about it!

      14 votes
    10. Experimenting with a way of avoiding deeply nested comment threads

      One of the difficulties with a nested/tree commenting system is finding a way to deal with threads that get very "deep", when people continue replying back and forth under the same threads. The...

      One of the difficulties with a nested/tree commenting system is finding a way to deal with threads that get very "deep", when people continue replying back and forth under the same threads. The deep threads end up getting indented very far, and this looks bad, can be hard to follow, and wastes a ton of space (especially on smaller screens like phones).

      I'm not a huge fan of any of the ways that I've seen other sites try to handle this, so I've been trying to figure out if there might be any other possibilities that would work well. I've noticed that in most of the cases where a thread gets very deep, a lot of the depth comes from back-and-forth replies, where there's only one comment on each "level". So I'm testing a method that will flatten those sections out and just put a note on each comment that it's a direct reply to the comment above it.

      Specifically, the current method (which is now live), works like this: if a comment is at least 4 levels deep and only has a single reply, don't indent the reply any further. Instead, keep the reply at the same indentation and add a note at the top of it indicating that it's a reply to the above comment.

      I managed to implement this entirely through CSS, by writing what's probably the worst best chunk of CSS (really, SASS) of my life, which I want to show off here. If you don't know CSS and can't read this, trust me, you're better off:

      .comment:not([data-comment-depth="0"]):not([data-comment-depth="1"]):not([data-comment-depth="2"]):not([data-comment-depth="3"]) {
        &[data-comment-replies="1"] {
          & > .comment-tree-replies {
            margin-left: -1px;  // compensate for border
      
            & > .comment-tree-item > .comment > .comment-itself {
              & > .comment-text::before,
              & > header > .is-comment-deleted::before,
              & > header > .is-comment-removed::before {
                content: "(Reply to above comment)";
                font-size: 0.6rem;
                font-style: italic;
                margin-right: 0.2rem;
              }
            }
          }
        }
      }
      

      One of the really interesting things about implementing this entirely in CSS is that we can easily change what level it happens at based on screen size. So I have it set to always start at depth >= 4 right now to help with testing and deciding whether it works well or not, but if we decide to keep it I could easily change the threshold to higher on desktop and keep it lower on smaller screens.

      As an example of how it works, the previous ~tildes.official thread works really well. @Amarok and @cfabbro had a long discussion about music metadata that went very deep. The thread ends up 16 levels deep, but this new change makes it so that it only indents by 5 levels instead of 16. Here's a comparison between how the end of the thread looks on my phone: before this change vs. after this change (yes, something's not quite right with the indentation lines yet).

      Let me know what you think. I'm mostly concerned that this might make it a little harder to follow long threads since the information from the indentation is lost, but I think we need to test it out in real threads for a while to see if that actually ends up being significant or just takes a bit of getting used to.

      76 votes
    11. Google Voice is now available as a core G Suite service

      I received this email yesterday but haven't seen any blog posts or press releases about it yet: Hello Administrator, Since our Beta Program announcement last year, we’ve been testing an...

      I received this email yesterday but haven't seen any blog posts or press releases about it yet:

      Hello Administrator,

      Since our Beta Program announcement last year, we’ve been testing an enterprise-ready version of Google Voice. Over the next seven days, Google Voice will become available as a core G Suite service for all eligible* G Suite customers (additional fees apply to this new, managed version of Google Voice). This email will help you understand the transition details but you can also refer to the Voice webpage for more information.

      What's changing:

      • Managed Google Voice is available in 3 tiers and will become a core G Suite service for your domain after subscribing to a service tier.
      • Managed Voice accounts will be covered under your existing G Suite agreement and additional Google Voice service specific terms.
      • Support for managed Voice accounts will be the same as other G Suite core services.

      What's not changing:

      • The Google Voice service will remain “on” by default.
      • If users in your domain signed up for Voice prior to this launch, they will be able to maintain their legacy unmanaged Voice subscriptions without additional cost, and will remain subject to the Google Voice consumer terms of service. You can add a Voice subscription and upgrade these users to managed Voice users in your Admin console.
      • Hangouts Meet (also a core G Suite service) is integrated with Google Voice, allowing meeting participants to dial in or be added by phone.

      What do I need to do?

      • If you did not participate in the Google Voice Beta Program and would like to use Google Voice for your organization, follow these steps to add a Voice subscription.

      We're here to help

      If you have additional questions or need technical assistance, please contact Google support. When you call or submit your support case, reference issue number ----------.

      Sincerely,

      The G Suite Team

      * Google Voice is not yet available for G Suite for Government customers. Google Voice is available for purchase in select countries.

      It looks like Google Voice is going to be sticking around for awhile. You can even use Polycom desk phones with it if you get the $20 tier.

      9 votes
    12. This Week in Election Night, 2020 (Week 4)

      week four is upon us because i have simply run out of space to put links in. i have a literal page of links that comprise today's post, and that suggests to me it's probably time to make another...

      week four is upon us because i have simply run out of space to put links in. i have a literal page of links that comprise today's post, and that suggests to me it's probably time to make another one of these. the [LONGFORM] tag continues (although this week there are no longform pieces) and once again, i will also be sorting by candidate--but also with a Fundraising header today since reporting deadlines came yesterday and there are a lot of pieces on that, and a Polling header since we have a few polls going now.

      the usual note: common sense should be able to generally dictate what does and does not get posted in this thread. if it's big news or feels like big news, probably make it its own post instead of lobbing it in here. like the other weekly threads, this one is going to try to focus on things that are still discussion worthy, but wouldn't necessarily make good/unique/non-repetitive discussion starters as their own posts.

      Week 1 threadWeek 2 threadWeek 3 thread


      News

      Fundraising

      • from FiveThirtyEight: What First-Quarter Fundraising Can Tell Us About 2020. probably the seminal piece of fundraising reporting from the slate since it's 538, this article is pretty straightforward. in general, this means basically nothing for the actual 2020 election--but it means a lot for the primary, since fundraising is a decent barometer for energy and likability and suggests a candidate will be able to hold their own. 538's metrics suggest that sanders, warren, and harris, and gillibrand are punching well for their weight class and the primary itself, while beto, buttigieg, booker, and others are punching well for their weight class, but not necessarily the primary.

      • from Vox: 7 winners from the first big presidential fundraising reports. Vox takes a slightly more subjective approach to their reporting than 538, but a similar story arises: they name their winners on actual fundraising as sanders, harris, warren, and buttigieg. interestingly, they also name biden a winner because nobody did truly "exceptional" in fundraising in their view which keeps his path slightly open; john delaney's consultants get an amusing mention for shaking him dry of money.

      • from NBC News: Six things we've learned from the 2020 candidates' fundraising reports. NBC News gives raw numbers on contributions, cash on hand, burn rate, so if you're curious about the numbers themselves, this is your source. as far as analysis, NBC crowns the two big winners as sanders and o'rourke on their fundraising totals, mostly on their average daily amount raised (sanders 445k over 41 days; o'rourke 520k over 18 days). they note that most of the senators in the race are doing respectably (although outside of kamala this is partly because of campaign transfers), and also think castro is the big loser with a paltry 1.1 million raised, less than some of the minor candidates like yang and marianne williamson.

      Polling

      A new national Emerson poll, including 20 Democratic candidates for President, found Senator Bernie Sanders ahead of the pack with 29%, followed by former Vice President Joe Biden at 24%. They were followed by Mayor Pete Buttigieg at 9%, former Rep. Beto O’Rourke and Senator Kamala Harris at 8%, and Senator Elizabeth Warren at 7%. Entrepreneur Andrew Yang and former HUD secretary Julian Castro were at 3%. The poll was conducted April 11-14 of Democratic Primary voters with a subset of n=356, +/- 5.2%.

      Joe Biden on 31%, Bernie Sanders on 23%, Kamala Harris on 9%, Beto O'Rourke on 8%, Elizabeth Warren and Pete Buttigieg on 7%, Corey Booker on 4%. All others below 3%. n=5,000, +/- 1%.

      Buttigieg ticks up again, and now has 7% of the Democratic primary vote share. This is the fourth straight week his vote share has increased. High income earners in particular are warming to Buttigieg: in the last six weeks, his vote share among Democratic primary voters earning more than $100k has risen from 1% to 11%. Bernie Sanders holds a strong lead with young voters: 41% of 18-29 year-old women and 39% of 18-29 year-old men support Sanders as their first choice. Andrew Yang lands in 5th place with 18-29 year-old men, with 5% of the vote.

      If Biden doesn’t run, Sanders has the most to gain. A projection based on second choice vote shows that Sanders would pick up 12 points if Biden opts not to run, enough to give him a 23 point first place lead.

      In a field of 24 announced and potential candidates, Biden holds the lead with 27% support among Democratic voters who are likely to attend the Iowa caucuses in February. He is followed by Vermont Sen. Bernie Sanders (16%), South Bend Mayor Pete Buttigieg (9%), Massachusetts Sen. Elizabeth Warren (7%), California Sen. Kamala Harris (7%), former Texas Rep. Beto O’Rourke (6%), Minnesota Sen. Amy Klobuchar (4%), New Jersey Sen. Cory Booker (3%), and former cabinet secretary Julián Castro (2%). Former Maryland Rep. John Delaney, New York Sen. Kirsten Gillibrand, Ohio Rep. Tim Ryan, California Rep. Eric Swalwell, and entrepreneur Andrew Yang each receive 1% support from likely caucusgoers. The remaining 10 candidates earn less than 1% or were not chosen by any respondents in the poll.


      Bernie Sanders

      Cory Booker

      • from Reuters: Booker launches 'Justice' tour, aiming for surge in U.S. presidential bid. cory booker ostensibly kicked off his middling campaign a few days ago, starting on a two-week whistle stop tour that'll see him around the country like the other candidates. booker is in a weird position, polling wise. he's not quite a frontrunner, but he's also not irrelevant (and he's probably siphoning votes from kamala, to be honest). theoretically, he has a path to the presidency, but i'm not entirely sure that the way he's trying to position himself is going to be particularly helpful in that end.

      • from NBC News: Booker kicks off campaign in hometown of Newark, promises to stay above the fray. NBC News has a more policy-focused article on booker's campaign launch: "Democratic ideals of health care for all, LGBTQ rights, economic equality and a pathway to citizenship for immigrants" among other things. he's also trying to embrace civility politics, it would seem. how well that works for him remains to be seen, but i would bet on him staying about where he is for the time being.

      • from Buzzfeed News: Cory Booker’s Campaign Hasn’t Gotten The Candidate’s Memo On His Message Of Urgency. the booker campaign as a whole is also fighting a battle of contradictory messaging: booker is an energetic candidate--his campaign, however, is very much a slow and steady affair. the booker campaign in general seems to be admitting it won't be able to keep the pace of the frontrunners, and so instead of fighting a battle it knows it can't win, it'll instead sit back and try and gain institutional backing that will benefit booker's chances in the likely event that the primary doesn't end with a presumtive nominee. it's an interesting strategy (it probably will not work, though). there's also some additional policy in this article that NBC and Reuters don't touch on, if you're curious about that.

      Pete Buttigieg

      • from The Guardian: Does everyone really love Mayor Pete? His home town has some answers. pete buttigieg's record and history as south bend, indiana's mayor is getting some traction in the media this week (as you'll see from some of the other articles in this section), and this is no exception. this article focuses mostly on the favorable reception south bender have toward both buttigieg and his candidacy, and the good things that his mayorship did for the city.

      • from NPR: Pete Buttigieg Helped Transform South Bend As Mayor, But Some Feel Left Out. contrast NPR, which has this article (similar to last week's Buzzfeed article) on the people who are less thrilled with buttigieg's tenure as mayor and his efforts to win the presidency, and the greater context they place buttigieg in.

      • from Slate: The Mayor Who Wants to Be President: Pete Buttigieg is a long shot. But so was Donald Trump.. this is the transcript of an interview that one of slate's podcasts did with pete buttigieg about a week ago, mostly focusing on his political history and policy issues but also on some of buttigieg's personal history like coming out. probably a good place to start if you're unclear on who he is or what he says he stands for.

      • from Reuters: Millennial 'Mayor Pete' Buttigieg makes case for U.S. presidency. this small article mostly focuses on buttigieg's formal launching of his campaign, which occurred a few days ago. we have a tildes thread on this, so i feel like there's not much to be said here that hasn't already been said there.

      • from Vox: Pete Buttigieg, Barack Obama, and the psychology of liberalism. this article basically puts into context one of the ways buttigieg seems to be trying to position himself and his campaign, and there's not a whole lot more to be said about it. this article is one of those ones that really only makes sense if you read it, and trying to explain it back to people just makes it a bit confusing all around, so if you're curious about this one, just read it.

      Kamala Harris

      • from Reuters: Kamala Harris carves distinct early-state path in her 2020 White House bid. the kamala harris path to the white house probably does not involve many of the early states necessarily, but that has not stopped harris from stumping in places like iowa and south carolina extensively in the past few weeks. harris would probably be the frontrunner if she were to do very well in the early states; california will be favorable to her, you would think, and comes very early in the 2020 primary cycle (early march) this year relative to where it fell in 2016.

      • from CBS News: Kamala Harris releases 15 years of tax returns. harris is also the frontrunner in this weird litmus test democrats have going on. will anyone upstage her on this? probably not. is it important? probably not. but here you go, if you wanted to know what her tax returns are like.

      Everybody else

      • from CNN: Seven takeaways from CNN's town halls with Andrew Yang and Marianne Williamson. andrew yang and marianne williamson both got town halls, and both of them are pretty interesting people when you actually press them on issues instead of having them shoot things into the wind without needing to really back them up. williamson is arguably the more interesting of the two, but really i think you'll find some of what CNN took away here from the both of them as pretty novel.

      • from FiveThirtyEight: Can Julian Castro Rally Latino Voters?. 538 poses this question--to which the answer seems to currently be no by most accounts. to be clear he's positioning himself pretty well with latino voters, but his problem isn't really latino voters so much as everybody else. he does quite badly with all non-latino demographics, to put it lightly, and him getting the latino vote only really matters if he can do well with other demographics on top of that. maybe he'll turn it around, but judging by his fundraising numbers, i think we might already be able to relegate him to the bin with yang and williamson and the other 'basically novelty' candidates

      General Policy

      • from CBS News: Democratic presidential candidates stay vague on immigration. despite what you might think based on how much of an issue it's been, julian castro is literally the only democrat so far to have a particularly detailed immigration policy plan. most candidates thus far have been pretty quiet on the subject, although i'm sure you can at least guess how most of them would structure an immigration plan. we'll probably see some be rolled out later on in the primary cycle as the race actually gets going, but at least for now this is the one thing castro can pride himself on that other candidates cannot.

      • from NPR: Democratic Candidates Are Releasing Tax Returns, Answering Big Questions For Voters. tax returns are a litmus test this year, and you can expect to see more of them in the future since most of the major candidates have either released them already or will do so at some point in the future. pretty straightforward.


      Opinion/Ideology-driven

      • from The Guardian: Elizabeth Warren is the intellectual powerhouse of the Democratic party. this op-ed mostly focuses on warren's extensive policy proposals and how, in moira donegan's view, this makes warren the aforementioned intellectual powerhouse of the democratic party. this is not wrong--warren is probably far and away the most policy-driven candidate so far in the campaign--but also it's not necessarily indicative of anything voters want. in the last election, hillary clinton had a pretty extensive set of policies, to which voters kindly responded by electing our non-clinton president. it does remain to be seen if they're more kind to warren, or if her ideas get picked up by other people in the race.

      • from The Guardian: Buttigieg is the Democrats' flavour of the month. Just don't ask what he stands for. nathan robinson hammers home one of the bigger criticisms of pete buttigieg in this op-ed, namely that nobody seems to know what he really stands for and he very much reeks of a "flavor of the month" democrat who is going to peter out at some point when the novelty wears off. robinson is actually pretty brutal to buttigieg here, to a point where i think i'm just going to quote him to give you an example of how not-sparing this op-ed is:

      But politics shouldn’t be about people’s attributes, it should be about their values and actions. Buttigieg is a man with a lot of “gold stars” on his résumé, but why should anybody actually trust him to be on their side? (Amusingly enough, in his campaign book Shortest Way Home, Buttigieg describes an incident in which a voter asked him how he could prove that he wasn’t just another self-serving politician. Buttigieg couldn’t come up with an answer.) The available evidence of his character is thin. Has he spent a lifetime sticking up for working people? No, he worked at McKinsey before he entered politics. Has he taken courageous moral stands? No: while Gary, Indiana, declared itself a sanctuary city in response to Donald Trump’s immigration policies, Buttigieg’s city of South Bend did not.

      yeah.

      • from The Guardian: How wide is Bernie Sanders' appeal? This cheering Fox News audience is a clue. bhaskar sunkara has another op-ed this week about the sanders fox news town hall, which he uses as proof that sanders has more widespread appeal than people give him credit for. considering that you're already seeing other candidates try and arrange similar plans, there's probably something to be said about whether or not that also applies to other candidates and the modern democratic message, too. (also, it does seem somewhat weird that candidates don't do this more often considering how much bipartisanship gets played up.)

      • and lastly, from NBC News: Fox News, Bernie Sanders and the value of discomfort. steve krakauer on the other hand argues a more pragmatic viewpoint: sanders going on fox news for the town hall was good for both himself but also for fox news because it pierced the filter bubbles that exist in modern politics, and allowed crosspollination of viewpoints that don't normally do so.


      anyways, feel free to as always contribute other interesting articles you stumble across, or comment on some of the ones up there.

      9 votes
    13. This Week in Election Night, 2020 (Week 3)

      week three brings a deluge of essays and pieces long enough that i'm going to break this week down by the candidate. news today is sorted by candidate, while opinion will remain unsorted for now...

      week three brings a deluge of essays and pieces long enough that i'm going to break this week down by the candidate. news today is sorted by candidate, while opinion will remain unsorted for now since there's not much going on there worth talking about. i've also, for clarity's sake, added a [LONGFORM] note to the longer pieces in this slate for those of you on a time crunch.

      the usual note: common sense should be able to generally dictate what does and does not get posted in this thread. if it's big news or feels like big news, probably make it its own post instead of lobbing it in here. like the other weekly threads, this one is going to try to focus on things that are still discussion worthy, but wouldn't necessarily make good/unique/non-repetitive discussion starters as their own posts.

      Week 1 threadWeek 2 thread


      News

      Bernie Sanders

      • from the Huffington Post: Bernie Sanders Says Felons Should Be Able To Vote While In Prison. bernie sanders called for the end of felony disenfranchisement over the week, which is a thing that almost all states do currently in some form. iowa in particular has possibly the most severe such law, something that the republican governor kim reynolds has been (unsuccessfully) trying to change, making it a fairly large issue there. this currently is not a litmus test for the Democratic Party, but don't expect it to go away, because the ACLU is pushing for candidates to adopt it as a plank.

      • from Jacobin: Votes For All. for a leftist take on the above, Jacobin has you covered. this article mostly focuses on the historical push by socialist and socialist-adjacent movements in america to do away with felony disenfranchisement and achieve universal suffrage, and sanders in that broader context.

      • from Slate: The Favorite: Can Bernie Sanders finally start acting like the one thing he’s never been?. slate mostly focuses on sanders's curious status as a genuine goliath in this race here, in contrast to the underdog status which has characterized basically the entirety of his political career previously. in many respects, this is unprecedented territory for sanders, and it is a genuine question whether he'll be able to adapt to that fact (or if he'll need to at all).

      • from TIME: Sen. Bernie Sanders Unveils New 'Medicare for All' Plan With Support From Some 2020 Rivals. policy wise, sanders unveiled his idea of what medicare for all looks like. this appears to have the support of gillibrand, warren, booker, and harris, who signed on to it (although they've also signed on to less things like a public option), so at least for now, you could probably say it's the leading healthcare reform option on the table.

      Pete Buttigieg

      Kamala Harris

      • from The Atlantic: [LONGFORM] Kamala Harris Takes Her Shot. this is a pretty comprehensive piece on harris, who made a big splash early but is now mostly trying to tread water without losing further ground to bernie and biden or giving up position to warren, buttigieg, or o'rourke. it's humanizing, but it also covers a lot of the criticisms and contradictions of harris's political history, and some of the nagging questions surrounding her political positions as she bids for the white house. if you're curious about or unfamiliar of what some of those criticisms people often launch at her are, this piece is probably for you.

      • from Buzzfeed News: Kamala Harris Wants Her Teacher Pay Raise Proposal To Bring Young Black Americans To The Profession — And To Her Campaign. as far as policy, harris has been staking her wagon to teachers in the form of pay raises. those of you who pay attention to the news might have heard her bring this up previously, as it's been an early feature of her campaign so far. it'll be interesting to see if other people take up the beat if she finds success with this issue--so far nobody really has, explicitly speaking, which might be because it's gotten relatively little attention.

      Everybody else


      Opinion/Ideology-driven

      • from In These Times: The Case for Using Ranked Choice Voting in the 2020 Democratic Presidential Primaries. this article makes the case for the primaries using ranked choice voting which, to be honest, would probably really help when there are literally going to be like sixteen people in iowa next year (especially given the fact that the democratic party has a 15% popular vote threshold for attaining any delegates in a state). this will definitely not happen this year, but maybe we'll see movement in the future toward something like RCV being used.

      • from The Week: The Democratic Party Is Not Going Nuts. It's Coming to Its Senses.. this piece by The Week puts foward the argument that the lurch to the left by the Democratic Party isn't some sort of weird mirroring of the lurch to the right in the GOP, but rather the Democratic Party realizing that centrism isn't really what people want. whether or not that's an accurate assessment, i'll leave to you.

      • finally, from The Guardian: Barack Obama is stuck in the past. He represents the old Democratic party. this piece is by bhaskar sunkara, who you may know as one of the figureheads of Jacobin. his case here is mostly that obama's remarks last week about cautioning the party to not become a circular firing squad are motivated more by his desire to continue to hold power within the party than by genuine desire to see the party succeed. again, whether or not that's an accurate assessment, i'll leave to you.


      anyways, feel free to as always contribute other interesting articles you stumble across, or comment on some of the ones up there.

      edit: some minor grammar stuff

      13 votes
    14. This Week in Election Night, 2020

      in the interest of trying to slightly curtail the domination of politics in ~news for people who don't care for it while also consolidating discussion for people who potentially do, i think we...

      in the interest of trying to slightly curtail the domination of politics in ~news for people who don't care for it while also consolidating discussion for people who potentially do, i think we should try one of those weekly threads that's so hip and popular on the rest of tildes, so here we go: this is a test run of a weekly thread on 2020 presidential news/analysis/etc. it's probably not going to get any lighter from here, news wise, so it might pay to establish a recurring topic like this before the media really gets rolling with election coverage (and potentially before ~news becomes a deluge of 2020 topics).

      i think common sense should be able to generally dictate what does and does not get posted in this thread if it works out, so i guess i'll just say: if it's big news or feels like big news, probably make it its own post instead of lobbing it in here. like the other weekly threads, this one is going to try to focus on things that are still discussion worthy, but wouldn't necessarily make good/unique/non-repetitive discussion starters as their own posts.


      leading off (and demonstrating that there really is going to be no dearth of 2020 primary and election news about this despite this week being pretty quiet on that front):

      from NBC - Why some Democrats say: Don't sleep on 'Mayor Pete' Buttigieg. buttigieg is a pretty small candidate in a field of big names, but that hasn't put the damper on people's optimism for him as this NBC piece shows. i personally don't think he's got the runway necessary for takeoff, but with the debates, who knows. it might be that the debates stratify the field even more than it's already stratified--or it might be that they level it out a bit, to the benefit of people like buttigieg

      from Buzzfeed - The Romance Of Mayor Pete In The Season Of Scam. another piece on buttigieg. this one is a bit light on substance and is basically an opinion piece, but if you're curious about buttigieg's qualifications you might be interested in it.

      from Heavy - Bernie Sanders’ Los Angeles Rally Draws So Many, Overflow Crowd Fills City Hall Steps Across the Street [PHOTOS]. bernie sanders made the second of three stops in california yesterday, and he drew a pretty major crowd that's currently estimated at around 15k--and could potentially be as high as 20k or 25k, depending on the setup of the venue. his stop the day before was in san diego where he drew a crowd of about 6,400, and today he'll be in san francisco, which could lead to an early messaging and marketing win if he can draw a comparable crowd to kamala harris's kickoff in oakland (which drew 20k).

      from The Guardian - The B-Team: are Beto, Biden and Bernie the best Democrats can offer?. i'll let this one present itself: "...But three of the top-polling candidates for 2020 so far are white men: Vermont senator Bernie Sanders, O’Rourke and former vice-president Joe Biden, who has not even declared his candidacy. Does that present a problem?" one of the big criticisms of the democratic party is that, even as it diversifies its slate of candidates across the board, its biggest hitters generally remain white and male, especially in this presidential election. whether or not that's a particularly valid criticism, i'll leave up to you.

      from POLITICO - Harris and O'Rourke go straight for each other's strongholds. sanders wasn't the only one buzzing around this week: o'rourke and harris have both been on tours of their own in states that will be pretty instrumental to the path of any democrat that wants to win the nomination. o'rourke, you may remember (tildes discussion), is the current day-one fundraising leader, and it appears we now actually have his individual donor numbers now (112,000, average donation of $55). so far, he doesn't appear to have parlayed that into particularly large crowd sizes (and outside of her campaign launch, harris hasn't really either) but we're still very early on, so i anticipate as their campaigns ramp up they'll start pulling larger numbers.

      from NBC - Beto O'Rourke could be a threat — to Biden on his right and Sanders on his left. this article, as you can probably guess by its title, mostly focuses on how beto is trying to position himself in the primary, but also how some of the people he appeals to feel about his candidacy and why they support him.

      lastly, from NPR - Small Donors Hold The Key To Campaign Buzz And The Democrats' Debate Stage. this NPR article on push by democrats to incentivize campaigns to build up their small donor bases in the leadup to 2020. the democrats have pretty much always been the undisputed champions of small-donor politics since the internet became a significant player in american politics, mostly on the back of things like actblue. nevertheless, there are still a lot of places they've been looking to improve (and it's really only a matter of time before republicans build infrastructure of their own), so it makes sense that they're really trying to shore up that advantage where they can while they can.


      this isn't even every article that i could have tossed on here, but i've already been working on this post for like an hour, so i think that'll suffice for now. feel free to contribute other interesting articles or comment on some of the ones up there.

      15 votes
    15. How much testing do you guys do?

      Pretty straight forward question, but basically I was watching a discussion panel the other day talking about the ethics of Self-Driving cars. A topic came up about people writing crappy code, and...

      Pretty straight forward question, but basically I was watching a discussion panel the other day talking about the ethics of Self-Driving cars. A topic came up about people writing crappy code, and more than that, people not testing their code. And if they do, they do point testing. I am in my last semester of uni and I am working with some companies where we are doing pretty extensive testing, happy flows and a lot of alternate flows, as well as UI/UX testing. I wanted to extend this question to you, do you guys do testing, what type? How much do you focus on it? And if u love it/hate it?

      12 votes
    16. Code Quality Tip: Cyclomatic complexity in depth.

      Preface Recently I briefly touched on the subject of cyclomatic complexity. This is an important concept for any programmer to understand and think about as they write their code. In order to...

      Preface

      Recently I briefly touched on the subject of cyclomatic complexity. This is an important concept for any programmer to understand and think about as they write their code. In order to provide a more solid understanding of the subject, however, I feel that I need to address the topic more thoroughly with a more practical example.


      What is cyclomatic complexity?

      The concept of "cyclomatic complexity" is simple: the more conditional branching and looping in your code, the more complex--and therefore the more difficult to maintain--that code is. We can visualize this complexity by drawing a diagram that illustrates the flow of logic in our program. For example, let's take the following toy example of a user login attempt:

      <?php
      
      $login_data = getLoginCredentialsFromInput();
      
      $login_succeeded = false;
      $error = '';
      if(usernameExists($login_data['username'])) {
          $user = getUser($login_data['username']);
          
          if(!isDeleted($user)) {
              if(!isBanned($user)) {
                  if(!loginRateLimitReached($user)) {
                      if(passwordMatches($user, $login_data['password'])) {
                          loginUser($user);
                          $login_succeeded = true;
                      } else {
                          $error = getBadPasswordError();
                          logBadLoginAttempt();
                      }
                  } else {
                      $error = getLoginRateLimitError($user);
                  }
              } else {
                  $error = getUserBannedError($user);
              }
          } else {
              $error = getUserDeletedError($user);
          }
      } else {
          $error = getBadUsernameError($login_data['username']);
      }
      
      if($login_succeeded) {
          sendSuccessResponse();
      } else {
          sendErrorResponse($error);
      }
      
      ?>
      

      A diagram for this logic might look something like this:

      +-----------------+
      |                 |
      |  Program Start  |
      |                 |
      +--------+--------+
               |
               |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |    Username     +--->+    Set Error    +--+
      |    Exists?      | No |                 |  |
      |                 |    +-----------------+  |
      +--------+--------+                         |
               |                                  |
           Yes |                                  |
               v                                  |
      +--------+--------+    +-----------------+  |
      |                 |    |                 |  |
      |  User Deleted?  +--->+    Set Error    +->+
      |                 | Yes|                 |  |
      +--------+--------+    +-----------------+  |
               |                                  |
            No |                                  |
               v                                  |
      +--------+--------+    +-----------------+  |
      |                 |    |                 |  |
      |  User Banned?   +--->+    Set Error    +->+
      |                 | Yes|                 |  |
      +--------+--------+    +-----------------+  |
               |                                  |
            No |                                  |
               v                                  |
      +--------+--------+    +-----------------+  |
      |                 |    |                 |  |
      |   Login Rate    +--->+    Set Error    +->+
      | Limit Reached?  | Yes|                 |  |
      |                 |    +-----------------+  |
      +--------+--------+                         |
               |                                  |
            No |                                  |
               v                                  |
      +--------+--------+    +-----------------+  |
      |                 |    |                 |  |
      |Password Matches?+--->+    Set Error    +->+
      |                 | No |                 |  |
      +--------+--------+    +-----------------+  |
               |                                  |
           Yes |                                  |
               v                                  |
      +--------+--------+    +----------+         |
      |                 |    |          |         |
      |   Login User    +--->+ Converge +<--------+
      |                 |    |          |
      +-----------------+    +---+------+
                                 |
                                 |
               +-----------------+
               |
               v
      +--------+--------+
      |                 |
      |   Succeeded?    +-------------+
      |                 | No          |
      +--------+--------+             |
               |                      |
           Yes |                      |
               v                      v
      +--------+--------+    +--------+--------+
      |                 |    |                 |
      |  Send Success   |    |   Send Error    |
      |    Message      |    |    Message      |
      |                 |    |                 |
      +-----------------+    +-----------------+
      

      It's important to note that between nodes in this directed graph, you can find certain enclosed regions being formed. Specifically, each conditional branch that converges back into the main line of execution generates an additional region. The number of these distinct enclosed regions is directly proportional to the level of cyclomatic complexity of the system--that is, more regions means more complicated code.


      Clocking out early.

      There's an important piece of information I noted when describing the above example:

      . . . each conditional branch that converges back into the main line of execution generates an additional region.

      The above example is made complex largely due to an attempt to create a single exit point at the end of the program logic, causing these conditional branches to converge and thus generate the additional enclosed regions within our diagram.

      But what if we stopped trying to converge back into the main line of execution? What if, instead, we decided to interrupt the program execution as soon as we encountered an error? Our code might look something like this:

      <?php
      
      $login_data = getLoginCredentialsFromInput();
      
      if(!usernameExists($login_data['username'])) {
          sendErrorResponse(getBadUsernameError($login_data['username']));
          return;
      }
      
      $user = getUser($login_data['username']);
      if(isDeleted($user)) {
          sendErrorResponse(getUserDeletedError($user));
          return;
      }
      
      if(isBanned($user)) {
          sendErrorResponse(getUserBannedError($user));
          return;
      }
      
      if(loginRateLimitReached($user)) {
          logBadLoginAttempt($user);
          sendErrorResponse(getLoginRateLimitError($user));
          return;
      }
      
      if(!passwordMatches($user, $login_data['password'])) {
          logBadLoginAttempt($user);
          sendErrorResponse(getBadPasswordError());
          return;
      }
      
      loginUser($user);
      sendSuccessResponse();
      
      ?>
      

      Before we've even constructed a diagram for this logic, we can already see just how much simpler this logic is. We don't need to traverse a tree of if statements to determine which error message has priority to be sent out, we don't need to attempt to follow indentation levels, and our behavior on success is right at the very end and at the lowest level of indentation, where it's easily and obviously located at a glance.

      Now, however, let's verify this reduction in complexity by examining the associated diagram:

      +-----------------+
      |                 |
      |  Program Start  |
      |                 |
      +--------+--------+
               |
               |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |    Username     +--->+   Send Error    |
      |    Exists?      | No |    Message      |
      |                 |    |                 |
      +--------+--------+    +-----------------+
               |
           Yes |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |  User Deleted?  +--->+   Send Error    |
      |                 | Yes|    Message      |
      +--------+--------+    |                 |
               |             +-----------------+
            No |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |  User Banned?   +--->+   Send Error    |
      |                 | Yes|    Message      |
      +--------+--------+    |                 |
               |             +-----------------+
            No |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |   Login Rate    +--->+   Send Error    |
      | Limit Reached?  | Yes|    Message      |
      |                 |    |                 |
      +--------+--------+    +-----------------+
               |
            No |
               v
      +--------+--------+    +-----------------+
      |                 |    |                 |
      |Password Matches?+--->+   Send Error    |
      |                 | No |    Message      |
      +--------+--------+    |                 |
               |             +-----------------+
           Yes |
               v
      +--------+--------+
      |                 |
      |   Login User    |
      |                 |
      +--------+--------+
               |
               |
               v
      +--------+--------+
      |                 |
      |  Send Success   |
      |    Message      |
      |                 |
      +-----------------+
      

      Something should immediately stand out here: there are no enclosed regions in this diagram! Furthermore, even our new diagram is much simpler to follow than the old one was.


      Reality is rarely simple.

      The above is a really forgiving example. It has no loops, and loops are going to create enclosed regions that can't be broken apart so easily; it has no conditional branches that are so tightly coupled with the main path of execution that they can't be broken up; and the scope of functionality and side effects are minimal. Sometimes you can't break those regions up. So what do we do when we inevitably encounter these cases?

      High cyclomatic complexity in your program as a whole is inevitable for sufficiently large projects, especially in a production environment, and your efforts to reduce it can only go so far. In fact, I don't recommend trying to remove all or even most instances of cyclomatic complexity at all--instead, you should just be keeping the concept in mind to determine whether or not a function, method, class, module, or other component of your system is accumulating technical debt and therefore in need of refactoring.

      At this point, astute readers might ask, "How does refactoring help if the cyclomatic complexity doesn't actually go away?", and this is a valid concern. The answer to that is simple, however: we're hiding complexity behind abstractions.

      To test this, let's forget about cyclomatic complexity for a moment and instead focus on simplifying the refactored version of our toy example using abstraction:

      <?php
      
      function handleLoginAttempt($login_data) {
          if(!usernameExists($login_data['username'])) {
              sendErrorResponse(getBadUsernameError($login_data['username']));
              return;
          }
      
          $user = getUser($login_data['username']);
          if(isDeleted($user)) {
              sendErrorResponse(getUserDeletedError($user));
              return;
          }
      
          if(isBanned($user)) {
              sendErrorResponse(getUserBannedError($user));
              return;
          }
      
          if(loginRateLimitReached($user)) {
              logBadLoginAttempt($user);
              sendErrorResponse(getLoginRateLimitError($user));
              return;
          }
      
          if(!passwordMatches($user, $login_data['password'])) {
              logBadLoginAttempt($user);
              sendErrorResponse(getBadPasswordError());
              return;
          }
      
          loginUser($user);
          sendSuccessResponse();
      }
      
      $login_data = getLoginCredentialsFromInput();
      
      handleLoginAttempt($login_data);
      
      ?>
      

      The code above is functionally identical to our refactored example from earlier, but has an additional abstraction via a function. Now we can diagram this higher-level abstraction as follows:

      +-----------------+
      |                 |
      |  Program Start  |
      |                 |
      +--------+--------+
               |
               |
               v
      +--------+--------+
      |                 |
      |  Attempt Login  |
      |                 |
      +-----------------+
      

      This is, of course, a pretty extreme example, but this is how we handle thinking about complex program logic. We abstract it down to the barest basics so that we can visualize, in its simplest form, what the program is supposed to do. We don't actually care about the implementation unless we're digging into that specific part of the system, because otherwise we would be so bogged down by the details that we wouldn't be able to reason about what our program is supposed to do.

      Likewise, we can use these abstractions to hide away the cyclomatic complexity underlying different components of our software. This keeps everything clean and clutter-free in our head. And the more we do to keep our smaller components simple and easy to think about, the easier the larger components are to deal with, no matter how much cyclomatic complexity all of those components share as a collective.


      Final Thoughts

      Cyclomatic complexity isn't a bad thing to have in your code. The concept itself is only intended to be used as one of many tools to assess when your code is accumulating too much technical debt. It's a warning sign that you may need to change something, nothing more. But it's an incredibly useful tool to have available to you and you should get comfortable using it.

      As a general rule of thumb, you can usually just take a glance at your code and assess whether or not there's too much cyclomatic complexity in a component by looking for either of the following:

      • Too many loops and/or conditional statements nested within each other, i.e. you have a lot of indentation.
      • Many loops in the same function/method.

      It's not a perfect rule of thumb, but it's useful for at least 90% of your development needs, and there will inevitably be cases where you will prefer to accept some greater cyclomatic complexity because there is some benefit that makes it a better trade-off. Making that judgment is up to you as a developer.

      As always, I'm more than willing to listen to feedback and answer any questions!

      25 votes