TypeScript – how to make JavaScript bearable – Part 1

I vaguely remember some talk about JavaScript that called it write-only language. Truth be told it was probably about some other, even more, obscure and ‘unconstrained’ language (and by ‘unconstrained‘ mean one with several different solutions for a particular problem), but it fits JavaScript pretty nicely.

There is a hilarious video about it, which every aspiring JavaScript programmer should see – JavaScript Wat.

Continue reading “TypeScript – how to make JavaScript bearable – Part 1”

Regular expressions in VS

Today one of the new developers on our team made a textbook mistake when creating test data for one of our system. He crafted by hand dozens of objects that would initialize repositories used by the system and wrote a bunch of tests that asserted overall flow and transformations of that data.

This worked really well, and we decided to use this data for initial UAT tests. But after deployment a straightforward error kept appearing:

String was not recognized as a valid DateTime.

Continue reading “Regular expressions in VS”

Building Azure functions project on TeamCity

I would not reccomend for anyone to follow my steps described here while trying to solve similiar issue. It’s more to highlight a path I’ve taken than to give you a proper solution. My solution is probably deeply flawed and for proper DevOps would look more like flailing in the wind than anything else. You’ve been warned.

There are days, when DevOps seems just easy and a little boring. Those are the days when everything works, and problems you encounter are ‘I forgot to check-in .csproj file’ kind. And there are days when you just try to pull your hair from your head just to experience a lower level of pain, then when dealing with this particular build problem.

Let’s do it as Azure functions project

Continue reading “Building Azure functions project on TeamCity”

Mocking internal interfaces

Yesterday I’ve worked on connector library used to access data warehouses provided by two external vendors. In order for it to be easy to use I limited public members to:

  • library interface – can be used to aggregate connectors and testing
  • two connector classes that provide public methods to retrieve prepared responses
  • DTO request and response classes

Continue reading “Mocking internal interfaces”

Elipse and Circle inheritance problem

Recently I’ve been listening to Coding Blocks podcast, an episode which subject was software design anti-patterns. They described one of them, which is pretty well known: the Circle-Ellipse problem.

The problem goes like this: let’s assume we’re writing a program and we’ve created IShape interface (which might have methods to calculate circumstance and area of the shape). Now we create Ellipse, which implements IShape interface and follows that with Circle class. Now since Circle is a special case of Ellipse, and every circle is an Ellipse it naturally should inherit from Ellipse.

Continue reading “Elipse and Circle inheritance problem”

I just wrote that without StackOverflow

In the life of many developers comes the moment, when you write something non-trivial and it just works. And you don’t have to google anything! It’s quite thrilling!

I have been creating a mock object for testing, that could store several graphs at the same time. The graph was very simple, it could have only root (portfolio) and leaves of several types. Linking was done from leaf to root, by setting two properties (a little redundant): parentId and parentName.

Continue reading “I just wrote that without StackOverflow”

Coding Blocks – great recommendation for beginners

Last week, our colleague Douglas (who hopefully is quite successful in combating dehydration and other threats during his trip to south-east Asia) recommended to me a  programming podcast Coding Blocks. And since object-oriented design patterns were never my strongest side I’ve decided to take some time and try to give it a try. So I immediately downloaded around 30 episodes, which totally clogged my weekly podcast queue.

Continue reading “Coding Blocks – great recommendation for beginners”

Mock – my favourite mock engine

When I try to unit test class one of the most important things is to eliminate all dependencies and replace them with proper mocks. Such mocks allow me to fully control inputs that object will access and verify that proper methods have been called.

Recently I’ve written one business logic class that manages SPA (Single Page Application) and uses four different repositories from which it pulls data and presents them as Web API.

Continue reading “Mock – my favourite mock engine”

Customize your work environment, and why it’s a bad idea

dvorakA long time ago I’ve heard about the Dvorak keyboard layout and how superior it is compared with standard QWERTY layout. After few minutes of Wikipedia research, I’ve learned that QWERTY is one of the worst possible layouts and was introduced with the explicit purpose of slowing down typists. You see a long time ago, in the era of mechanical typewriters, if you happen to push two keys at the same time the machine would jam. This would require you to manually unjam it, which takes only about 2-3 seconds, however, it would happen so often, that loss of speed was noticeable. Enter QWERTY layout – the one that would maximize the distance each finger needs to travel between letters of the English alphabet and therefore make jamming less likely and (paradoxically) increasing overall typing speed.

And a hundred years later, we’re still stuck with it…

Continue reading “Customize your work environment, and why it’s a bad idea”