Falling in love again
Once upon a time, back in school, I discovered Cloud 9. A website that gives you an IDE in your web browser? And root terminal access to your very own Linux VM? I was in heaven. I had a beefy machine at work, but for my school work, I just had an old refurbished Chromebook. But I loved my old Chromebook, and didn’t want to spend a bunch of money getting a proper laptop just to haul in my backpack to school every day so that I could compile code for my C or Java class. Plus, I needed Python for this and my other blog running on Jekyll. And Node for the Echo and Google Home actions I was working on on the side. Cloud 9 fit that need perfectly. I could spin up a new project for each stack and edit right from my Chromebook.
But really, editing on Cloud 9 is not the same as editing on a proper IDE.
Casting stinks. Generic classes are worse.
Let’s go on an imaginary journey in class design for a minute.
Suppose that you have the following classes representing vehicles. You go the polymorphic approach and either write them to inherit from a common base class or implement a common interface
Help, these objects have the same shape but don't share an interface!
I’m in a bit of a conundrum, and I can’t seem to find anywhere online where someone has addressed it. Here’s what I’m dealing with:
I’m using a third-party library to parse some documents into objects. Unfortunately for me, the documents are not XML or JSON, hence the need for this third-party library. Doubly unfortunate, the schema of this document type comes in three different versions, mostly the same but slightly different. These differences are represented in the objects that this third-party library returns.
Here’s an example of what I’m talking about. Three POCO classes, each representing an order version
LINQ, I love you, but I'm going back to my roots
So, I faced an interesting situation today. I was getting a collection of objects from a database using a stored proc, but I only needed some of the objects that were returned. And I had to return the objects as a List.
Sounds like a good job for a LINQ where clause, right?
Ah, nice. Short. Readable. Beautiful. And unfortunately, not a good idea in this case.
Hacking in everyday life (fun with the Sprint API)
Let me explain the situation I found myself in last week:
If you didn’t already know, Sprint is offering a free year of unlimited service through the end of July if you port your non-Sprint number to them. It’s a great deal, but if you are not a Verizon customer, they really make you work for it. If you’re with a smaller carrier, the free years page will probably say you are ineligible, even if you have an eligible type of device. That’s because Sprint maintains its own database of phones with some indicator on each record saying whether the phone is on the Sprint network or not (you heard me right: a database of phones that are not on their network). So, if your carrier (like mine) has not told Sprint that your phone is not on the Sprint network, the Sprint system assumes you are ineligible for the offer.
The solution is to create a support case with Sprint to get your device info (WiFi MAC address, IMEI number, phone number, make/model, and current carrier) added to that database. From the experience of family members who tried this, I know it would take up to three days for the information to get processed into the database and reflected on the free year page, and potentially longer for me to get the email from Sprint saying everything is hunky-dory. But time was of the essence, so I would have to check the free year page every few hours to try and find out when the offer was available for each of the devices I wanted to port. What a hassle!
This is where being a developer comes in handy.