Worktime music
Awesome acoustic Metallica covers
In a restless search of ways to defer everything to the point at which it is absolutely needed
Awesome acoustic Metallica covers
Posted by
Michael Goldobin
at
12/23/2012
0
comments
Labels: music
Hurry up - crazy discounts from JetBrains - up to 75% off. Sale will last for 20 hours (counting from 10:00 am EST)
Posted by
Michael Goldobin
at
12/20/2012
0
comments
Couldn't just miss it - and the event was awesome. It surprises me every time that the practice which doesn't really sound impressive ends up to be a lot of fun and insight. And a spark and an inspiration and interesting people.
I was looking for helpful tips to run my own corporate session and wasn't disappointed. My biggest take-out is a concept of the "ping-pong round" when pair of developers are writing one test each and just enough code to make the test pass. It quickly becomes a "competitive ping-pong" as soon as your test misses some corner or null case and revenge follows with another failing tests. This simple, simple technique forces adoption of TDD in an unobtrusive way and eventually results in a better code. The difficult part is to write the very first test - and helpful advice was "just create a REALLY simple one - like collection has length greater than zero". And from there it went.
The activities used the usual "Conway Game of Life" although I would really like to find similarly interesting and intuitive problem - just to keep my corporate audience interested for the next time...
Posted by
Michael Goldobin
at
12/10/2012
0
comments
Labels: agile, unit testing
Witnessing quite a few project within past two years I am still surprised how world differs from what is declared and discussed inside the community walls.
Agile and its incarnations are vary rarely a weapon of choice. Even projects declared as “agile” only adopt superficial practices. Projects routinely planned and executed the same “proved” way and routinely spill over time and budgets. Project Manager's most daring task is to successfully invent excuses manage client’s expectations when “it” hits the fan. Iterations do not exist or their length is arbitrary and inconsistent: one of the projects I observed had two iterations – four months and one month. Retrospective meetings, even if held (rarely), have zero value as no statistic data is being gathered or it is irrelevant. Everybody had their own idea of what went well in iteration and what did not (and kept this thoughts to themselves). In some projects Agile was understood as a roam-naked-and-free environment - no documentation, no plan, just build-as-we-go. *
There is no software project manager in existence who hasn’t heard about the agile methodology, yet just 11 years since declaration of independence agile manifesto was signed and it is already old news for vast majority of IT folk.
We seem to not learn anything from the hardware revolutions. Who could believe that ugly smelly noisy tin cans could replace centuries-proven horses as a main meaning of transportation? Internal combustion engines have existed for almost 80 years before been attached to a real self-propelled carriage and it took another 20 years for an automobile to make it to the mass-production. Assuming that life has accelerated tenfold since then, we should have seen our Henry Ford for Agile mass-production already.
Let’s face it - it’s hopeless.
* Disclaimer: Any resemblance to actual events or locales or projects, living or dead, is entirely coincidental. The fictional projects in description were stumbled upon during my contracting years and user group discussions. Some of them got better with time.
Posted by
Michael Goldobin
at
12/02/2012
0
comments
Labels: :), agile, introverted programming
To consider the person a friend it is necessary and sufficient to:
Posted by
Michael Goldobin
at
10/05/2012
0
comments
Labels: :)
Posted by
Michael Goldobin
at
7/13/2012
0
comments
Labels: buzz
Posted by
Michael Goldobin
at
6/26/2012
0
comments
Labels: :), introverted programming
An interesting article Who should be the architect in an agile project? made me think of summarizing the necessary and sufficient qualities of the architect suitable for the Agile jungles. As the
So far it looks like it should be the guy/gal who is:
1. Excitable enough to run along with the team recklessly avoiding architectural decisions.
2. Experienced enough to determine the moment when it's time to stop and make the decision.
3. Knowledgeable enough to steer the discussion towards better decisions.
5. Laid-back enough to accept decisions which may slightly differentiate from his/her personal choice.
6. Tedious enough to keep an eye on the dynamics of the technical debt
Posted by
Michael Goldobin
at
6/26/2012
0
comments
Labels: agile, architecture
Posted by
Michael Goldobin
at
4/21/2012
0
comments
Labels: music
When it comes to maintaining or expanding a legacy code, it is no surprize that we often find ourselves struggling with a mess of magically changing global variables, 1000-lines long methods, which do hundred different things inside and keep all logic to itself. Sometimes changed requirement or just popped production bug demand a limited incision – and often you afraid to touch the fragile masses of code around you and just try to minimize the potential impact and hope for the best.
More often than not method you need to change was developed in unenlightened age, when people used computers made of wood did not concern themselves with principles of cohesion or separation of concerns or thoughts about testability. It is hopelessly long and complex and business functionality is mixed with calls to database or services. Testing such a method is a dreadful task, which easily can eat a lot of time and bring the wrath of management on your head. But it still is no excuse to leave this code without any test coverage – so try to cover at least functionality which you are adding or even affecting. There are tricks you can use to test the legacy code fore cheap and with little overhead, quickly getting to the important logic testing.
Let’s consider the following (greatly simplified) legacy method.
It contains some logic which we would like to test, but also two calls to the complex methods, on of which hits database – CallDB and another, which calls outside service – RequestService. Those we would like to keep aside and maybe test them in separation, if time permits.public bool ProcessEligibility(Person person) { // Some functionality which we leave outside of our testing // A bunch of business logic which we would like to test bool result = CallDB(new ConnectionManager(), person.Age, person.Position); //Another bunch of business logic which we would like to test ServiceResponse response = RequestService("http://real.com/svc", person); return response.IsSuccessful; }
Next we lay a foundation for our methods to be extracted as a parameters. We can use a Func<T1, T2, TOutput> type to describe functions in our specific case, but unfortunately Func delegate allows maximum three input parameters while old-fashioned methods can accept 10 or more! In this case we have to create a delegate type ourselves:public bool ProcessEligibility(Person person) { // Some functionality which we leave outside of our testing return ProcessEligibilityConcrete(person); } protected bool ProcessEligibilityConcrete(Person person) { // A bunch of business logic which we would like to test bool result = CallDB(new ConnectionManager(), person.Age, person.Position); //Another bunch of business logic which we would like to test ServiceResponse response = RequestService("http://real.com/svc", person); return response.IsSuccessful; }
Now let’s refactor the main and sub-methods further, injecting methods as dependencies (let’s describe one as a Func<T1, T2, TOutput> and another as a custom delegate):public delegate TOutput HyperFunc<T1, T2, TOutput>(T1 input1, T2 input2);
Now we can test the ProcessEligibilityConcrete method in isolation, providing our own mock or stub methods as substitution:public bool ProcessEligibility(Person person) { // Some functionality which we leave outside of our testing return ProcessEligibilityConcrete(person, CallDB, RequestService); } protected bool ProcessEligibilityConcrete(Person person, Func<ConnectionManager,int,string,bool> dbCaller, HyperFunc<string,Person,ServiceResponse> serviceCaller) { // A bunch of business logic which we would like to test bool result = dbCaller(new ConnectionManager(), person.Age, person.Position); //Another bunch of business logic which we would like to test ServiceResponse response = serviceCaller("http://real.com/svc", person); return response.IsSuccessful; } public delegate TOutput HyperFunc<T1, T2, TOutput>(T1 input1, T2 input2);
I said at the beginning that we got this test coverage for cheap. It is not quite true: we paid with adding redundancy and some obscurity to the original code. We performed some refactoring but we clogged the final result a bit, reducing code readability, although all refactorings were safe, especially if you used tools like Resharper.[TestMethod] public void TestEligibility() { var result = ProcessEligibilityConcrete(new Person(), fakeDbCaller, fakeServiceCaller); Assert.IsTrue(result); }
Posted by
Michael Goldobin
at
4/18/2012
1 comments
Labels: c#, code quality, unit testing
I have plans to visit friends on Aruba this summer and usually wherever I go I check Internet for the area’s IT background - user groups, interesting IT events and job postings. I am yet to discover and attend a meeting somewhere exotic but job postings are always fun – and Arubian weren’t a disappointment. Look at this top three list:
D… Consulting Limited., Lagos, Nigeria. We require reputable persons having prime experience and capable of providing Information Technology and others Service (as individuals or in a team). Salary indication (individual) – US $15,000 – 20,000 per month. All relevant information/ notification / CV/ Resume should be forwarded via word document attachment to the below email as follows for immediate consideration.
Kind of disappointing that position does not promise an adoption into a royal family..
Hardy Oil and Gas PLC, Korūna, Pakistan requires the services of reputable and devoted workers for the under listed job positions. Qualified persons should contact us immediately for job placement. Application process-please send us your documents by email: 1). Resume 2). Recent photo 3). Passport Copy. Email: info_hardyoilgas@yahoo.com
The list includes 20 professions, from cooks and cleaners to language teachers, nurses and Internet experts (probably to move the oil company corporate mail system out of yahoo). Surprisingly drill masters or geologists are not required. The Hardy Oil and Gas actually exists, registered in Great Britain and of course owns first-level “com” and “in” domains.
The last one is the only which looks legitimate (no word “reputable” in the description) – and I totally see Paul Rudd in this role:
The C… Hotel urgently needs the services of devoted and hardworking workers, who are ready to work after undergoing enlistment training: INTERNET SERVICE EXPERT,COMPUTER OPERATOR,CAFÉ MANAGER
Now this is a dream IT job – computers and coffee!
Posted by
Michael Goldobin
at
3/18/2012
0
comments
Labels: weird stuff
Nice classic book, which I glanced through long time ago, but dealing extensively with 9-year old code base made reading it again much more insightful.
A lot of useful patterns to break down nasty 600 lines methods and copy-pasted classes. Java examples will not stop C# developers from fully understanding the ideas but C++ examples are not that easy to grasp – in my opinion most of the techniques deal with limitations of the language and patterns so they don’t seem that universal.
Posted by
Michael Goldobin
at
3/16/2012
0
comments
Labels: books
If earn money doing web development and haven’t yet heard of KnockoutJS – you should probably find out sooner than later. It’s a powerful and yet surprisingly intuitive MVVM framework implemented in pure Java Script (meaning - it will work in any browser!). The author’s KnockoutJS.com is a good place to start and when you are ready for a deeper dive – check the Knockmeout.net.
While building my first form with Knockout, which quickly got over-engineered beyond the concepts described in the documentation, I found that the ability to add some validation or allow user to confirm the action is sorely missed. Knockmeout.net gave me a good start in a right direction and I ended up with this observable:
ko.smartObservable = function (initialValue, functions) {
var _temp = initialValue;
var _value = ko.observable(initialValue);
var result = ko.computed({
read: function () { return _value(); },
write: function (newValue) {
var shouldUpdate = true;
_temp = newValue;
if (functions) {
for (var i = 0; i < functions.length; i++) {
if (shouldUpdate && typeof (functions[i]) == "function")
shouldUpdate = functions[i](newValue, this.parent);
if (!shouldUpdate) break;
}
}
if (shouldUpdate) {
if (_temp !== _value()) _value(_temp);
}
else {
_value.valueHasMutated();
_temp = _value();
}
}
});
return result;
};
You need to supply an optional list of functions, each accepting a single value parameter and returning true or false, and the observable will execute them one after another until the list is over or until one of the functions returns false.
This is a working code (the example is based on a simple tutorial model):
This observable works perfectly with a brilliant Matthew Schnikel’s dirty flag extender – combined together they will arm you with really powerful input fields.
But the best thing about KnockoutJS is that it made me rethink my disposition towards Java Script. How Melvin Udall would put it:
Posted by
Michael Goldobin
at
3/03/2012
0
comments
Labels: mvc, tools and gadgets