Book Review: C# in Depth

November 27, 2015 .NET, Book Reviews, C# No comments

C# in Depth, 3rd EditionI’ve been writing C# code for more than 10 years by now and yet had a lot to learn from the book.

The book is written by Jon Skeet (the guy Number One at StackOverflow) and is a purely about the C# language. It distances itself from the .NET framework and libraries supplementing the framework.

Structure of the book follows C# language versions. This isn’t particularly useful if you are trying to learn the language by reading this book after some other introductory book. But for software professionals, though, it could be a joy, since it takes you through your years of experience with the language. It tends to remind you about times when something wasn’t possible and later it became possible. Kind of nostalgia, I would say.

First chapters could be somewhat boring. I read the book cover to cover, since I didn’t want to miss on anything, but probably it isn’t the best way to read the book.

Jon is very pedant when it comes to defining anything. This, of course, is double sided: very good when you have strong knowledge and understand components of the definition, but, unfortunately, it complicates understanding. There were some places in the book which I had to read few times to completely understand. Just for instance, in a chapter about Covariance and Contravariance:

[…] the gist of the topic with respect to delegates is that if it would be valid (in a static typing sense) to call a method and use its return value everywhere that you could invoke an instance of a particular delegate type and use its return value, then that method can be used to create an instance of that delegate type.

Jon Skeet. C# in Depth. Kindle Edition.

On the other hand, I found it very important that details are not omitted. I was reading the book for the depth of it. So details and preciseness is exactly what I was expecting, even though they come with the price of slower comprehension.

You may have different background than I do, but if you are a .NET developer with some years of experience, chances are the only chapters with new and difficult information will be those that are not reflecting everyday practical usage of C# language. For example, all of us use LINQ these days, but very few of us would need to know how it works internally or need to implement their own LINQ provider. Very few of us would dig into DLR or how async/await is working.

Almost in each and every chapter there was something where I could add to my knowledge. For me the most important chapter to read was “Chapter 15. Asynchrony with async/await”, since I have very limited experience in this feature.

Conclusion

In my opinion, the best two books ever for C# programmers are “CLR via C#” and “C# in Depth”, meaning that I just added one to this list.

“C# in Depth” is a great, precise, and thorough book to complement and enrich your knowledge.

I highly recommend reading it.



No comments


Four sci-fi books I’ve read this year

November 9, 2015 Book Reviews No comments

This year I did some science fiction reading. This is something not particularly helpful for software developers in their professional life. Nevertheless, I’ve read four sci-fi books and I would like to share my thoughts on them.

The Dune

Now I understand what is meant when people say “sci-fi classics”. This is really a book that ages very slowly. It is written in nicely phrased English but not too much overcomplicated for non-native speaker.

I remember when I was studying in university, one of my friends would go on and on about some game he was playing. There were huge sand worms and some people called fremen. It is only now that I can refer to this. Even if you are not much into reading sci-fi literature, you must have seen a picture of giant worm in Sahara-like desert somewhere, at least in Facebook with some funny text on it.

I was really surprised to know that this story was written in 1965, it continues in 18 books and many credit it for influencing such things like Star Wars and other great works in sci-fi world.

A top rated quote from the book at goodreads, which I also enjoy, goes like this:

I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.

The Ender’s Game

A quick to read and enjoying story. Just recently I had a chat about world sport champions. Most of us, discussing, have very young children 1+ 2+ 2+ years old. We all agree that for someone to become a world champion a training is needed starting from age of 3 years. One of us told that this is effectively stealing of childhood. Well, probably.

If you want to read about stealing of childhood, Ender’s Game is the right book. Target audience for the book is probably boys 12+, but it reads very well by adults as well. Plus the book somehow manages to bring some big questions into picture.

The Hyperion Cantons

There is probably something wrong with me or with the book or with me reading this particular book. I didn’t enjoy it much. The book is organized in six stories told by six people on a journey to mysterious planet Hyperion. Out of six stories told I liked only two or three. A lot of techno-mambo-jambo was something I extremely didn’t like about the book. The author was just making things up that are no close to existence or in correlation with the science.

This is an actual quote from the book:

To be a true poet is to become God. I tried to explain this to my friends on Heaven’s Gate. ‘Piss, shit,’ I said. ‘Asshole motherfucker, goddamn shit goddamn. Cunt. Pee-pee cunt. Goddamn!’ They shook their heads and smiled, and walked away. Great poets are rarely understood in their own day.

I’m probably one of those who doesn’t understand this. I’m not trying to say that the book is so bad. I was really gripped by the Father’s story. I’m just not sure if the book is something that everyone can enjoy.

The Martian

A have a separate post on “The Martian” available here. “The Martian” is mostly kept within hard science boundaries. And since it is about one of my favourite topics I greatly enjoyed reading it. I also went to see the movie. It was good as well, but as per me the book conveyed many more interesting details. Probably something not so easy to convey into a movie, otherwise it would become extremely boring super long one.


No comments


What is the point of the ‘event’ keyword in C#?

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.

Click here to see the gist

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.


No comments


Book Review: Surely You’re Joking, Mr. Feynman!

October 16, 2015 Book Reviews No comments

Surely You're Joking, Mr. Feynman!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.



No comments


Does Your Software Developer’s CV look Professional?

October 11, 2015 Career, Success 2 comments

imageA 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.

Being Specific about Contributions and Achievements

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.

Before

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

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.

English

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”.

Formatting

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.

Before

Previous version was grey 4 pages wall of heavy text with odd formatting.

My old CV formatting

After

The new version is just two pages. It is nicely formatted and is error free. It is available here.

Andriy Buday's CV screenshot

Review

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.

Photo

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.

Next Steps

Recommendation Letters

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.

Cover Letter

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?

Hiring a Professional Resume Writer

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.

Conclusion

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.

Update April 2016

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.


2 comments


Load Test use case requiring plugins and synchronous runs for same data

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.

What we want to load test

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.

My solution

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.

WebTestContextMenu

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.

image

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.

image

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.


No comments


Book Review: Soft Skills: The software developer’s life manual

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.

My takeaways

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.

Conclusion

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.


No comments


Simple check for breaking Database changes using NUnit and T-SQL CHECKSUM_AGG

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#:

Click here to see the gist.

 

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.


No comments


Book Review: The Passionate Programmer

September 15, 2015 Book Reviews, Success No comments

ThePassionateProgrammerCover

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.

What is this book about

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?

My takeaways

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:

  1. Find out what is now highly demanded and how my skill set correlates with it.
  2. Read something about the industry I work in. Should be interesting, as it is nuclear energy.
  3. I need to put myself in “be the worst” situation.
  4. Proceed more actively with learning another programming language.
  5. Try AngularJs. Since I have experience with EmberJS, it would be nice to compare.
  6. Mentor myself (details in the book).
  7. Do some Kata.
  8. Never go too comfortable. I’m pretty sure my current just is exactly “too comfortable”. Time to change.
  9. Do “Refactotum” exercise (by Stuart Halloway).
  10. “Spend next year trying to become one of the alpha geeks.” This sounds strange, but why not?
  11. Find if I have any monkey traps (things I hold on to way too much).
  12. Go Independent.

You

Go ahead, read the book and create a list of action items for yourself.

Just Be Better Than Yesterday!



No comments


Blog course for Software Developers by simpleprogrammer.com

September 11, 2015 Blog, Success 1 comment

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.


1 comment