October 31, 2015 .NET, C# No comments
October 31, 2015 .NET, C# No comments
Do you know what a delegate and event are in C#? Can you clearly explain in one-two sentences what the difference between these two is?
It might sound simple as we, .net developers, use these quite frequently. Unfortunately it isn’t that straight forward, especially when you want to be precise. Just try it now aloud.
First difficulty is when you try to differentiate between the delegate type and an instance of a delegate. Next difficulty is when you try to explain events. Your explanation may mention subscribing and unsubscribing to an event. But, hey, you can do exactly the same with a delegate instance by using exactly same “+=” and “-=”. Have you thought about this? The real difference is that with an exposed event it’s about all your external code can do. Instead with an exposed delegate instance external code can do other things like changing the whole invocation list by using “=” or invoking a delegate right away.
An event is nothing more than encapsulation convenience over delegate provided by C# language.
On a conceptual level, an event is probably much more than just some convenience, but that’s beside the point in this post.
To feel the difference all you need is to write some code. Nothing helps to understand things better than writing code and reading quality resources.
Please see below my try on understanding the difference between events and delegates. I added plenty of comments in a try to be explanatory.
Person’s sickness event triggering is responsibility of a person’s internals (stomach, in this example) and it is correct to be encapsulated in the Person’s class, otherwise external code would be able to make a person sick (I like this double-meaning).
Next step is to understand what C# compiler generates when you use the ‘event’ keyword and how else you can declare an event other than in a field-like style. I don’t describe it in this post, I’ve only read about these details, but they are quite interesting as well.
Proficiency in programming language comes with a deep understanding of the basics. I’m proving this to myself every now and then.
October 16, 2015 Book Reviews No comments
I think “Surely You’re Joking, Mr. Feynman!” is a “must read” book for any technical person who reads not so technical books time to time. It is just fascinating.
The book was particularly interesting to read for me as I work on a project for the IAEA. My project helps to identify any misuse of nuclear materials to prevent creation of nuclear weapons, and here is the guy who describes how the Manhattan project looked from the inside. Of course, the book doesn’t go too much into details but you get the idea on the atmosphere of the project of the first nuclear bomb.
The book starts with Feynman’s early years when he was fixing some broken radio devices and performing experiments in his “lab”. This reminded me about the years when I was winning school competitions in physics and chemistry and also had some kind of a “lab” at home. I did some similar things. You know, blew few things, assembled a radio, broke few other things… Eh, that was a special time. So the book grasped me from the very beginning.
It is actually hard to believe that one person could have had so many of adventures in one life. Apart from serious things there are tons of short stories on learning other languages, trying art and samba music and even picking up girls. When you read all these stories it is like if your friend was telling his or her most compelling story. You listen with pleasure.
There are topics that make you develop a more critical mind, a more questionable one. For example, critiques of education system in Brazil and school book publishing business in US. I started to think that a lot of studying that I took could have been much better.
I don’t know how, but somehow “Surely You’re Joking, Mr. Feynman!” got to my list of technical books to read this year. Obviously it isn’t technical one, but it is for technical people to have a good reading time. I highly recommend it.
October 11, 2015 Career, Success 2 comments
A first glance look at your resume will rest assure a potential employer that you are not worth hiring if it looks like a crap.
Even if you listed tons of technologies, badly looking resume hints that you don’t care about the quality of things. Employer might think: “He must be writing his code in the same ugly way.”
In this blog post I want to share few things I did to my resume.
Actually, I have more of a CV than a resume. After recent changes I created two different versions of my CV. One is more concise two pages that I would normally use and another is extended 4 pages version. Four pages version contains detailed information on projects I worked on, so it can serve for my future editing, should I need more information.
Probably, the main thing anyone should do to their CVs is to ensure your future employer will have a clear idea on what you had done before. Obscure general phrases are just destroyers of a resume or CV.
For my own resume I completely rewrote everything into smarter format. I used past tense bullet-point sentences to clearly describe what I did. Let’s have a look at before and after of one concrete example.
This is what I previously had as a summary for my experience at bwin.party company:
“Developing and extending large set of back-end services in scope of enterprise SOA architecture in large betting company. Scalability and performance were top most requirements.”
It was followed by a list of projects I worked on. One of them was statistics service I created. I described it like this:
“Service which fetches huge amount of statistics data from external provider over FTP and transforms it for internal consumption.”
Obviously potential employer looking at this description wouldn’t have any idea at what my contribution to this project was. Was I implementing it from scratch or was I fixing bugs? Or, maybe, I just know something about the system so I listed it.
After editing, the summary became:
“Bwin.party is an online betting company. I worked in the company’s sports branch, with a team responsible for backend services. Scalability and performance were the top most requirements. Most services were exposed through REST API; they had to be available 24/7 and withstand extreme loads during championship events.”
Then, I came up with this description for the statistics project:
“Designed, implemented, and launched a new sports statistics system. This system imported data from an external FTP location and made it available on our website through AppFabric Cache.”
This description exactly says what I did and even provides a glance look at some of the technologies used.
Another thing I had to improve was my writing. I’m not native English speaker and I’ve never took any English grammar classes. I make many mistakes.
I hired an editing and proofreading company to go through my CV and fix mistakes. I only paid 31 Euro, but my CV became English language error free. Plus they provided a few general suggestions on improving my CV.
You have to be really careful with someone editing your CV, as they might change the meaning unintentionally. For example, they wrote “Fixed a serious performance problem using search engine…” when it really had to be “Fixed a serious performance problem in the site’s search engine…”
There were obvious problems that made their way from times when my English was even weaker. For instance, sentence “I was awarded in nomination “Best Rookie Developer of 2008” in my team of 50 people, so am proud of this, because at that year our team got a lot of new people.” sounds horrible to me. Now it just says: “Was awarded the “Best Rookie Developer of 2008”.
I completely changed the format of my CV. I’ve borrowed styling and formatting from my friend’s resume. He’s hired a professional technical writer to create a CV for him.
Previous version was grey 4 pages wall of heavy text with odd formatting.
![]()
The new version is just two pages. It is nicely formatted and is error free. It is available here.

It’s very important that someone reviews your CV. I asked my colleague who does a lot of interviews to review my CV. He said that if CV is short, screener reads through all job posts, but if it is long screening ends at your last job post. So it depends what you want to show. Other thing he thought of, was adding skill grades for different technologies, like C# (major skill), F# (minor skill). I didn’t incorporate this advice, but I’m still considering it.
I added a new photo to my CV, not the one you currently see. After I showed my CV to my wife, she said that she would never hire someone who looks that frowning and sad. I had to make a new picture with a hint of a smile.
I already have official recommendation letters from two of my previous companies. I’m planning to include those when applying for a job. A recommendation letter for a software developer is not common in Ukraine where I had worked before moving to Austria. But here in Western-Central Europe it is almost a must. I think that it doesn’t do any harm to ask for an official recommendation letter even if it is not common in the country where you live. Ask for it now, otherwise it could be a difficulty to get it few years later.
I’ve never used a cover letter. It has never came to me that this might be a useful technic. But it might, especially if you are looking for a specific job and want to outline exactly why you are the best match for it. Should I find my “job of dream” I might consider creating dedicated cover letter. For now, I won’t create one. Have you ever used a cover letter? Did it work for you?
I haven’t done this. I also have mixed feelings about hiring someone to write my CV completely from scratch. Probably, they can do a great job. But finding a really worthy professional might take lot of time. Also a good one would cost you few hundreds $. Though, it is definitely a great investment, if you resume looks terrible at the moment.
My resume wasn’t looking good. It isn’t extraordinary great now, but I think I’ve improved it significantly. Main things I did to it, was rewriting it in more concise and descriptive manner, fixing mistakes by hiring a proofreading company, and changing the styling.
Hopefully, this post can be of some help to make your resume look better. I would be really happy to know if it helped.
If you have suggestions on further improvements to my CV, I would really appreciate it.
There is more to having professionally looking CV / Resume. You should consider having market oriented resume versions.
For instance, described above two pages CV with a photo is common for EU, but it is not a great thing for US market.
In US it is more appropriate to have 1 page resume without any personal information.
As a result I created US oriented one page resume.
October 5, 2015 .NET, Performance, VS No comments
Load testing is a great way of finding out if there are any performance issues with your application. If you don’t know what a load test in VS is, please read this detailed article on MSND on how to use it.
I have experience with creating load tests for high load web services in entertainment industry. At the moment I’m working on internal web application in which users exclusively “check out” and “check in” big sets of data (I will call them “reports” here). In this post I want to describe one specific use case for load testing.
In our application only one user can work at a time with a particular report. Because of this, load tests cannot be utilizing simulation of multiple users for same data. Basically, for one particular user and report, testing has to be synchronous. User finds a report, checks it out, checks it in and so on for the same report. We want to create multiple such scenarios and run them in parallel simulating same user working on different sets of data. Can be extended to really simulate multiple users if we implement some windows impersonation as well.
There are other requirements to this performance testing. We want to quickly switch web server we are running this tests against. This also means that database will be different, therefore we cannot supply requests with hardcoded data.
I’ve started with creating a first web performance test using web browser recording. It records all requests with the server in IE add-on. I recorded one scenario.
Depending on your application you might get a lot of requests recorded. I only left those that are most important and time consuming. One of the first things you want to do is to “Parameterize Web Servers…”. This will extract your server name into separate “Context Parameter” which you can later easily change. Also in my case, most of the requests are report specific, so I added another parameter called “ReportId” and then used “Find and Replace in Request…” to replace concrete id with “{{ReportId}}” parameter.
Recorder obviously records everything “as is” by embedding concrete report’s json into “String Body”. I want to avoid this by extracting “ReportJson” into a parameter and then using it in PUT requests. You can do this using “Add Extraction Rule…” on GET request and specify that you want to save response into a parameter. Now you can use “{{ReportJson}}” in String Body of put requests. As simple as that.
Unfortunately, not everything is that straight forward. When our application does a PUT request it generates a correlationId that is later used to update client on the processing progress. To do custom actions you can write plugins. I’ve added two of them. One is basically to skip some of the dependant requests (you can use similar to skip requests to external systems referenced from you page).
The other plug-in I’ve implemented is to take parameter “ReportJson” and update it with new generated correlationId. Here it is:
using System;
using Microsoft.VisualStudio.TestTools.WebTesting;
namespace YourAppLoadTesting
{
public class AddCorrelationIdToReportPutRequest: WebTestPlugin
{
public string ApplyToRequestsThatContain { get; set; }
public string BodyStringParam { get; set; }
public override void PreRequest(object sender, PreRequestEventArgs e)
{
if (e.Request.Url.Contains(ApplyToRequestsThatContain) && e.Request.Method == "PUT")
{
var requestBody = new StringHttpBody();
requestBody.ContentType = "application/json; charset=utf-8";
requestBody.InsertByteOrderMark = false;
requestBody.BodyString = e.WebTest.Context[BodyStringParam].ToString()
.Replace("\"correlationId\":null",
string.Format("\"correlationId\":\"{0}\\\\0\"", Guid.NewGuid()));
e.Request.Body = requestBody;
}
base.PreRequest(sender, e);
}
}
}
In pluging configuration I set ApplyToRequestsThatContains to “api/report” and also BodyStringParam to “ReportJson”.
To finish with my load test all I had to do is to copy-paste few of this webtests and change ReportIds. After that I added webtests to a load test as separate scenarios making sure that every scenario has constant load of only 1 user. This makes sure that each scenario runs synchronous operations on individual reports.
I was actually very surprised how flexible and extensive load tests in VS are. You can even generate code from your webtest to have complete control over your requests. At least I would recommend you to generate code at least once to understand what it does under the hood.
I hope this helps someone.
October 3, 2015 Book Reviews, Career, Success No comments
After going through short free blogging e-mail course by John Sonmez, I didn’t sign up for the marketing course. I was a bit sceptical about paying few hundreds for the course. But not to miss on the opportunity to learn from John I decided to read his book “Soft Skills”. (Actually I listened to it via Amazon Audible.) The book wasn’t exactly what I expected it to be – it was much more. It’s kind of a book I would like to write myself someday. The book isn’t just about soft skills needed to perform your everyday tasks at work, it is much more generic and broader in topics. The book is about skills you need to succeed in your life as a software developer. “Soft Skills” includes advise on career, productivity, finances and even fitness and nutrition.
There is a lot of unique in the book, but probably you will find yourself familiar with some of the recommendations. For example, in one of the chapters on productivity John suggests using pomodoro technique. Obviously, it isn’t something new. But the author explains how to make it work and also adds few of his own practices. Everybody knows that their health is very important, but unfortunately too many of us neglect to do anything about it. I think emphasis this book does on fitness and health in general is something that makes the book special. Personally, I didn’t really enjoy some of the chapters on finances. Maybe that’s because I’m almost done with my goal of reading 13 books on finances and investing this year. But, still, I think that others might find it useful, plus it is interesting to know about the financial experience of the author himself.
I’ve certainly learned few concrete tricks and technics I’m going to use when searching for my next gig, like creating a resume that stands out, applying for a job, hacking the interview, negotiating effectively and other.
I will also apply some of the productivity recommendations at my current work.
A lot from the section on learning is very practical. Hopefully, concrete steps this section is offering will help me overcome some of the inefficiencies in my learning process. I have to admit that I often learn incorrectly. For example, frequently I first read a book and only then try things out. Intuitively it felt to be an inefficient way of learning, but I continued to do so.
The other big takeaway is health related. This year I started to run (well, again), but this is not enough to feel myself fit and full of energy. The problem is that I’m not consistent in my runs. I will add some scheduled fitness exercises to my runs and will try to follow John’s advise on the topic.
John has managed to retire at age of 33 and even I’m 5 years away from that age I have less aggressive target of retiring at 41. Best takeaway on the financial side was realising that I share same opinions on the matter and have already taken few of the first steps on the way to financial freedom.
“Soft Skills” is up to date book with very sensible, practical and actionable advice for any software developer. It has a potential to greatly improve your life – not just your career. I would highly recommend to read this book. I’ve even ordered a printed copy of the book as a gift for my friend for his birthday.
See the book on Amazon or buy it using my my referral link below.
October 1, 2015 C#, HowTo, QuickTip, SQL No comments
Imagine that your database is being used by another system that directly reads data from few of the tables. I know this is not a good idea and I would not recommend anyone to do anything similar. Unfortunately developers often do what they don’t really want to do.
In this post I just want to document a very simple way of verifying that you are not removing or modifying tables and columns that are being used by someone else.
My solution is dumb unit tests that select table schema information for the list of tables and columns and then builds checksum that is finally compared to expected checksum.
I don’t pretend to sound like this somewhat dirty solution is a right way, but it is very quick to implement and effective way. Here is the implementation in C#:
In code above we verify that we are not removing or modifying few columns in tables Table1 and Table55, since they are used by SystemX. NUnit TestCase attributes are used to allow for multiple table checks. First parameter is a checksum that you would get for the first time by failing the unit test or by running query separately. Checksum calculation is simple but it has a bit of overburden with concatenating column names into one string and then parsing it again into a temp table for the “IN” condition. (Of course there are other ways, but I find this one to be a bit less code). Also it probably worth to mention that we apply database changes using FluentMigrator, so tracking what exactly was changed that caused particular Unit Test case to fail would be just to have a look at the latest commit.
I think this is acceptable solution for a small set of checks. Probably you need another solution if your database is heavily used by another systems.
Hopefully is helpful to someone. At least I write this post to have it handy for myself in case I need something similar done quickly.
September 15, 2015 Book Reviews, Success No comments
I think I’ve read “The Passionate Programmer” for the second time. Otherwise, I cannot explain why almost everything I read in the book sounded like a “Déjà vu”. Well, even if it was a second time, it’s worth it. Book itself if very easy to read. It is nicely organized in small chapters and contains short real-world stories from different people. I liked reading the book very much. Besides, since recently I started working on getting back on track with my career and blog writing this book came very handy.
Author, Chad Fowler, does really great job advising software developers on their career. This book definitely makes you think about your current position and gives sensible suggestions on possible actions to improve the situation.
The book helps you realize that your skills are just a product. A product that is highly demanded. For any high demand product there is high supply. And it is only a question where you find your product in all the supply available. Is your product a quality one? Are you sure your product won’t become obsolete over time? What is it you do to stand out from the crowd?
There is one take away from the book that I took action on already. I started writing Monday weekly e-mails to my direct manager with list of last week’s completed tasks and the goal for a current week. This is not to make my manager happy nor to make me look nice. I’m doing this for myself. For sure this will keep me focused and provide additional push for completing my work.
These below are some other action items from the book I want to take:
Go ahead, read the book and create a list of action items for yourself.
Just Be Better Than Yesterday!
I want to share something with you, especially if you are one of those who’s been following this blog for a while.
Everyone is interested in succeeding. Succeeding for software developers often means boosting their careers. This can be done by mastering the craft and by marketing yourself. Even if you are one of the best programmers in the world, all you will get by only doing you work is just more work. Of course, if you work hard and exceed expectations you will get promotions. Unfortunately this is limited to your organization. And when you move to the next place you have to prove again that you are of great value. Basically, you are left without any sizable portfolio for all your hard work and all you have to show is few pages of a resume. You have to promote yourself online.
One of the best things I did to my career was starting this blog in 2009.
This is also something I would recommend to you. There are people who would like to help you.
To get yourself started just sign up for this free blogging course: http://devcareerboost.com/blog-course/
I’m sharing this because it helped me to activate my writing again. Besides, I completely agree with what John Sonmez (http://simpleprogrammer.com) has to offer in his course. I think that having a quality blog will not only help you boost your career but will also help you to be a better developer over time.
Thanks to the course I’ve finally moved my blog to a self-hosted environment. I hope you like the new design. I’m also planning to keep up with a blogging schedule.
The most important thing about blogging is consistency, probably something you haven’t seen on this blog in the last 2 years.
It is something I want to change. So, I would like to thank John for the inspiration. Thank you!
Share your thoughts and blog links.
May 8, 2015 Book Reviews No comments
Along with reading technical books and books on investing I’ve decided for myself to read couple of Science Fiction books this year, actually 4 of them.
My list so far looks like this:
1. Martian
2. Ender’s Game
3. Dune
4. Hyperion Cartons
So far I’ve only read first of those, called “The Martian”, and I’m completely fascinated by the book. It is great! Houston, did you get that?
First of all book has nothing to do with “little green man” or unrealistic magic or anything sort of you usually see in crappy movies. This book is hard science survival novel talking about a man who was left alone on Mars after his team decided he is dead and had to rush to leave the planet.
I’ve been always interested in astronomy and the outer space. I even have small telescope at parents house and just recently used it to see Jupiter while having night barbecue there. Also when I was a kid I read few soviet era books on planets, including Mars.
So when I was reading the book it felt very well in line with scientific facts and hypothetical future Mars missions. And this is the best thing about this book. Other good thing, as per me, is that the book doesn’t have any side stories. So, no love stories or too long description of anything. Plus it has its humour and is written in a nice and easy to read way.
I would for sure recommend to read this book if you are any interested in similar stuff. At least it should be interesting for software developers and other technical people. My wife would probably not like it.
Hollywood is already filming a movie. See short teaser: https://www.youtube.com/watch?v=xRRgwYw4zds
Almost forgot to say, the book was available for free for a long time and it is how I found it by accident and downloaded for free. Not sure if I can still share it just like that.
From here: http://www.andyweirauthor.com/books/the-martian-hc/the-martian-el
Q) How did you feel when your original, self-published version of THE MARTIAN became a phenomenon online? Were you expecting the overwhelmingly positive reception the book received?
A) I had no idea it was going to do so well. The story had been available for free on my website for months and I assumed anyone who wanted to read it had already read it. A few readers had requested I post a Kindle version because it’s easier to download that way. So I went ahead and did it, setting the price to the minimum Amazon would allow. As it sold more and more copies I just watched in awe.
See the book on Amazon or buy it using my my referral link below.
March 30, 2015 Conferences No comments
Disclaimer: I’m white, straight, or better say cissexual, able-bodied, married man and I have a child.
.concat() is new web conference organized by local enthusiasts in Salzburg, Austria. I’ve decided to attend it mainly because it is relatively close to place where I live, it is not expensive and it had few big names.
Biggest of them, of course, was Douglass Crockford, author of “JavaScript: The Good Parts” and important ideological contributor to ECMAScript.
His keynote was mostly shortened version of the talks he usually gives on Javascript and programming in general. You can watch it online. Small difference was that in the end he showed some of the good parts that are coming in ECMA 6 standard. And definitely it is different experience to watch someone alive than watching video.
You can see complete schedule with descriptions here: http://lanyrd.com/2015/concat/schedule/
Next two talks were “Ain’t No Part Like a Third-Party Javascript Party” and “How Teaching Kids Made Me a Better Developer”. I enjoyed two of them for different reasons. First was quick run on all kinds of issues that can be caused by different JS libs in strangest possible ways. It makes you think how dangerous is the world for any code you want to deliver to be used by someone else. Second talk was entertaining and revealing on how kids question things that we take for granted. I’m sure if we trusted less what we write and really find why things work the way they work we would be better developers as well.
Next two I listened to were “Tonight We’re Gonna Code Like It’s 1999: Designing Responsive Emails” and “No RSVP Required: Asynchronous Messaging”. First one was just not for me. I never worked with e-mail templates and I wish I never will. All I understood is that e-mail templating is pain. Didn’t grasp anything useful for myself from that talk at all. Second was list a terribly boring university lection I wish I would have skipped for “Credit Card Walks into a Bar” jokes.
Lunch was good. Nothing too special, typical Austrian lunch, but this is a great plus for the conference.
“No More Tools” was all about the tools. Friend who came with me was expecting that this will be about ways to avoid using tools like VS, or avoiding burden of hundreds of JS libs. Instead it was a whole bunch of tools being recommended for all kinds of things. Although most of the tools make sense I don’t understand how this helps to avoid tools.
“Useful Performance Metrics” was actually useful as we have some performance issues in project I’m working on. Takeaway for me was idea of having performance thresholds that are nothing too specific but should make a team pay attention to performance should any threshold be crossed.
I also liked “Containerized Applications with Docker” very much. Docker is really great tool for doing lots of quick virtualization. Plus this was one of very few presentations with live demo. I’m really glad there are people who have stomach to demo live. This is really appreciated.
“The Meaning of Words” was a depressing talk. Or at least presenter advertised it in such a way. Maybe pace in which it was presented was slow and looked like presenter didn’t do any eye contact with the audience. But talk was about a better programming word. And there was some hope in it.
Then there was a round of lightning talks. But all of them were prepared beforehand. Some of them were quite good as people showed what they worked on. Some were ridiculous or absolutely hilarious as people tried to squeeze so much into 5 minutes. There was one person who tried to demonstrate LED board controlled by some JavaScript. I really wanted to see what it does, but unfortunately the person didn’t manage to control anxiety and things went out of control.
I intentionally mentioned that geek person. I think that introverts, real nerds are having hard time to get better conditions for themselves when it comes to careers and social networking. This leads us to “A Talk About Nothing” which wasn’t about nothing at all. It was about equality and diversity in technology industry. I really liked the way this presentation was delivered. It was a great performance. But I have some disagreements with contents. Lets start with some questions. Are women underrepresented in tech? – Yes. Are women less interested in tech? – I guess, yes. Isn’t it logical that less women work in tech? – Work it out for yourself. I’m of opinion that this is logical. I would honestly like to see more women developers.
I’m of opinion that representation in tech should be proportional and not influenced artificially. Though we should encourage everyone. Should there be more gays and lesbian in tech? Sorry, I use my privilege not to care. I simply don’t want to know if someone is a gay. What does it have to do with tech skills? Should things we do be not discriminating and working well for all people, including disabled. – Of course.
To be honest, I think it is in human nature to care more about self and self-alike than others. Isn’t it how people evolved and survived? I’m convinced that people should tolerate each other and be completely aware of inequality and different minorities and respect them, but I also think that nothing should be taken to any extreme level. In a sense that tolerance has its limits. Would you tolerate a guest who does a mess at your home? Every stick has two ends. Don’t get me wrong, I’m all for my daughter being software engineer who lives in a better world where she can travel the world and see no poverty or inequality and where women are equally represented everywhere, but I’m not happy about the world where doing crap to your body or weird behaviour is considered normal.
Unfortunately some feminists will say that I’m just another “wrong” person. That’s why I put that disclaimer at the top so it is clear who wrote this post so in case you are one you can ignore my thoughts.
Overall, conference was very good. I will seriously consider to attend concat 2016 should there be one. I will do better home work on presentations to always be on the right track.