Category: Blog

  • Microservices and Databases

    I ran across a post on microservices recently and was intrigued. I always like the idea of loosely coupled, independent items in software. However the idea of microservices causes issues with databases. Here’s the section in the piece by Netflix: Create a separate data store for each microservice.

    I tend to think of microservices is very small, tightly bound components of software. If that’s the case, how can I separate each item in a database? Do I want dozens of databases?

    I got in an argument with a developer a few months ago about this. The developer was sure that having separate databases (or stores) for each component wasn’t an issue. For things like banking and similar transfers, I’m not sure a microservice can be separated safely and still ensure integrity.

    This is a tough concept for architecture, and I need to read more and understand how this could work in practice. I suspect that in places where things could be separate, you could easily use schemas in a database to separate out microservices from each other. If each service includes its own connection information, then using schemas would work and still allow for scale out to other databases if needed.

    This is an area that certainly fits larger scale applications like Netflix and Spotify, but for many of us, our applications seem to be more tightly tied together.

    Or are they?

    Microservices are much like Service-Oriented Architecture (SOA), which I think fits many applications. I’m not sure how similar the concepts are, but this is certainly an area I’d like to learn more about.

  • Toshiba Portege Z30 Review

    I saw recently that Grant Fritchey wrote a review of his laptop, the Portege Z30. I had noted Grant’s issues with laptops and waited to see what he got last year before I replaced mine. I actually had the chance to compare his Z30 with my old Lenovo T430 in Washington DC and was impressed.

    With my old machine randomly failing, I decided to duplicate Grant’s efforts and get the same model. I figured we could support each other, and any issues one of us had, the IT department at Red Gate would gain knowledge as well.

    Size and Shape

    I used to have a MacBook Air and was thinking to go back to one, but since it wasn’t updated to contain 16GB, I couldn’t. I considered a MacBook pro, but they are a bit heavy, and the Z30 was fairly light. Here’s a shot of it.

    Photo Mar 30, 11 07 23 AM

    It’s definitely thicker and heavier than the Air, but it’s thinner and lighter than my Lenovo, so that’s nice. This is actually the test I use for laptops:

    Photo Mar 30, 11 07 34 AM

    Since I’m on the go, and I can be getting on and off podiums, I need to be able to easily carry this one handed. Not that I always do, but I want to. I can’t do this with a MacBook Pro and it was hard with the Lenovo. Here it seems to be OK.

    The construction is metal and fairly solid. Not a lot of flex. The thin frame with rounded corners also easily slips in and out of my Everki bag, something that wasn’t the case with the Lenovo.

    Keyboard

    I think the keyboard is important and I wished I’d spent a bit more time on Grant’s. It’s loud, There’s a noticeable clacking when I type and the travel isn’t great. I’m not sure what to make of it. It’s mildly annoying to me, but not overly so.

    the layout is good. Better than the Lenovo or Air for me. That’s the key, it’s better for me.

    Photo Mar 30, 11 20 23 AM

    I used the arrow keys a lot when demoing and having them separate is good. The Lenovo surrounded them with Page Up/Down, which forever caused me issues. Backspace/delete as well placed for me and I’ve easily learned where they are.

    Backlighting is automatic, as you type. Slightly annoying when I need to start typing in dim space, but I can hit a key and then backspace and be fine.

    The trackpad is too large for me. My palms always hit it, so I’ve disabled it. I use the pointed (blue button in the middle) exclusively, which is OK. I haven’t gotten it tuned well for my use. It’s either too slow or too fast (hence arrow key use). However it works just like the Lenovos.

    The buttons, however, on the trackpad feel cheap. They travel and click too much. We’ll see how they wear over time.

    Screen

    The screen is pretty nice. I didn’t notice this as being amazing, as I did with a few cell phones, but it does look good. It handles bright sunlight fairly well, and I haven’t add brightness issues during indoor use. You can get specs from the Toshiba site.

    It’s a 13" screen, which works for me. The resolution is fairly good, but I’m not too picky here so you’ll have to make your own judgment.

    I will say that I like the touch screen. I do a lot of reading and scrolling around, and I’ve found it handy to reach up with my right hand and scroll while I’m holding the laptop with the left hand. I don’t use it to select or press buttons often, especially as edit boxes often bring up the on screen keyboard. That’s really annoying.

    On the upside, I can use VGA or HDMI as outs to a screen.

    Ports

    I present with my laptop, so having a few USB ports is a must. The new Air with one port doesn’t even come close for me. I often need two USB ports for a mouse and my presentation device, plus power. Plus display.

    This is a good laptop for me. It has two USB-3 ports on the right side and 1 on the left. That allows me to move an adapter depending on where I’m presenting. This also has a hard Ethernet port, which has saved me in a few hotels or venues where the wi-fi didn’t work. Not a big deal, but nice.

    All ports are on the sides. Nothing in back.

    Power

    This is one of the big things for me. We have a power brick, but it’s tiny. It’s light. It’s a few ounces, which is amazing after the larger ones that I’ve had. It’s probably lighter than the Air adapter, though it’s still the power cord plugs into the adapter, which plugs into the laptop.

    One thing I’ll note is I forgot my adapter in Europe and had to buy a new one. A generic one, putting out the 19V worked fine. Nice to know I can easily find one, and now I have a US and UK adapter, which suits my work.

    Overall

    I’ve been using the laptop for about three months now, and it’s one of the better machines I’ve owned. The keyboard and mouse buttons are the only downsides for me. The i5 and 16GB of RAM perform great. The SSD has been fast, and I can hook up an external when I need it and still have my two ports free for other use.

    I’d have to say I’d recommend this if you need 16GB of RAM. If you can get by with less, I think you have some other choices in the ultrabook range that I’d look at.

  • The April Blogger Challenge

    I’d encourage you to take Ed Leighton-Dick’s challenge to blog in April. Read his post, start writing, and put your post out there. Tweet about it, and be proud.

    However, if you’ve never blogged, I have a modification for you. Publish privately. The important thing is to just start writing and communicating.

    If you’re looking for help getting started, I’ve got a few posts for you:

    Blogging is a great way to give potential employers some insight into who you are. My view is this can only help you find a better job that’s a good fit for you. If you work at it and to it well.

  • tSQLt with TRY..CATCH

    Someone asked me the question recently about how tSQLt works with TRY..CATCH blocks and the exceptions that we might test for. It works fine, just as it would with other code, but you need to understand that a CATCH still needs to re-throw an exception.

    Here’s a short example. I’ve got this query, which has issues.

    SELECT TOP 10
             cs.CustomerID
         ,   cs.LastSale
         ,   cs.Salesman
         ,   CAST(cs.SaleValue AS NUMERIC)
         FROM
             dbo.CustomerSales AS cs;

    If I run it, I get this:

    Msg 8115, Level 16, State 6, Line 1
    Arithmetic overflow error converting varbinary to data type numeric.

    The CAST here has issues, but that’s fine. Perhaps it’s a data issue, perhaps something else. I can test for that, but for now, I want to be sure I handle these errors correctly.

    Now, I embed that in a TRY..CATCH block.

        BEGIN TRY
            SELECT TOP 10
                    cs.CustomerID
                ,   cs.LastSale
                ,   cs.Salesman
                ,   CAST(cs.SaleValue AS NUMERIC)
                FROM
                    dbo.CustomerSales AS cs;
        END TRY
        BEGIN CATCH
            SELECT @@ERROR
                ,  ‘A CASTing Error has occurred.’
            ;

        END CATCH;

    If I do this, and in the CATCH block I "handle" the error, I’m not really error handling. I’m error swallowing. Here are my results.

    EXEC spGetCommission 12

    casterror

    I could log this, or try to return some data with a new query, maybe alter something that ensures the client gets results, but what I really need to do is give an error back, but one I’m aware of.

    We could delve into error handling, but I won’t do that here. Instead, I want to be sure the application gets an error, when we have an error. It can then decide what the user does or sees.

    If I write this test:

    ALTER PROCEDURE [misc procs].[test spGetCommission Exceptions]
    AS
    BEGIN

    — Assemble
    EXEC tsqlt.ExpectException;

    — ACT
    EXEC dbo.spGetCommission @userid = 0 — int

    — Assert
    END;

    Now I can run it, but it fails. I see the failure

    test1

    and I see this in the results

    test2

    What I should have is something more like this:

        BEGIN CATCH
            THROW 51001,  ‘An CASTING Error has occurred.’, 1;
        END CATCH;

     

    Then my test should be looking for that message.

    ALTER PROCEDURE [misc procs].[test spGetCommission Exceptions]
    AS
    BEGIN

    — Assemble
    EXEC tsqlt.ExpectException
       @ExpectedMessage = ‘An CASTING Error has occurred.’
       , @ExpectedErrorNumber = 51001
    ;

    — ACT
    EXEC dbo.spGetCommission @userid = 0 — int

    — Assert

     
    END;

    If I do that, things work well. The error is handled, but also re-thrown, and my test passes.

    test3