Home » Software Development (page 2)

Software Development

Code review challenge – The concurrent dictionary refactoring

In a recent code review, I had modified the following code:   _freeSegments.AddOrUpdate(memoryDataForPointer.SizeInBytes, x => { var newQueue = new ConcurrentQueue<AllocatedMemoryData>>(); newQueue.Enqueue(memoryDataForPointer); return newQueue; }, (x, queue) => { queue.Enqueue(memoryDataForPointer); return queue; }); Into this code: var q = _freeSegments.GetOrAdd(memoryDataForPointer.SizeInBytes, size => new ConcurrentQueue<AllocatedMemoryData>()); q.Enqueue(memoryDataForPointer); Can you tell me why? Reference: Code review challenge – The concurrent dictionary refactoring from ...

Read More »

Legacy Code to Testable Code #11: More Static Constructors

Where we last left off, we discussed how to dismantle the static constructor (or initializer) booby traps. And I promised you an example. I’ll do that in C#, but the operations apply to any language that uses these constructs. Before I do that I’ll remind you main problem here: Static initializers are used as short cuts for initialization of a ...

Read More »

Top 4 Javascript Concepts a Node.js Beginner Must Know

Wouldn’t it be awesome if you only had to know one programming language for building a full stack application? Ryan Dahl put this thought into action and created Node.js. Node.js is a server side framework that is built upon Chrome’s powerful V8 JavaScript engine. Though originally written in C++, it uses JavaScript to be used in applications. See, problem solved. ...

Read More »

From Legacy Code to Testable Code #10 : Getting rid of static constructors

Here is the rest of the gang: Introduction Renaming Extract method Add accessors More accessors Extract class Add overload Introduce parameter Convert If-Else’s to Guard Blocks This time we’re going to tackle the most problematic issue in testing object-oriented languages. Obviously because constructors only exist in those, but also, because even power tools have problems handling them. But we’ll start where ...

Read More »

Letting go of technical debt

The term “technical debt” was first introduced by Ward Cunningham as a metaphor. It was in the early 90s, when the rift between developers and business people was growing wide. The business people would urge developers do release untested, ugly code. The developers tried to explain why this was a bad mistake. (Not like today, right?) The metaphor of debt ...

Read More »

Optimising animation based collision volumes

Last time we talked about how we can approximate objects with complex shapes using simpler ones for our game’s physics simulation. Further, we saw how we can use an often already existing feature: a skeleton for animating sprites – or vertices of a 3d-mesh – to make our collision shapes change position, and even size, as our object deforms. Today ...

Read More »

Improve your Angular 1.x startup time

This neat and simple trick originally appeared about a year ago on this blog post, so it’s not something I came up with by myself. Angular’s watcher functions for ng-bind and text nodes () put binding information inside the respective DOM elements using jQuery .data method. This is unfortunately a very expensive operation that impacts both load times and time ...

Read More »

Componentizing Workflow for Angular 2

A possible (mental) workflow to split up your static HTML into components Yesterday I wrote a tweet about how I usually create components. Great workflow for refactoring unwieldy components :-) https://t.co/each4c2cm9 — Kent C. Dodds (@kentcdodds) December 9, 2015 A tweet is quite short, so let’s take a closer look at such workflow in more detail. Also, note that I’m ...

Read More »

Testing Strategy Analysis – An Example

Each stage of implementation is hard in its own way. When we start out with a new effort or process, we think of it as: Sure, it will be hard in the beginning, but it’s going to become easier as we continue. It’s true, and then after a while a new challenge appears. A team I’m working with has developed quite an ...

Read More »

Animation based collision volumes

There is hardly a single game that does not need some form of collision between game objects. In many cases it is enough to approximate the shape of an object by a simpler one to simplify and speed up collision detection. It is for example very common – especially in 2D games – to use circles or boxes as colliding ...

Read More »