1. 1

    Work: Its the last week at my current position so I am cleaning up loose ends etc.

    Personal: Looking at working on some WPF and .NET Core things because this is where the new focus is.

    1. 19

      I do not agree with the last point. Debuggers are useful and use of one does not point to poor code quality.

      1. 5

        I agree. I don’t see how using a debugger is any different from one of the suggested alternatives:

        Use print statements

        If I see code littered with echo or printf or logging statements, it says to me that you’re not sure what the code is doing there and you want some insight.

          1. 2

            If I see code littered with echo or printf or logging statements, it says to me that you’re not sure what the code is doing there and you want some insight.

            I think this only holds if you know all the ways in which the code is driven from the outside. Many of the bugs I find, at least in my code, are the result of emergent behavior I didn’t completely foresee. They are bugs in their own right, sure, but they tend to be manifest themselves only when my code runs in the scpoe of a larger system.

            In such a case I find it immensely useful to have prints, logs or traces all over the place so that I can see how the system is driven into an error state. Having the prints can also mean you’re not sure how your code is being used.

          2. 5

            95% of the time I have to use a debugger, it is because the code is not written in a simple and obvious way.

            The other 5% of the time it’s because “some other weird thing is going on.”

            Having to use a debugger to understand what code is doing is absolutely a sign of a poor code. Good code can be read on its own and understood with a very high degree of confidence.

            Of course, as a programmer working with other people’s code and legacy systems, knowing how to use a debugger is important. But it still usually means you’re working with code that is overly complex.

            1. 2

              You can also completely understand how a piece of code works, but don’t understand why it exhibits certain behavior. This happens when your code is used in a big opaque system, and it happened to me a lot. For example:

              class Person {
                  public Person(string name, int age) {
                      if (name == "" || name == null || age < 0 || age > 150)
                          throw new Exception("Invalid person.");
                  }
                  
                  ...
              }
              

              If the exception is thrown, it is obviously the caller’s fault. But if this exception shows up, it’s not immediately clear where something is going wrong. You would need to read through the whole code to see what’s happening.

              Especially in languages with pointers or references, it is possible that a reference/pointer is copied somewhere in an unrelated function, and aliases with data you use. This way, data can be overwritten when you don’t expect it to be. I usually debug this by stepping through the code and watching the data.

              … and yes, it does mean that the code is not perfect. But hey, mistakes do happen.

              1. 1

                The problematic code in this case – from the perspective of my original comment – is the system code.

            2. 2

              Debuggers are symptomatic of not understanding the code. Agree or disagree?

              1. 11

                Oscilloscopes are symptomatic of not understanding the circuit.

                1. 2

                  Yes. If you understood what they were doing, you wouldn’t need instrumentation.

                2. 4

                  Debugging is symptomatic of not understanding the code.

                  I think Hintjens is saying your (understanding of the) code & recent change should be so clear you don’t need a debugger, while c-jm is saying debuggers can be useful even when your code is clear and your changes were small. Both are obviously true.

                  1. 2

                    I think they are orthogonal really, code can be clean and hard to debug all at the same time.

                    Elements of “clean” code can also lead to making debugging harder. The more functions you have to do smaller things while more easily readable always introduces context shifts etc.

                    As with everything there are costs and benefits to every decision, all my point was is that in terms of a code quality the need to debug is not a good metric.

                  2. 1

                    What’s “the code” though. Abstractions layered upon abstractions. Finding bugs without debugging in legacy code or multi-threaded code is almost impossible without debugging.

                    1. 2

                      I don’t dispute that.

                      Yet if you indeed are able to understand your code without a debugger, that’s a very good thing.

                  3. 1

                    Often you need to debug code somebody else wrote.

                    1. 1

                      “Need” is the key part. Debuggers are super useful, but if I require them to do my job, then something is wrong.

                      1. 1

                        In my mind, debuggers are a great tool to validate and to enhance your understanding of how the code actually works. I have sympathy with the thought that it should not be necessary to run your code with a debugger to understand it. What I find weird is that the author puts this in a list together with “If your language offers a REPL that’s cool. “ which is for me in the same category of exploratory tool.

                      1. 1

                        Small pet peeve but you should fix the Vue App in the title bar.

                        Otherwise awesome article! :)

                        1. 7

                          It seems like we are going to be seeing a bigger influx of C code ported to Rust in a variety of open source communities. I guess this has already been started by Mozilla, I am glad Rust is finding a place though it’ll be interesting to see the impact on C’s ubiquity through the next decade or so.

                          1. 2

                            I plan on doing a few different things:

                            • Playing DnD tonight with a pretty consistent group.

                            • Put some hours into both WoW Classic and Dark Souls

                            • Fix some work related items that came up through the week.

                            • Squeeze a visit in with relatives.

                            Overall it should be a pretty productive and relaxing weekend.

                            1. 1

                              Dark Souls

                              Which one? Is it your first DS/From game?

                              1. 1

                                Yes the first one. It is my first From game but I have watched quite a bit of BloodBorne.

                                1. 1

                                  Nice! First DS is a masterpiece. I recommend playing without consulting a guide at first. Ideal setup is you have someone who can give you hints/advice without outright spoiling things.

                            1. 1

                              How would this compare to something like BareGrep? Other then the everything integration.

                              1. 4

                                Its vastly inferior.

                                This one supports searching Word, PDF and archives which is great as you commonly have all in code repositories. Searches using XPath and phonetics also, and supports multiline. Colors output etc.

                                There are bunch of bare grep tools, which don’t add anything more on CLI version (they are basically CLI frontends).

                              1. 1

                                Thanks for posting this. I always enjoy Casey’s technical information and expertise. One of the more interesting topics he covered at least in this style was his explanation and demonstration of interpolation https://caseymuratori.com/blog_0014

                                Plus of course Handmade Hero which is an endeavour on itself.

                                1. 2

                                  Going to be working on some infrastructure for a conference I have been working on in my area. Need to revamp the website as well as get the comittee on the same page.

                                  Other then that, probably looking at more Android Xamarin related topics for work!

                                  1. 2

                                    Congrats guys. Nice and easy transitions are the best!

                                    1. 3

                                      Hey,

                                      Everything is going well on my end. I am working on a simple reimplementation of a web server for fun written in C to keep pointers / network programming fresh. Also working on keeping up to date for frontend web technologies at my job. Overall things are going well.

                                      1. 2

                                        Low level programming, writing slam poetry, basketball and livestreaming