1. 2

    In the past, for Vim, I’ve used vim-gutentags to run ctags and that has been alright. My main issues are that it can be slow (and cpu intensive) for very large projects, and you have to manage this tags file (though that isn’t the end of the world).

    I use my own ctags wrapper (a whopping 24 lines of VimScript!) with a set of heuristics that assemble an exclude list (so you don’t waste time parsing crap in node_modules, generated files, caches, virtualenv dirs, etc). I don’t even use a Vim tags plugin - I just bind that function to a hotkey.

    It looks like a ghetto solution, but it’s been working surprisingly well for me. I haven’t touched that code in years, and I use ctags every day!

    1. 16

      I’m glad to see this post.

      I don’t get why people keep bashing PHP so hard. Yes it’s a flawed language, but so is every other language.

      PHP shines at shipping stuff quickly. It’s a pity it gets so much flak.

      1. 32

        Yes it’s a flawed language, but so is every other language.

        No. This both-side-ism has to stop. Not all languages are equal. Some flaws are bigger than others.

        1. 15

          Because PHP has got more wrong than other languages by not even trying.

          It’s funny that, like Java, it is only recognising its faults as faults when its fortunes have changed.

          1. 5

            PHP shines at shipping stuff quickly.

            The downside of this is that it can lead to unimaginable hairballs: a single file that interleaves view, logic, and data models. The standard libraries and the language itself had warts aplenty and actually encouraged obscene coupling and unsafe practices (mysql_escape_string and m_real_e_s I’m looking at you)

            While things have gotten way better - I’ve seen a modern PHP code base at work and it looks rather nice - people have long memories.

            1. 5

              A good chunk of the issues in early libs/functions, is that they’re very thin veneer over the C counterpart. That isn’t an excuse, but it’s the reason. Weird behaviour with Null bytes in your strings? Because that’s how C terminates strings. Weird naming? Most times it’s likely because of the underlying C function naming.

              The good news is, as you’ve both mentioned (and the article too), things are improving at a rapid pace. Some parts seem impossible to remove because of B/C. But remember, the mysql extension was removed from core.

              1. 4

                The downside of this is that it can lead to unimaginable hairballs: a single file that interleaves view, logic, and data models.

                So can every language.

                PHP has great frameworks that will totally prevent that from happening. A “better” language does not trump bad practices.

                I agree with you on the stdlib part though, even though that sort of stuff happens in every language to varying degrees

              2. 4

                I was a long time PHP hater. I still have nightmares from the PHP 4 era.

                Recently I’ve been looking into PHP 7 and 8 and I must admit it has gotten so much better! I like the gradual typing effort. I love the community support for static analysis tools like PHP CS, Phan, etc. Add Composer and IDE’s like PhpStorm/VSCode to the tooling story, and you have a pretty nice ecosystem!

                Compare that to the staggering innovation (sarcasm warning) in the Ruby and Python space that brought us technological wonders like yield_self and the walrus operator. Both ecosystems have stayed more or less the same for the past 10 years. (Yes, I’m aware of the “ML revolution” in Python-land – I herd data and ML models with Python for a living.)

                1. 3

                  In ruby-land we got bundler, performance fixes & the beginnings of basic typing support, which were the only things I really wanted. It’s nice to no longer be stuck running “Ram Use Beyond Y-axis”.

                  1. 2

                    I generally prefer not to be staggered by the innovations in my language ecosystem… that leads to things like Python 3 or Perl 6 where you slowly and painfully (if ever) get widespread adoption, and spend lots of engineering effort just to stay afloat.

                    Also, the need for a bunch of staggering innovation tends to be an indication that you did things wrong to start with. Don’t get me wrong, it’s better to fix it than not, but I wouldn’t necessarily consider that a strong positive indicator in a mature language.

                    1. 2

                      PHP 7 and 8 are okay. It’s basically just Java 7 without generics. But that’s workable. You can use Phan/PHPstan/whatever, but they make the code hideous, IMO. It’s, of course, worth it if you like static typing and have to use PHP. But if you like static typing and don’t have to use PHP, well…

                  1. 8

                    I bought a rowing machine. It turns out Reddit is absolutely uniform in advice that

                    1. rowing is one of the better aerobic exercises you can do in that it’s low impact and works a surprisingly large degree of your muscles, and
                    2. more surprisingly, the only answer for what rowing machine to get is a “Concept 2” brand. i’ve never seen such a uniform product opinion from everyone about anything. try searching reddit for “which rowing machine should i get?”. Amazon (which is sold out) has >5k reviews @ 5 stars. want a cheaper rowing machine? “buy a used concept 2, or just save up”, they say.

                    so I got a Concept 2 rowing machine. Unlike many other types of exercise, I don’t hate it, which means I’ve been much more likely to actually do it.

                    1. 4

                      so I got a Concept 2 rowing machine. Unlike many other types of exercise, I don’t hate it, which means I’ve been much more likely to actually do it.

                      I was going to comment about exercise filling me with energy, and giving me a cool hobby that keeps me away from the keyboard and gets me stronger and healthier in the process.

                      For me it was calisthenics. I stumbled upon the YouTube and IG communities with all the kids doing cool stuff like muscle-ups and front/back levers. Working towards an exciting skill turned workouts from being a chore to being a reward and one of the best parts of the day. I train every day now - why wouldn’t I?

                      Thanks for the Concept 2 rowing machine recommendation! I’m looking into rowing as a running alternative this winter.

                      1. 3

                        my wife is a runner and former cross country coach, but has kind of worn out her knees. she says the rowing machine is better than any elliptical she’s used and at this point she uses it more than me. it is definitely a good indoor choice

                        1. 3

                          I think elliptical and rowing machines are both excellent, probably the best two out of all the machines, as they both exercise much wider sets of muscle groups than most of the others. Can understand elliptical not being great for people with bad knees, although it’s a lot better than running in that regards as there’s no impact. One thing to watch out for with rowing machines is lower and mid back - it’s really important to pay attention to posture and not curve your back too much while rowing as it can put a lot of strain on your spine.

                      2. 3

                        I’d say the same! I row in front of my TV year-round. Perhaps the only cardio I’ve really enjoyed. It helps me sleep longer and eat more intentionally. I’m not suddenly an Olympic god pulling sub-7s, but I feel better. I’m getting better!

                        I’ve almost 3 Mm on my Model D, on the waiting list for the Dynamic rower. There are other rowers, like the RowPerfect3 and the Oartec DX, but I too lean towards C2. I love how they maintain the workout servers, charts, metrics, & CSV downloads.

                        1. 2

                          Concept 2 are very good for the money. I decided against them in favour of a WaterRower because it uses water resistance instead of gears, which means there’s no messing about with levels or anything, you just pull harder if you want more resistance, which seems much more natural to me. And it never ever clicks or clunks and you don’t have the weird fan noise effect. I also think it looks a lot nicer in wood (totally subjective of course), and you can store it upright against a wall so it takes up a lot less space. They are more expensive, admittedly, but lots of the parts have a lifetime guarantee and they’re really good about replacing them. Had mine for over 5 years with barely any problems - just one of the seat rollers broke after maybe 3 years, so I got in touch and told them, and they sent me a pack of 4 new ones, no questions asked. Good company (which I’m not affiliated with!) and a really really nice piece of kit.

                          1. 1

                            I used to row in high school and have nearly completed a basement refurb and reorganization project in part to make space for an erg (aka rower). It’s amazing that such an uncomplicated machine can afford such an excellent, all-body, joint-friendly aerobic workout. The Concept II has been around forever and is excellent.

                          1. 4

                            programmery: I realized I’d only done the first third of 4clojure problems an age ago, so I’m cranking down those, as it’s a milestone I’d like to have behind me.

                            personal: Nccylvat gb cynprf. Zl ghaary bs shaqf vf jvaqvat qbja, naq V srne gur ubyvqnl frnfba vf n onq gvzr sbe gung gb unccra (ernyvfgvpnyyl V’z BX hagvy gur raq bs Wna, naq unir n cebonoyl snyyonpx V fubhyq uvg hc arkg jrrx). Pna’g yrg tb bs gur vqrn bs cvibgvat gb jbex ng n Pybwher fubc, ohg V srry greevoyr fryyvat zlfrys, rfcrpvnyyl ng gur fgneg bs fnvq cvibg, lbh srry?

                            1. 2

                              Orfg bs yhpx jvgu lbhe nccyvpngvbaf!

                              1. 1

                                ty <3

                            1. 4

                              Employees end up deciding most of what a company is using internally, including infrastructure providers.

                              I want to add something very powerful and important to the employee lock-in story - looking cool and professional (The “looking” part being key here). You have two driving forces at play:

                              • Unmotivated employees just wanting to “get the job done” while minimizing risk. To paraphrase the old IBM saying “Nobody got fired for buying AWS.”
                              • Motivated, but inexperienced, employees that want AWS technologies on their CV and are after that Cloud Solutions Architect job title. Hats off to the Amazon marketing department for coming up with the AWS sysadmin/developer certifications.
                              1. 1

                                Hats off to the Amazon marketing department for coming up with the AWS sysadmin/developer certifications.

                                This isn’t exactly new I believe.

                                As in, IBM, Oracle and redhat had similar certifications, correct ?

                                1. 5

                                  Not new at all. It is a great marketing trick, and it works brilliantly every time.

                                  Oh, how proud was I when I became a MICROSOFT CERTIFIED SOLUTIONS DEVELOPER back in the early days of .NET 🤡

                                  I would never consider any other hosting or development platform back then.

                              1. 8

                                Unpopular opinion here – RSI articles that focus on ergonomics, special design keyboards and pointing devices, special chairs and tables are looking at the wrong places. Looking around me, I see a lot of people that have been working in horrible conditions ergonomics-wise for years and have not experienced RSI. I have a feeling there’s an entire RSI industry out there preying on gullible geeks with deep pockets.

                                I think the key to solving such a problem is to focus on yourself. To me RSI is a general health issue symptom. Address the root cause, get healthier and stronger. RSI will disappear.

                                Let’s start with the obvious. Don’t be fat. You’d be amazed how many health issues vanish into thin air once you shed the pounds. Start eating like an adult and eat what you believe is good for you instead of what’s available around you.

                                Next, get stronger. Strength training worked for me by addressing several issues. I will go through each one with a calisthenics (the most fun way to strength-train!) perspective:

                                • Grip training. Don’t assume you need to squeeze weird devices. All you need here is pull-ups and passive hanging from a high bar.
                                • Wrist training. Start with push-ups, progress to dips, handstands are king! Pike push-ups and the general handstand push-up progression will get you bulletproof. Look into gymnastics rings – probably the best bang for your buck fitness device.
                                • Improving posture. The key here is core training. Fun counter-intuitive fact - most people’s backs stop hurting when they strengthen their abs and/or glutes. Bad shoulder posture? Hanging from a bar helps here a lot.

                                Where do I start? I’d go for /r/bodyweightfitness’s Recommended Routine (check the sidebar). Not enjoying calisthenics? Try something else. Kettlebells, dumbbells, traditional barbell work should all be able to get you the same health benefits.

                                “But what about emotional issues, aren’t those real?” Yes, they are. The good news is that once you take care of your health, and get into a consistent strength training program, you will greatly reduce your stress levels and get much more calm and self-confident. You could do additional work on emotional problems, but, even if you don’t, just taking care of the physical issues will help with the emotional ones.

                                1. 1

                                  Next, get stronger. Strength training worked for me by addressing several issues. I will go through each one with a calisthenics (the most fun way to strength-train!) perspective:

                                  Grip training. Don’t assume you need to squeeze weird devices. All you need here is pull-ups and passive hanging from a high bar.

                                  Add to that a bit of specific targeting of pinch strength. It’s easy to grab a steel plate between fingers and thumb or palm the head of a barbell and simply hold it to failure. Switch hands and repeat. Another suggestion is using a weighted wrist roll like this example which builds motion and forearm strength.

                                  Wrist training. Start with push-ups, progress to dips, handstands are king! Pike push-ups and the general handstand push-up progression will get you bulletproof. Look into gymnastics rings – probably the best bang for your buck fitness device.

                                  Those are great but remember that the planche itself is pretty advanced for most people. I was already fit (bike, run, weights) and it’s taken me about a year of 2x weekly practice (yoga) to get a solid crow pose/tuck planche, and then a wobbly planche extension, decent L-sit, and a solid tripod headstand (still working on a handstand without tipping over or hand-walking). I find the balance/priopreception harder than strength. Specific practice instead of fifteen minutes as part of an intermediate/advanced yoga class is probably better if the gymnastics are the goal but the overall benefit of the class works for me.

                                  Where do I start? I’d go for /r/bodyweightfitness’s Recommended Routine (check the sidebar). Not enjoying calisthenics? Try something else. Kettlebells, dumbbells, traditional barbell work should all be able to get you the same health benefits.

                                  I agree about r/bodyweightfitness. A lot of very good advice in the sidebar.

                                1. 98

                                  I don’t write tests to avoid bugs. I write tests to avoid regressions.

                                  1. 14

                                    Exactly. I dislike writing tests, but I dislike fixing regressions even more.

                                    1. 7

                                      And i’d go even further:

                                      I write tests and use typed languages to avoid regressions, especially when refactoring.

                                      A test that just fails when I refactor the internal workings of some subcomponents, is not a helpful test – it just slows me down. 99% of my tests are on the level of treating a service or part of a service as a black box. For a web service this is:

                                      test input (request) -> [black box] -> mocked database/services
                                      

                                      Where black box is my main code.

                                      For NodeJS the combo express/supertest is awesome for the front bit. I wish more web frameworks in Rust etc also had this. I.e. providing ways to “fake run” requests through without having to faff around with server/sockets (and still be confident it does what it should).

                                      1. 5

                                        Now the impish question: what is the correct decision if the test is more annoying to write than the regression is to observe and fix?

                                        1. 3

                                          Indeed!

                                          (I research ways[1] to avoid that. But of course they don’t apply when you’ve already chosen a stack and framework for development. In my day job we just make hard decisions about priority and ROI and fall back sometimes to code comments, documents or oral story-telling.)

                                          [1] https://github.com/akkartik/mu1#readme (first section)

                                          1. 2

                                            Every project is different, but ideally you can invest time in the testing infrastructure such that writing a new test is no longer annoying. I.e, maybe you can write re-usable helper functions and get to the point where a new test means adding an assertion or copy / pasting an existing test and modifying it a bit. The tools used (test harness, mocking library, etc) also play a huge role in whether tests are annoying or not, spending time ensuring you’re using the right ones (and learning how to properly use them) is another way to invest in testing.

                                            The level of effort you should spend on testing infrastructure depends on the scope, scale and longevity of your project. There are definitely domains that will be a pain to test pretty much no matter what.

                                            1. 2

                                              In my experience such testing frameworks tend to add to the problem, rather than solve it. Most testing frameworks I’ve seen are complex and can be tricky to work with and get things right. Especially when a test is broken it can be a pain to deal with.

                                              Tests are hard because you essentially need to keep two functions in your head: the actual code, and the testing code. If you come back to a test after 3 years you don’t really know if the test is broken or the code is broken. It can be a real PITA if you’re using some super-clever DSL testing framework.

                                              People trying to be “too clever” in code can lead to hard to maintain code, people trying to be “too clever” in tests often leads to hard to maintain tests.

                                              Especially in tests I try to avoid needless abstractions and be as “dumb” as possible. I would rather copy/paste the same code 4 times (possible with some slight modifications) than write a helper function for it. It’s just such a pain to backtrack when things inevitably break.

                                              It really doesn’t need to be this hard IMHO; you can fix much of it by letting go of the True Unit Tests™ fixation.

                                              1. 2

                                                I don’t disagree, and I wasn’t trying to suggest using a “clever” testing framework will somehow make your tests less painful. Fwiw I even suggested the copy / paste method in my OP and use it all the time myself :p. My main point was using the right tool / methods for the job.

                                                I will say that the right tool for the job is often the one that is the most well known for the language and domain you’re working in. Inventing a bespoke test harness and trying to force it on the 20 other developers who are already intimately familiar with the “clever” framework isn’t going to help.

                                                1. 2

                                                  Fair enough :-)

                                                  I will say that the right tool for the job is often the one that is the most well known for the language and domain you’re working in. Inventing a bespoke test harness and trying to force it on the 20 other developers who are already intimately familiar with the “clever” framework isn’t going to help.

                                                  I kind of agree because there’s good value in standard tooling, but on the other hand I’ve seen rspec (the “standard tool” for Ruby/Rails testing) create more problems than solve IMHO.

                                          2. 4

                                            When fixing testable bugs you often need that “simplest possible test case” anyway, so you can identify the bug and satisfy yourself that you fixed it. A testing framework should be so effortless that you’d want to use it as the scaffold for executing that test case as you craft the fix. From there you should only be an assert() or two away from a shippable test case.

                                            (While the sort of code I write rarely lends itself to traditional test cases, when I do, the challenge I find is avoiding my habit of writing code defensively. I have to remind myself that I should write the most brittle test case I can, and decide how robust it needs to be if and when it ever triggers a false positive.)

                                            1. 3

                                              +1

                                              This here, at the start of the second paragraphs is the greatest misconception about tests:

                                              In order to be effective, a test needs to exist for some condition not handled by the code.

                                              A lot of folks from the static typing and formal methods crowd treat tests as a poor man’s way of proving correctness or something… This is totally not what they’re for.

                                              1. 1

                                                umm…..aren’t regressions bugs?

                                                1. 9

                                                  Yes, regressions are a class of bug. The unwritten inference akkartik made when saying “I don’t write tests to avoid bugs” is that it is refers specifically to writing tests to pre-empt new bugs before they can be shipped.

                                                  Such defensive use of tests is great if you’re writing code for aircraft engines or financial transactions; whereas if you’re writing a christmas tree light controller as a hobby it might be seen as somewhat obsessive compulsive.

                                                  1. 0

                                                    I-I don’t understand. Tests are there to catch bugs. Why does it matter particularly at what specific point in time the bugs are caught?

                                                    1. 9

                                                      Why does it matter particularly at what specific point in time the bugs are caught?

                                                      Because human nature.

                                                      Often times a client experiencing a bug for the first time is quite lenient and forgiving of the situation. When it’s fixed and then the exact same thing later happens again, the political and financial consequences of that are often much, much worse. People are intensely frustrated by regressions.

                                                      Sure, if we exhaustedly tested everything up front, they might never have experienced the bug in the first place, but given the very limited time and budgets on which many business and enterprise projects operate, prioritizing letting the odd new bug slip through in favor of avoiding regressions often makes a hell of a lot of sense.

                                                      1. 5

                                                        Not sure if you are trolling …

                                                        Out of 1000 bugs a codebase may have, users will never see or experience 950 of them.

                                                        The 50 bugs the user hits though – you really want to make sure to write tests for them, because – based on the fact that the user hit the bug – if it breaks again, the user will immediately know.

                                                        That’s why regression tests give you a really good cost/benefit ratio.

                                                        1. 3

                                                          The specific point in time matters because the risk-reward payoff calculus is wildly different. Avoiding coding errors (“new bugs”) by writing tests takes a lot of effort and generally only ever catches the bugs which you can predict, which can often be a small minority of actual bugs shipped. Whereas avoiding regressions (“old bugs”) by writing tests takes little to no incremental effort.

                                                          People’s opinion of test writing is usually determined by the kind of code they write. Some types of programming are not suited to any kind of automated tests. Some types of programming are all but impossible to do if you’re not writing comprehensive tests for absolutely everything.

                                                          1. 3

                                                            A bug caught by a test before the bad code even lands is much easier to deal with than a bug that is caught after it has already been shipped to millions of users. In general the further along in the CI pipeline it gets caught, the more of a hassle it becomes.

                                                            1. 2

                                                              The article says “look back after a bug is found”. That sounds like they mean bugs caught in later stages (like beta testing, or in production).

                                                              If you define bugs as faults that made it to production, then faults caught by automated tests can’t be bugs, because they wouldn’t have made it to production. It’s just semantics, automated tests catch certain problems early no matter how you call them.

                                                              1. 2

                                                                The whole class of regression tests was omitted from the original article which is why it’s relevant to bring them up here.

                                                                1. 1

                                                                  I’m of the same opinion. It means that the reason why we’re writing tests is not to catch bugs in general, but specifically to catch regression bugs. With this mindset, all other catching of bugs is incidental.