Comparing objects in .NET and general thoughts on testing

I had a little task today at work, where I needed to replace the way I created a JSON object that was being returned from an API. Long story, but the challenge at the end was to make sure I didn’t screw it up, so I wanted an easy way to compare the “before” and “after” JSON. Now, I was adding a feature here, so the before and after were going to be different, but I wanted to have an easy way to check that they were different only where I expected them to be, and there weren’t any unexpected side-effects.

This let me down a rabbit hole, looking at things like this ObjectsComparer package on GitHub. I also stumbled across this JSON extension for FluentAssertions. In the end, I just wrote a script in LINQPad to dump the before & after JSON to disk, then compared it with Beyond Compare. I keep thinking that I need to put together a better testing framework for my API, so I can better automate this kind of stuff.

I don’t have a unit test project for this API, or any other really structured tests. I have a test client that can run a suite of “safe” tests that don’t alter data, and checks a few things on the results. But it’s not a very complete test set. And I have another client that runs a test cycle that does alter data, and hence needs to be run carefully, and can’t be run too frequently. (And that one isn’t very complete or thorough either.) And I have some LINQPad tests that I run mostly as smoke tests.

I’m currently working my way through the TDD section of the Clean Code series that I’ve been watching/reading. I’ve always liked the idea of TDD, but I’ve rarely worked on a system where it seemed practical. (I’m not saying that it’s not practical, just that I haven’t figured out how to effectively apply it to any of my typical work.) Regardless of TDD, I ought to be able to put together some better and more automated tests for some of my work.

second thoughts, and other distractions

So after spending $300 on NYCC tickets yesterday, today I stumble across this article: Coronavirus wave this fall and winter could potentially infect 100 million, White House warns. So, yeah, that October con in New York is sounding like less of a good idea.

I found that article while going down a slight rabbit hole at work. I took a quick break to look at Hacker News, which led me to this notice on Jason Kottke’s blog that he’s taking a sabbatical. That led me to follow a couple of links at the end of his post, to Dave Pell’s and Craig Mod’s sites. And something at one or the other of those led me to the aforementioned CNN article.

I say all that to illustrate the fact that I’m easily distracted, and I’m trying to get better about that. I’m finding a little guidance on that in some of the stuff I’m reading right now, and in some of the guided meditations I’ve been doing recently. But I’m still really distractable. I think maybe I need to get back to using a pomodoro timer. I blogged about distraction about a year ago, and did the pomodoro thing for a while, but didn’t stick with it.

Oh, and to follow up on the financial stuff in yesterday’s post: that’s getting even worse too. See here: Wall Street, dragged down by tech stocks, racks up more heavy losses. So, yeah, maybe I should just live in the moment?

NYCC 2022 and other comics stuff

In addition to the random programming stuff I was working on earlier, I also decided to jump into the queue for NYCC tickets today. The pre-sale started at 10 AM today. I really wasn’t sure I wanted to bother with it, and I did want to go to the farmers market this morning at 10, so that won out. I came home with some radishes, carrots, and pickles around 10:30, and I checked in on the pre-sale at 10:45. They hadn’t sold out, so I jumped in the queue, just out of curiosity, to see how long it would take to get through, and whether or not they’d sell out of tickets before then.

Well, I just left the queue open in a browser tab while I did other stuff, and noticed that I’d made it through around 11:15. By that time, they’d sold out of “VIP” tickets, but regular 4-day tickets were still available. They were also priced at $210, which was a bit of a shock. (But, looking back at my post from last year, I realize that it’s actually a little cheaper than 2021, when they didn’t sell 4-day tickets, so you’d have to pay $240 for four $60 single-day tickets.) I was prepared to close the tab and say “screw it,” but some wild optimistic impulse got me to go ahead and buy a 4-day ticket anyway.

With a t-shirt added on, plus tax and shipping, my total was just under $300, which seems kind of crazy to me. Especially since I’m not even sure if I’ll go. I’m still pretty nervous about COVID and large gatherings. I did go in last year, but only for one day, and I got sick afterward. (Though probably not sick with COVID.) And I got sick after my trip to Albany in March. (Again, probably not COVID.) So I might punt on actually going to this thing.

We’re nearly at one million Americans dead of COVID now. NYCC is in October. I don’t really know what the COVID situation will be then, but I’m pretty sure it won’t be gone, and I’m pretty sure that a lot of people still won’t be taking it as seriously as they should. So going in to NYC for this will be a bit of a crapshoot.

I guess I’m not as worried about losing $300 now as I would normally be, since I looked at my Merrill statement yesterday. Without getting into specific numbers, let’s just say that I lost more money in April than my  total yearly salary in 2010. And May might be even more volatile. So $300 seems like a fairly minor loss, seen from that perspective. And, with inflation, that might not even be enough money to fill my gas tank at this time next year. So why not spend it on a comic book convention that I might not even attend?

(And yes, I know that I didn’t really “lose” any money on my Merrill statement. My total portfolio value dropped. I still have all the same mutual funds I had at the beginning of the month. The value will likely go back up again before I retire. And I’m not retiring for at least ten years, so I’m not cashing in any of those mutual funds any time soon. But still…)

In other comics news, I was saddened to hear of the deaths of two of my favorite artists, Neal Adams and George Pérez, recently. Adams did most of his most famous work before I was reading comics, so I’m familiar with his best work mostly through reprints. I’ve got the nice hardcover volumes collecting his Batman work, and I really love that stuff. I’ve seen him at conventions a number of times, but never thought to get anything signed by him, and I never actually talked to him, though.

Pérez did his most famous work when I was really in that “sweet spot” as a young fan, in the 80s, with enough money to buy a reasonable number of books, enough time to read them, and the right mindset to really get blown away by his work. I really loved his Teen Titans run, with Marv Wolfman, that started in 1980. and I loved his Avengers run, with Kurt Busiek, in the 90s. And so much of his other work was great too.

One more comics-related tidbit: I went to my local comic book store yesterday for Free Comic Book Day. It was pretty crowded, despite it being a rainy day. They limited people to three free books each. I got Red Sonja, Doctor Who, and Donald Duck! The Red Sonja book was a reprint of an old Frank Thorne story, so I grabbed that, even though I’m sure I already have it in a reprint collection somewhere. And you can’t go wrong with Doctor Who and Donald Duck. Marvel and DC, of course, had multiple FCBD books.  But I have no idea what’s going on right now in either the Marvel or DC universe, and I really don’t have the spare time (or the inclination) to get up to speed on all that. It looks like a few of the other FCBD books are available digitally on Amazon/Comixology now too, so maybe I’ll pick up a few more that way.

Clean Code, Visual Studio, Windows 11, and a bit more on ebooks

I wanted to add some more notes about the whole Kindle, EPUB, MOBI, etc. thing that I’ve been blogging about in my last few posts. As I mentioned a few posts back, I’ve been working my way through the Clean Code learning path in O’Reilly. Since I’m probably going to lose access to O’Reilly before I’m done with that, I thought I’d buy a copy of the Clean Code book, so I could finish reading it at my leisure, and to have it for later reference. With tech books, I usually like buying a DRM-free ebook directly from the publisher, when possible. In this case, I initially had some trouble finding that, but eventually figured out that it’s purchasable through the InformIT site. I bought the Robert C. Martin Clean Code Collection ebook, which contains both Clean Code and The Clean Coder. I had a discount code, so it was about $40 total.

I copied the EPUB, MOBI, and PDF files for the book to OneDrive. There are a number of ways I can read an ebook on my iPad, if it’s DRM-free and available in multiple formats. For this one, I wound up sending it from OneDrive into my Kindle app, as a MOBI file. That method still doesn’t support EPUBs. And it will copy the file up into my Kindle library, which is nice. I don’t think I’d ever copied anything into the Kindle library that way before, but it worked fine. I also copied the PDF into GoodReader. The code listings in the MOBI version look a little weird, which is a common problem with tech ebooks, so it’s nice to have the PDF handy as an alternative.

Clean Code has some example refactorings that are fairly interesting. They’re all in Java, but I thought it might be interesting to take the original Java code for one of the examples, convert it to C#, get it working, then work through some refactoring that’s similar to what Uncle Bob does in the book/videos. I found some of the code for the examples in GitHub under the Clean Code Kata user account. (I’m not sure if that’s an “official” account for Bob Martin or his organization, but either way, the code is there.)

This idea to convert some of the examples to C# and work through them was prompted in part by a desire to set up a .NET dev environment of some sort on one of my personal machines, and to maybe experiment a bit with some of the more recent .NET stuff, like .NET 6 and VS 2022. I realized that I don’t currently have any dev stuff at all set up on my desktop PC, my MacBook, or my Lenovo laptop. The MacBook is new, so I just haven’t set any dev stuff up yet. The Lenovo was bought in 2020, and I haven’t gotten much use out of it at all. And I’ve been trying to keep the desktop PC free of any heavyweight dev tools, since I just want to keep it clean for personal productivity stuff. After going back and forth on a few possible setups, I decided to install Visual Studio 2022 (Community edition) on my Lenovo laptop. I considered just installing the .NET 6 SDK and Visual Studio Code, which would have been much more lightweight, but I’m used to using the full VS product, and I can’t see a reason not to use it. And the Lenovo is the best place to install it, since I can wipe out that machine entirely and start fresh if things get too messed up. I’ve also recently upgraded that laptop to Windows 11, so this was also an opportunity to (finally) give that a try.

Of course, I’ve had other things to do this weekend too, so I’ve only gotten as far as installing Visual Studio and git, and tweaking some settings. Maybe I’ll actually do some programming next weekend. (Or maybe I’ll get distracted by something else, and the whole thing will fall by the wayside.)

more Kindle stuff

The last couple of Kindle-related posts, and the news about MOBI vs EPUB support, got me thinking a bit today. I remembered that I had a bunch of old DRM-free books from Tor.com that I’d never gotten into my Kindle library. I had manually copied a bunch of them over to my old Kindle, via USB, but that doesn’t get them into the cloud library, and I hadn’t copied them over to my new Kindle. So I decided to waste some time today and copy some of them up to the cloud, and also add them to Goodreads.

I decided to try the Send to Kindle desktop app (for PC) this time. The app is a little clunky, but it works. Sadly, it only allows you to upload one book at a time. Also, it lets you edit the metadata for the book, but I think that metadata gets overwritten once the book is in the cloud. The files I uploaded were actually .PRC files, which I think is basically the same as .MOBI, though I’m not entirely clear on that.

I also considered copying these files into Calibre and then pushing them to the Kindle from there. I keep thinking that I should start actively using Calibre, but I keep not doing that. I’m a little worried that if I start pulling stuff into Calibre, organizing it, and editing metadata, I’ll never stop. Maybe one of these days, when I’m bored, I’ll give it a try.

The files I copied over today were all free Tor books from 2008 and 2009. I’ve been downloading free Tor books on and off since 2008. I’ve got a bunch from 2008-2009, then more from 2017-2020. Then I forgot about the whole free book thing in 2021, and didn’t download anything. Today, I downloaded a bundle of three books from Tor, for the first time since late in 2020. No clue when/if I’ll actually read those, but hey, I’ve got them.

I’ve been concentrating on reading older books this year, getting through some stuff from old Humble bundles mostly. Looking at my Goodreads “want to read” list, I see that it’s currently at 493 books. Sigh. I keep needing to remind myself that having a lot of books to read is good. It’s not a list of work I have to do, it’s a list of fun I can choose to have…

Kindle EPUB support

This is a follow-up to yesterday’s post about file formats. I saw an article on The Verge today about Amazon’s support for EPUB on Kindle. The article is really just restating this other article from Good E-Reader. Both articles, I think, are slightly wrong. The documentation from Amazon lists EPUB as currently being supported by the Send To Kindle email service, with support for EPUB coming to the Send To Kindle applications in late 2022. A minor point, but I’m pretty sure that sending EPUBs to the Kindle works now, as long as you do it via email.

And it’s worth noting that this isn’t native EPUB support on the actual Kindle. It’s just support for automatic conversion from EPUB as part of the Send To Kindle service.

fun with file formats

I’ve been reading some random old stuff from an old Neil Gaiman Humble bundle recently, and I’ve hit a couple of snags with files. I thought writing up some notes on that might be useful.

First, I was trying to read two old comics from the bundle. I’d loaded both, in CBZ format, to my iPad in the Panels app. Both were black & white comics, originally published by Knockabout Comics. I think they were probably published in a larger format than typical American comics. And it seems that they didn’t do a good job of scanning them in and digitizing them. So they were a little too blurry for me to read. I first tried copying the PDF versions into Panels, to see if they were better. They were, but not by much, and zooming them didn’t work well. Then I got the idea to try the same PDFs in GoodReader. I bought GoodReader a long time ago, and don’t really use it that often. But it turns out that it’s a much better PDF reader than Panels is. So the lesson here is: stick with GoodReader for PDFs.

Second, I decided to copy a couple of the ebooks from the bundle to my Kindle Paperwhite. The easiest way to do that is to email them to the Kindle Personal Documents Service. This service has changed a bit over the years, but, in general, it allows you to email DRM-free ebooks to a special address, and they’ll get converted to Kindle format and pushed down to your Kindle. I had some problems with it this time.

The service is supposed to support both EPUB and MOBI files right now. I’m fairly sure that it didn’t support EPUB until fairly recently. And the support page for it right now says that it’ll stop supporting MOBI files later this year. I’ve always thought of MOBI as the Amazon/Kindle format, and EPUB as the “everybody else” ebook format. The MOBI format was created by Mobipocket in 2000. The company was bought by Amazon in 2005. The original AZW format used for DRM’d Kindle books is a variant on MOBI.

Anyway, I tried sending both MOBI and EPUB versions of the books to my Kindle and they all failed. That led me down a bunch of paths that didn’t lead anywhere interesting. Finally, I got the bright idea to email the files from my PC instead of my Mac. These days, I don’t think there’s any reason the files would be different on the Mac vs the PC, but it seemed like it was worth a try. And indeed it worked when I emailed the files from my PC. On both platforms, I used the web-based Fastmail interface, running in Firefox, so it can’t be a browser thing or an email client thing. So I’m pretty confused about that. I guess the lesson from this one is to always email docs from my PC instead of my Mac when using the Send to Kindle service.

Overall, I think I’ve now spent more time today screwing around with files than I have actually reading anything. But that happens sometimes. And that’s OK. I’m one of those weirdos who can have fun with this kind of troubleshooting.

Scrum and tech learning follow-up

This post is a follow-up to my previous post on scrum and tech learning. Since then, I’ve finished reading The Elements of Scrum, via my (work) Percipio account. I’ve also downloaded the audiobook version of Scrum: The Art of Doing Twice the Work in Half the Time, from my (ACM) Skillsoft account. I normally wouldn’t think about consuming tech books in audio format, and most of them wouldn’t work that way. But maybe a scrum book would be comprehensible as audio, so I’ll give it a try.

There’s another scrum book I was considering, Scrum: A Pocket Guide, which I’ve found is also available in audio format, via the author’s YouTube channel. So, in this case, you can actually watch the author sitting at his desk, reading his own book. I don’t think I actually want to do that, in this case, but it was nice of him to do that and put it out there for free.

Meanwhile, I logged in to my ACM O’Reilly account today, to see if there was anything I really wanted to watch or read before the account gets shut down. I decided to take a look at Bob Martin’s Clean Code video series. I watched the first hour-long video. There’s about fifty hours of video in the series, all told. In O’Reilly, it’s organized as a “Learning Path” with the videos interspersed with chapters from his Clean Code book. I’ve been meaning to read that book for a while. It was published in 2008, so it’s probably a bit out of date at this point, at least in terms of some of the specifics. For the videos, you can also find them for sale at the Clean Coders web site. (They’re not cheap.) You can find a few on YouTube. Here’s a link to the first one, which is the one I watched today. (I think the one I watched on O’Reilly is actually a revised version of that.) He definitely tries to keep it interesting, with a bunch of different costumes and backdrops, including several Star Trek ones. It comes off as pretty corny, but I guess it’s better than just watching him read through the material at his desk.

With the changes we’re going through at work, I’ve decided that now is a good time to back up a bit and think about what new stuff I need to learn, or old stuff I need to reinforce and/or brush up on. I’ve probably read enough on scrum by now, though I may branch out and read up on some related topics. And the Clean Code stuff is the kind of thing I like to check out occasionally, to remind myself of some of the fundamentals of good coding, and maybe learn a few new things that I hadn’t stumbled across before.

I’ve also been listening to some of the recent podcast episodes from .NET Rocks around the twentieth anniversary of .NET, which happened back in February. (I stopped subscribing to .NET Rocks a while back, so I don’t listen to it every week, but I go in and cherry pick interesting or relevant episodes once in a while.) Listening to folks like Anders Hejlsberg, Scott Guthrie, and Miguel de Icaza reminisce about .NET was fun. And it got me thinking about what new stuff is going on with .NET that I should learn. Maybe Blazor? Or I should figure out what’s new and interesting with .NET 6? Or I should try to get back into F# again? I don’t know. Maybe I should pick up this Apress Microsoft book bundle from Humble. That would keep me out of trouble for a while, right?

Scrum at work, and tech learning subscriptions

My team at work is going through some changes right now. We’re getting shuffled to a different spot in the IT department hierarchy and getting a new boss. And we’re supposed to start doing scrum.

Actually, we were supposed to start doing scrum almost a year ago, and we kinda started doing it, but we didn’t really go all the way with it. So now, I guess, we’re supposed to go all-in. Or almost all-in. Or something like that.

Anyway, I watched some training videos for scrum last year when we were supposed to start using it, so I already have some understanding of it. But now that we’re going to be going further with it, I decided to do some more reading on it and try to learn more about it.

I wanted to read a book on scrum, and since we’re using Azure DevOps, I decided to try this one: Professional Scrum Development with Azure DevOps, from Microsoft Press. I started reading it in March, and finished it a couple of weeks ago. It wasn’t a bad book, and it does cover the Azure DevOps scrum process pretty well, but it was also pretty dry, and I’m not sure that a lot of it is really going to be relevant to me.

I’ve also considered reading Zombie Scrum Survival Guide. It might be a little cynical to assume that our implementation of scrum is going to fit the definition of “zombie scrum,” but I suspect it might, and I’m not sure what the best way would be to engage with that.

And A Scrum Book: The Spirit of the Game might also be a good general scrum book to read. Honestly, it looks a bit daunting though.

On the related general subject of tech books, I’ve recently learned that ACM is going to lose access to O’Reilly Learning (previously known as Safari) in July. That’s quite a disappointment, but not entirely surprising. ACM got access to the full Safari library in 2017. That always seemed a bit weird to me, since an ACM membership costs about $100/year, and a regular individual O’Reilly membership costs $500/year, raising the question of why anybody would buy one through O’Reilly rather than just signing up for ACM. I guess that logic finally caught up with them, so now they’re cutting it off.

O’Reilly has offered ACM members a $100 discount, so that would bring it down to $400/year, but that’s still a lot of money, and the discount is only good for the first year. I generally only read a few tech books each year, and I can generally buy them for $40 or $50 each, so I guess it’s not going to be worth it to sign up for a paid O’Reilly account.

ACM still has SkillSoft, and I think I still have access to Percipio through work, but neither of those has the broad selection of tech books and videos that O’Reilly has. (And I think SkillSoft and Percipio are actually the same thing, under different names, possibly with slightly different libraries?) I also have access to LinkedIn Learning, both through work, and (last time I checked) through the local public library. LinkedIn Learning really just has videos though, no books. And their video courses generally aren’t as in-depth as the stuff I could get through O’Reilly. I discontinued my Pluralsight subscription this year, so I don’t have that anymore, either.

For now, I guess I’ll take a look at Skillsoft/Percipio when I’m looking to read up on a new tech subject, and see what they’ve got. When I really want a specific book that they don’t have, I’ll probably just buy it from Amazon or directly from the publisher. I’ve been trying not to buy physical tech books anymore, and O’Reilly has certainly helped with that. A lot of the tech publishers still offer direct sales of DRM-free ebooks, so I’ll probably go that route when I can, rather than getting the DRM’d versions from Amazon.

fourth shot

On Monday of this week, I got my second COVID vaccine booster shot. So my vaccine card is full now. The first shot was in April 2021, the second in May 2021, and the first booster was in December 2021. I should be used to the vaccine side-effects by now, but I was a little surprised about how bad it was this time. I was fine Monday and Tuesday, but then it hit me on Wednesday, and I had to take a half-day Wednesday and a full sick day Thursday. I’m pretty much back to normal today (Friday).

I assume this was the vaccine side-effects, but it could have just been a cold that I got, coincidentally, right after the vaccine shot. I did go out to dinner on Tuesday, so maybe I picked up some germs there. It was a small restaurant, and it wasn’t crowded, so I figured I was relatively safe.

We’re going through a lot of changes at work right now, and I’m pretty busy, so this wasn’t a great week to lose a day and a half, but hopefully I can catch up next week.

I have a bunch of other stuff that I want to blog about, but I don’t really have my thoughts organized. For now, I just wanted to post something about the vaccine booster, for possible future reference. I’m assuming that I’ll probably need one or two more boosters this year, given the way things are going. Maybe in August and December? It’ll be interesting to come back to this at the end of the year and see how things are going with COVID. Will things get better? Worse? Both? Neither?