Blog Archives

An Interview With Kate Gregory

Kate Gregory is a C++ expert, who has been using C++ for nearly four decades. She is the author of a number of books, and is an in-demand speaker who’s given talks at the ACCU, CppCon, TechEd and TechDays among many others. She is a Pluralsight author, a Microsoft Regional Director, and a C++ Microsoft Valued Professional, and despite her hectic schedule she still manages to write code every week.

  1. How did you get in to computer programming? Was it a sudden interest? Or was it a slow process?

I did my undergrad work at the University of Waterloo. I started in the Faculty of Mathematics and they taught us algorithms and Fortran as a first year course. I didn’t choose it, but I had to do it. Other such courses followed, and when I transferred to engineering I discovered this was a useful and in-demand skill. I got opportunities to program on my co-op jobs, and it kind of grew from there.

  1. What was the first program you ever wrote? And in what language was it written in?

I don’t actually remember, but it’s a good bet it was assignment 1 in that first year Algorithms/Fortran course. And yes, punch cards were involved. My first program for money was a simulation of the way scale grows inside a pipe – in the piping of steam turbines scale forms in layers that can spall off and cause tremendous damage, so understanding that is an important problem. It led to a published paper for the researcher who hired me, and an award-winning co-op work term report for me. I probably should have demanded credit in the paper.

  1. What would you say is the best piece of advice you’ve been given as a programmer?

Sleep when the baby sleeps. It’s the best advice ever, and I pass it on whenever I can. Second best: the smaller the problem is, the more ridiculous it will be when you finally find it, the harder it is to find. Don’t feel bad about that. Laugh when you finally find the one character typo or the wrong kind of bracket or whatever the tiny thing is that has kept you aggravated for hours.

  1. How did you get in to C++? What was it that drew you to the language?

In the late 80s, I needed to write some numerical integration programs for these multiple partial differential equations I was tackling for my PhD work on blood coagulation. Fortran, PL/1, COBOL, MARKIV and the like were just not going to work for me. My partner was doing some C++ at the time and it seemed like it was going to be much better. Turns out, it was! I had experienced the misery that was the Fortran “common block” so I didn’t want to use Fortran any more, and the other languages were mostly about manipulating text and records, turning input into output. C++ was a better fit for working with numbers, for implementing an algorithm, for giving me what I needed to show some properties of those equations.

  1. Since 2004, you have been a Microsoft Valued Professional in Visual C++, how did that come about? That must feel pretty awesome?

MVPs are chosen primarily for their generosity. You can be a complete and utter expert on the C++ language or on Microsoft’s products, but if you don’t share that and help people with those tools, you won’t get the award. Mine I believe was triggered by my books, and more recently my activities on Stack Exchange sites, backed up of course by conference speaking. It’s nice to have that effort recognized. What I like best about the MVP program is the access it gives us to the team. I can reach just the right person if I have some issue with the Microsoft tools, and get advice or an explanation or “we’ll fix that in the next release.” Of course, the award certificates look good on my “bookshelf of showing off” as well.

  1. You hold an incredibly busy schedule between speaking at conferences, travelling, and doing Pluralsight courses, how do you keep your skills up to date?

It’s part of my job to stay current. If I spend an hour (or an afternoon) swearing at a development environment on a platform I don’t normally use, well that counts as work. It’s as valuable work as preparing a talk or doing something billable for a client. So is reading long documents about what’s new in C++ or trying out a new library someone has released. What’s nice for me is that once I’ve put that learning time in, I can use it in many different ways – as the backbone of a talk, a blog post, to help a client going through the same thing, as part of a course, and so on.

  1. If you were to start your career again now, what would you do differently? Or if you could go back to when you started programming what would you say to yourself?

I came up through a sort of golden age. You had to teach yourself things, or find someone to teach them to you, because there wasn’t a lot of training available. But then again, people didn’t demand credentials or challenge your background. If you said you could do something, the general response was to let you go ahead and show that you could. I think I would just reassure myself that my somewhat unusual path was going to work out to be amazing. I really only had a traditional job for two years after I finished my undergrad work. By the time my grad work was done I had a business with my partner, and we have made our own path for three decades now. It’s had some ups and downs, but I don’t think I would actually change any of it.

  1. If there is such a term, what would an average working day look like for you?

Oh there are most definitely no average days. I have routines when I’m home – swimming in the morning, coffee and email before I get out of bed – but I do so many different kinds of work that it’s hard to characterize. I try to react to my moods if I can – some days are better for writing a lot of code, others are better for big picture design whether of code, a course, or something I’m writing, and still others are the days when you have to catch up on emails, phone calls, paperwork, and buying things. Some days I might be elbow-deep in code when it’s time for my evening meal and I just keep right on working well past when I should have gone to bed. Other days I stop in the afternoon and for the rest of the day I just do something – anything – that isn’t work. It’s nice to be able to work according to my own rhythms. I have to be diligent about deadlines and promises, and some days I have to do things that are a little suboptimal because I have no more room to rearrange, but for the most part I do things I like from when I get up until when I go to bed, I do them side by side with my partner (my husband is my business partner) and I get paid for it, so that’s a pretty nice life, isn’t it?

  1. What would you say is the best book/blog you’ve read as a developer?

The Mythical Man Month got me thinking about the big picture of managing teams and people, managing projects, instead of just writing code. And it showed me that people can disagree and best practices can change. While I rarely draw on specific facts or quote from it, it changed the way I thought about creating software.

  1. Do you mentor other developers? Or did you ever have a mentor when you started programming?

Yes, I mentor others – I’ve done so as part of a paid engagement and I occasionally just offer unsolicited advice to those I think need it. People ask me to help them and if I can, I do. That doesn’t mean I’m going to write half their application pro bono, but I answer questions and suggest things to learn or try. I’ve been the happy recipient of a great deal of marvellous advice from friends and peers, folks who were a little further ahead on one aspect of all the huge difficulty that is being a developer, and would tell me things I needed to know or introduce me to the right people. I try to do the same for others as often as I can.

    1. If you do mentor others, how did that come about? Do you do face to face mentoring, or do you do electronic mentoring?

Because I live in the middle of nowhere, most of my advising is not in person. I have had regular Skype calls with those who I am advising, and that works really well. Sometimes people email me their questions, or even message my public Facebook page, but the nice thing about Skype is I can see their screen, or show mine, while we’re talking live. That’s generally a lot better than email or other kinds of asynchronous messaging.

Then again, some of my most valuable advice has been given in restaurants and pubs. There’s no need to be in the same place if I’m explaining C++ syntax or architecture or “good design”, but career advice, soft skills things like dealing with difficult people or knowing if you’re charging enough for your time – that works better when we’re in the same place and relaxed. It’s one of the great things about conferences and other in-person get-togethers – a chance to give and get advice, or to listen to other people’s advice sessions.

  1. Finally, what advice would you give to someone is looking to start a career as a programmer?

Be prepared to keep learning your whole life. Be prepared to spend a long time learning something, to use it for a while, and then to see it become useless. Don’t fight that, move to the next thing. Watch for the big architectural and people lessons that still apply even when you don’t work on that platform, in that language, or for that kind of business any more. Hold onto the wisdom you build up, while realizing you still need to learn new knowledge (language syntax, tool use, platform idiosyncrasies) every day.

You can learn from online courses, from working on a project on your own time, on the job if you’re lucky, from just trying things and then frantically Googling when they don’t work. You can combine dozens of different ways of learning things, getting unstuck when you’re stuck, and realizing when to give up and start over. We all feel stupid from time to time, that doesn’t mean we really are. (If you’re working with the pre-release of something, you may have found a bug – I’ve done it and most of my friends have too. It isn’t always you who’s wrong.) And we all have to start over – new languages, new tools, new teams, new platforms – from time to time. If you know how to learn, how to start at something and recognize where you can use things you know from before, how to ask the right questions and how to make sure you don’t have to ask the same question twice – you’ll be doing very well indeed.

Oh, and sleep when the baby sleeps. Do not forget that. In the larger sense, that advice applies even for people who never raise a baby. There are times in your life when there just isn’t time to do everything, so you have to do the most important thing whenever you get the chance. Don’t waste time doing the second most important thing if there’s a good chance you won’t get another opportunity to do the most important thing. When you have a new baby, that means you don’t tidy during naps – your most important thing is sleeping and you do it whenever you can. When you’re writing software, there’s never enough time for everything. If you spend time doing less important things, you may never get to do the most important ones. That’s a disaster. Know your priorities and don’t skimp on what’s most important when there isn’t enough time to go around – which is most of the time, to be honest.

Advertisements

Bits and pieces…

It’s been a while since I’ve posted, and for that I am sorry.  Life suddenly got busy, but here’s a post that’s been bubbling away the last few weeks.

One of the things I’ve always been blessed with (in some sense at least) is the knowledge of my weaknesses.  I’d argue that it’s a very important skill in a Software Engineer to know where their weaknesses lie.  I’m not talking about putting oneself down and making out that you know nothing.  Not at all, I’m talking about having sober judgement about your skills as a programmer.

So recently, I had cause to come across an area I’d never dabbled with as a programmer.  I’ve been doing some experimentation work on something that required me to have knowledge of bit-shifting and masking.

For those who were brought up in C, this is probably second nature to you, and you can safely switch off now.  I won’t be offended.  For the rest of you who are still with me, the inability to understand bit-shifting and masking is not something you should be ashamed of.  It wasn’t something I was taught at University (I did an Internet Computing degree).  It’s something I’ve had to learn fairly recently.

But before I get to some code (yes I know! actual code!!) I think it’s a good idea to go over bit-wise operators VERY quickly.

So you have a bitwise AND operator (&), a bitwise OR operator (|), a bitwise Complement opearator (~) which is also known as an inverse operator.  The AND and OR truth tables are shown below.

 image

The complement operator (~) essentially flips the bits, or inverses them, so you if you had:

000000001 in Binary, and put it through the (~) operator you’d get returned 11111110.

So now we know what the truth table looks like, let’s discuss bit-mapping.  This is generally used to check whether a certain bit is set or not.  It’s commonly used with uint8_t in C++ from what I’ve seen, however it can be used with other unsigned integer types as well.

So let’s say we want to simulate an 8 switch DIP switch.  I’m sure you’ve seen them underneath various electrical appliances.  In case you haven’t, here’s an example below.

As you can see, it has eight switches on it, which allows you to configure your hardware in a certain way.  It’s often seen in remote door bells etc.

So lets say you want to check that bit 1 is set, that is the left switch.  To do that you need to use a bitmask.  So a quick word is needed on binary numbers.  They start at 1, and go up by 2 each time, and you generally write the larger number on the left, and the lowest number on the right.  So for example, for an 8 bit number, the binary values are thus:

128, 64, 32, 16, 8, 4, 2,1 which all add up to 255.

So if we wanted to check that the 1st bit was set, we’d need to check that the bit furthest to the left was set, which in this case is the 128 value.  Bit masks tend to be written in Hex.  So using my Windows Calculator in programmer mode (no shame in that either by the way!!) The hex of 128 is 80.  But we also need to decide what sort of mask we’re going to use.

So if we want to check that the first bit is set in our switch, what sort of bitmask do we need?  An OR based one?  Or an AND based one?  In this instance we need to use an AND based mask.  So the mask in binary would look something like this:

10000000 so for example:

10000001 – Original value
10000000 – Our mask:
===================
10000000 – Result

The mask ONLY checks the bit or bits we’re interested in.  It ignores everything else.

So how do we represent that in code?

Well, like this:

bool checkBit(uint8_t value)
{
	bool returnValue = false;

	if((val & 0x80) == 0x80)
	{
		returnValue = true;
	}

	return returnValue;
}

So what’s going on here?  Well it’s a very simplistic program that simply tests that a bit is set using the bitmask.  So the if statement places a mask over the value, and compares it against the expected result.

So that’s a simple example.  Let’s say we want to print out a number in binary.  There isn’t an easy way to do this in C++, so we have to roll our own.  This brings bit shifting in to the mix.

Bit shifting is basically shifting a bit one way or the other.  There are two bitwise shift operators in C++, >> for a right bitwise shift, and a << for a left bitwise shift.  So to print a binary number from a normal number, we need to shift a bit, and using a mask, check if it’s a zero or a one.  Then based on that, add it to an output stream.  It sounds complicated, but it’s not that hard once you get the hang of it.

In code it looks a little something like this:

#include <iostream>
#include <sstream> // for stringstream

using namespace std;

// For now we print 8 bit numbers.
string printBinary(uint8_t val)
{
	stringstream outputStream;
	//uint8_t lastBit = 0x80;
	for(int i = 1 ; i <= 8; ++i)
	{
		// Check what we have in the first bit.
        if((val & 0x80) == 0x80)
		{
			outputStream << 1;
		}
		else
		{
			outputStream << 0;
		}
		// Now shift everything 1 to the left.
		val = val << 1;
	}
	return outputStream.str();
}

int main(int argc, char* argv[])
{
	if(argc != 2)
	{
		cout << "Usage: ./binPrint <number between 1 and 255>" << endl;
		return (1);
	}
	// We don't put an endl here as we want it on the same line.
	cout << "Printing out binary value of " << argv[1] << " : ";

	// Convert the char to a uint8_t
	uint8_t value = atoi(argv[1]);
	cout << printBinary(value) << endl;
	return (0);
}

So what does this code do?

Well, it loops over an 8 bit number checking what the first bit is.  Based on the result of the mask, it appends it to the end of a stringstream so that a formatted binary string is outputted.  So for example if I want to print out the number 8 in binary, it would come out as: 00001000.

Another thing to note is that we grab the value BEFORE we do the bit-wise shift.  And we’ve got to be careful when shifting to the left, becuase if we’re checking the first bit like we’re doing in the code here, then we could shift things off the end, so we’ve got to make sure we nab the bit we want and THEN dot he bitshift.

Please do feel free to play and have a go.  It’s honestly the best way to learn.  I’m in the process of re-writing my binary printer now to cope with any bit number from uint8_t to uint64_t which is quite a challenge.  I may post that up here once I’m done.

Brother and sisters in arms…

From the 8th to the 12th of April, I and a few hundred people descended on the Marriot Hotel in Bristol to attend the ACCU Annual Conference.  So what is ACCU?  It stands for the Association of C and C++ Users, although don’t let the title fool you.  There we plenty of talks on all sorts of topics and other languages, for example, Uncle Bob spoke on Clojure, the excellent Jon Skeet spoke on how to abuse C# 5, Dan North spoke on why Agile Doesn’t Scale (well worth it!) and even your truly did a lightning talk on self-improvement as a programmer. 

So to the highlights…

Tuesday 8th April

So I was fortunate enough to be able to attend the pre-conference tutorial day which was on the Tuesday, and I elected to attend Nicolai Josuttis’ tutorial on C++11 and C++14 in a day, which was a whistlestop tour of the features that were in C++ 11, and what’s coming in 14 (Which is now out in the latest build of gcc, which is 4.9 at the time of writing.)  And I surprised myself with how much I’d learned by mucking about and watching the various video courses I’ve done at home. Nico is a very engaging speaker, and very easy to listen to and makes it easy for you to be able to absorb what he was saying.  I’m still absorbing if I’m honest.

Wednesday 9th April

The rest of the delegates rocked up today, and so the conference was packed out.  I had the age old problem of too many great talks to attend at one.  However Bill Liao kicked us off with a great keynote on the CoderDojo.

If you haven’t heard of the CoderDojo, it’s a self organised coding event designed to teach kids to program.  It was started by a young lad in Ireland called James Whelton, who started a computer club at his school but when it came time for him to graduate, so the club was in danger of being shut down.  So he approached Bill to help fund an organisation that taught kids to code.  And now it’s growing at quite a rate. 

Bill spoke about the impact of the CoderDojo in Cork, and encouraged the creation of CoderDojo’s all over, as programming is not really taught in schools any more.  I am currently analysing the state of teaching programming in our schools, and a more detailed blog post will follow.

The afternoon had a great talk by Jonathon Wakely on “There’s no such thing as a universal reference.”  This was in reference to something the legendary Scott Meyers said about the rhs (&&) operator in C++.  And the room was jammed as can be seen in the picture below.

 

DSCN0002

It was an interesting talk, and Jonathon spoke of the circumstances where he thought that the use of the term “Universal Reference” was used incorrectly.  I’ll be honest, a lot of it went over my head, however it’s given me something to look up about and read on a bit more.  So that’s good. 

I also volunteered to do a lightning talk based on my experiences of seeking to becoming a better programmer over the last year.  The dangers of twitter…

Thursday 10th April

Thursday opened with Dan North speaking on why Agile doesn’t scale.  Which was quite good, and I wished my manager was there alongside me to hear the talk.  Dan went in to how Agile made projects that were slated to take years were done in months, however projects that should have taken days changed to taking months.  I found this talk quite engaging as the team I’m at work does Agile (I’ve since been corrected, we’ve moved away from that to Kanban now…)

Another great talk was the Art of Learning and Mentoring, which was more of a workshop than a talk, and it encouraged lively debate as to the best way to teach new team members on our teams, and discuss how we learned new techniques.

Although I freely admit that one of the highlights was been able to share a beer with the excellent Pete Goodliffe, and so got to discuss the talk he gave last year, and he kindly agreed to look over my lightning talk.  So beer time well earned methinks.

Friday 11th April

I must confess that between commuting between home and Bristol each day (M5 eurgh), left me shattered at the end of each day, so I’m afraid I missed the keynote this morning, so I could focus on writing my lightning talk for tonight.  And it’s quite a daunting challenge to keep it down to 5 minutes, so I had to be merciless in what I was and wasn’t going to say.

But I’d been looking forward to Friday’s talks.  Mainly as Kevlin Henney was doing a talk on Immutability For The Win, and ironically he was changing his slides just before the talk.  But then the slides pack is a stack so it wasn’t really immutable….apparently.

Biggest highlight for me personally was entering a raffle run by Intel to win a Samsung Galaxy Tab 3.0, and on the Friday the draw was made.  And I won!!  So now that’s in full use at home.  I owe thanks to James Greening who I was sat with at the bar, and convinced me to head down to see the draw, so thanks James!  Beers on me next time I see you sir.

The other highlight was hearing Jon Skeet on Abusing C# 5, and it was quite funny and evil some of the stuff he’d done in the language.  It reminded me of a talk Phil Nash gave last year where he overloaded the –> operator in C++ so that it now pointed to the left (i.e. <- ). 

It just showed that if anyone was that way inclined, they could write vile and evil code that nobody had a hope of understanding. 

Then it came time for me to give my lightning talk, and I’d like to think it went well.  I kept a beady eye on the timer that Ewan was holding up, and finished a minute ahead of time.  However I think I may have rushed some elements of it.  It was a VERY full room, but what struck me was that nobody was glaring evilly at me, (won’t mentioned where I had that experience).  And I realised that what Malcolm said was right, that they were rooting for me.  So thank you all for listening.  The problem is no Phil Nash has challenged me to put in for a full talk next year.  So watch this space.

Saturday 12th April

By this point, my brain was pretty much mulch.  But still I bravely carried on.  Among the highlights was Arjan van Leeuwen’s talk on The Evolution of Good Code.  In which he discussed the discipline of writing good code, and compared what a number of text books had to say.

I also attended Anthony Williams’ talk on the continuing future of C++ Concurrency (multiple threading).  I’ll admit that this wasn’t the talk I was expecting, and as I’d done next nothing with threads in C++, I quietly slinked out (Sorry Anthony, nothing personal).  However as I’ve got Anthony’s book, it won’t happen again.  (Will post code to prove that I understand it ;-)  )

The conference was closed by Howard Hinnant on talking move semantics in C++, which was a very interesting.  I dutifully drew the chart he had in his slides, and will be revising that as often as I can.

Conclusion

I loved every second of this conference.  I’ll admit a lot went over my head, however I learned a lot as well.  I also made some great new contacts.  And I have some new challenges to take on this year.  Would I go again next year?  Yes, without hesitation.

And if you’re interested in being part of a large C++ community, then can I commend the ACCU to you.  While the acronym says C and C++ Users, it’s by no means exclusively the C++ language.  For instance, I also develop in Python, Java, C# and a few other languages as well, and I’m sure I’m not the only member either.  You get two publications, and great discounts on the conference. 

If you’re interested in joining then head on over to the ACCU Website for more details.

Compact SQL Databases….

I’m in the process of developing my first app for the Windows phone platform.  I won’t say more than that for now, but it requires the use of a database at the back end to hold user account details.

Now, sadly Windows Phone on it’s own, or Visual Studio (from what I could see so far) didn’t have a mechanism for me to check what’s going on in the database that’s sat on the Virtual Windows Phone. 

I’d recently made changes to my app so that the user could select the account type they wanted to store for the app as can be seen in the screenshot below:
 screenshot of app

And so I wanted to see that what I was doing was actually adding stuff to the data base, and therefore would allow me to start doing more clever things with my app such as firing off requests and the like.  But I digress.

So how did I do it? 

So Windows Phone stores the data base as an SQL Server Compact database, which stores everything in an sdf format.  So the first trick was to get that off the phone.  The tool I used for this was the Windows Phone Power Tools, which can be found here.

ConnectToDevice
So I fired that up and you get the above screen initially.  So we need to select which Virtual Device (or actual device, I’ve not tested this with my actual Lumia yet) we want to connect to.

Once we’ve done that, we’re in, and can get about downloading the file.  The first thing I learned is that if I’m on the screen that’s interact with the database, it won’t download the file.  So do all the Database stuff you want to do, then close down the app, BUT NOT THE DEVICE! 

Once you’re ready to get the file, navigate to the .sdf you’re interested in.

WindowsPhonePowerTools
You will need to click on it, and select GET and it will transfer the file from the device to the location of your choice.

The biggest problem I had then, was what to use to read the .sdf file.  There’s a load of great utilities out there I’m sure but most of them didn’t work for me.  What actually did work was CompactView.  Sure it looks a bit basic, but it opened the .sdf file for me, which allowed me to check that the data I’m looking at was accurate.  It also allows you to have a context menu option as well.

CompactViewSelect
So to view the file, select CompactView, and you’ll then be faced with the following screen:

CompactViewAccountsDB 

It may not look like much, but at least it told me that my code worked correctly.

So happy coding 🙂

Looking in the rear view mirror….

It’s been almost a year since I heard Pete Goodliffe give his talk on becoming a better programmer at the ACCU Conference.  And I thought it was time to have some sort of review of the year since then.

So what has changed since then?  Well…

Core Skills

I have managed to expand my knowledge of C++ by quite a bit, I know I’ve not put all that much code up on here, the reason is I fear that the stuff I’m learning is so basic that I was worried people would think “He doesn’t know that????”   However I plan to post more on here this year.  That’s a promise.

But on the other hand, I’m not the C++11 guy on my team at work at the moment, and I am playing around with the new compiler quite a lot.  I’ve also learned a lot of the new features, and how they work.  And in a few weeks I will be giving my first ever technical talk.  This time last year, I could imagine giving a technical talk.

Diversify – using the right tools as well…

I had a need recently to write something that would look at a log and grab the last ten minutes of the log, then send that onwards to an auditing service.  And naturally, I went straight to designing the thing in C++.  However I sound learned that it’s important to use the right language for the right job.

So I was going to write it in Perl until my team leader told me that we don’t do Perl on the team, but that I should look at Python as that’s the scripting language of choice.  I will be honest, I tried Python a number of years ago, and didn’t really get on with it, so I approached it with a bit of apprehension.

However I found that after just two days, I’d pretty much written the utility from zero knowledge.  Python is an insanely easy language to pick up, and there’s plenty of information out there as well.  And I’ll be honest, I’m hooked.  And an additional benefit is that I’ve achieved one of my aims for 2014, to code in another language. 

But more importantly, I learned that you should use the right tool for the right job. 

So for 2014 I’ve also taken up C# as I’m looking to write apps for Windows Phone operating system, more details about that will follow sooner or later I’m sure.

Self Belief

So I’ve been using Udemy to watch a series of videos by Paul Dietel on the Fundamentals of C++.  And I was stunned at how much I knew.  Those who know me well enough will know that I have always struggled in believing in my abilities as a programmer.  However in terms of C++ at least, I know a fair bit.  But I also know I have a LOT still to learn!

But no longer do I have the attitude of “I can’t do this”.  I am far more likely now to step back and have a think, and within a few minutes come up with the answer I’ve been looking for.

Practice, Practice, Practice, and being active in the community.

One of the things I’ve done a LOT more of this year, is going to websites like cyber-dojo and coderbyte and do the puzzles on there.  I’ve found that my logical thought processes have improved, and my programming abilities have improved too.

I’ve also become a bit more active on Stack Overflow (username Welshboy) and trying to give back to the community where I can. 

I’ve also attended more user group meetings.  I’ve attended a fair few at ACCU Oxford, and where possible Bristol, but I’ve also become a much more active member of my local .NET user group as well.


Books

I’ll be honest, I’ve not read as many technical books as I’d like this last year.  I kept putting down Scott Meyer’s Effective C++ book, no fault of Scott’s I can assure you, but just didn’t pick it up.  So for 2014 I’m planning to have read it completely before the end of the year.

On the brighter note though, I’m currently on Chapter 5 of Bjarne Stroustrop’s C++ 11 Programming Language book.  And I’m learning a lot through that, there have been things I’ve not seen before in there, so I fire up my editor, and have a go at coding what I see in the book.  I’ve learned a great deal just doing that.

Summary

I didn’t achieve everything I wanted to over the last year.  However I am further down the road than I was at this time last year.  I have found I’m quicker on the uptake on a lot of stuff in C++, and I’ve also learned that I shouldn’t be afraid to try different programming languages either.

So what about the year to come?  Well that’s the next post I’m working on, which I hope will be up sooner rather than later.

Looking for a new job?

Pete Goodliffe’s company inMusic are looking for a C++/Juce ninja, the details can be found here: http://www.juce.com/forum/topic/inmusic-akai-pro-alesis-etc-looking-c/juce-developer

They are ideally looking for a permanent employee in the UK; the UK development office is in Cambridge.

Requirements:

  • Great C++ chops
  • Proven Juce experience
  • Ability to craft great GUIs and consider user workflows
  • Cross-platform Windows/Mac development
  • Real industry experience of audio app development
  • Talent, motivation, and a desire to make awesome products!

It’s been a while….

First of all, allow me to apologise for the delay between posts.  If I’m honest, I’m finding it difficult knowing what to put in these blog posts, because I am well aware that the stuff that’s new to me, is not new to a lot of people.  But then again, that was the whole idea behind this blog.  So I’m going to stop second guessing everyone and carry on.

So how have I been learning since my previous post then?

Well, I’ve been reading Bob Martin’s The Clean Coder which discusses a code of conduct for professional programmers.  I won’t go in to detail as to what I’ve got out of it so far, but one of the things that stood out was how he does deliberate practice.

So Uncle Bob explains how he uses a code kata to kick off his day, sort of like a warm up for programming before he start writing production code.  And it’s something I’ve been looking at doing myself.

So to that end, I’ve been using Jon Jagger’s excellent Cyber Dojo to do exactly that.  The idea is that I complete a puzzle, and then eventually I’ll do it again, but slightly differently using a different technique.

The cool thing about Jon’s site, is that you can try the kata in a variety of programming languages, and it’s a completely safe environment to learn and improve as a developer.  There is no competition with others, and nobody’s keeping track of your code except you.

Now if you want to do something a bit more competitive, then there’s always Top Coder which runs various competitions at various times, but I’m nowhere near the standard to take part in this yet as I simply can’t think on my feet quick enough in my chosen language.

The other thing I’ve been doing is reading, and I’ve started reading The C++ Standard Library by Nicolai Josuttis, as I want to get my head around the new C++ 11 standard.  It’s a pretty good read so far, but I’ve not got to the meat of it yet.

I’ve also set myself a few new challenges this month as well.  So I plan to learn one data structure a month, and learn it inside out.  So hopefully in a month’s time there will be a blog post with code samples, on a data structure within the C++ STL.  Now that I’ve said it, I’ve got to get on with it I suppose, so I’d best do that now.

Dealing with other people’s code…

So had an interesting experience today, where I had to maintain some code someone else has written.  It’s not important what the code did, however it was written in some very very clever C, but had next to no documentation.

So what do we do when we’re faced with that situation?

Well I was fortunate that the developer who wrote it still worked where I work.  But rather than take the easy option and pinging him an e-mail going “what were you thinking when you wrote this?”  I decided to have a crack at it myself.  So I checked out the code to my own work area and got to work, adding comments for all the stuff I’d managed to work out.

There were some things I just couldn’t figure out, as I’d not come across them before.  So I put down what I *thought* that code did.  But the cool thing was once I’d done that, I decided that I could now ask the developer about their code, so I sent him a copy of the code with my comments in it, and got his feedback.  I was way out in some things, pretty close on others, which was pretty neat.

So lessons learned:

  • Sometimes, we’ve got to deal with code that isn’t ours.  Therefore it’s moved me to make sure I document my code, because at some point someone’s going to come after me to try and make sense of what the heck I’ve done.
  • When you’re faced with someone else’s code, and they still work at the company, have a stab at working it out for yourself first.  My first temptation was to e-mail the guy straight away, but then I’d learn nothing, and the guy would be rightly pissed off with me for not making an effort.
  • It may be all well and good to be clever and do something on one line, but for the sake of the future developers, if there’s a simple way to write it, then do it that way.  It may increase the line count by one or two lines, but future developers will thank you for it.
  • You can learn a lot by reading other people’s code too 🙂

Hello, World…

This site is devoted to chronicle my journey to becoming a better programmer.  And I hope it will give some tips and tricks that will inspire you or help you to improve as a coder as well.  Why have I done this?  Because I want to improve as a developer, and as you’re here, I assume you do too, which is fantastic.

So some background I think, to set the scene so to speak.

I am a software developer in C++.  I’ve developed in C++ for nearly two years now as I write this, and there’s been some ups and downs in getting the hang of the language.  In 2013 I got to attend the ACCU conference in Bristol, where Pete Goodliffe gave a talk on Becoming a Better Programmer, which was interesting.  Because it’d been something I’d been thinking about for the last few months, but hadn’t made any plans, or really knew where to begin, or what sort of strategy to develop.  Pete invited some respected developers within the community to come up and give 5 minute talks on what they thought helped you to become a better developer.  A couple of talks stood out, Seb Rose on Deliberate Practice, and Anthony Williams on Mindful Coding.

One of the things Pete mentioned was a sliding skill scale.  [photo of the scale here].  So imagine the diagram above.  If I were to ask you RIGHT NOW in terms of programming in your chosen language, where would you place yourself on the scale?

The talk mentioned a few things we need to consider, that will help us to become better programmers.

1.    Be mindful that you want to improve.

I was talking to one of the organisers at ACCU, and we were discussing the skill scale on C++, and where we saw ourselves, and he surprised me, by telling me that Bjarne Stroustrup, the guy that literally wrote the book, and the programming language himself, rated his skill level as a 7.  So if he’s aware of the fact there’s stuff he doesn’t know, then if someone says they’re a 9 or a 10….well….I’ll say no more…

2.    Determine what’s important for you?  Work required skills?  Skills for your personal pleasure.

This is quite important.  In this blog, I’ll be covering how I improve as a C++ Programmer.   And I work in C++ day in day out.  However in my own time, I write mobile phone applications for Android and the iPhone.  (I will get round to Windows Phone but need a new processor for the Virtualisation stuff apparently…)   And my work is important, it’s what pays the bills.  But it must also be enjoyable too.  So there’ll be some mobile dev stuff as well, and possibly how I’m getting on with learning to play the piano.

3.    Know where you are now.  Be realistic!

This is a very important step.  And we must approach this step with humbleness and a degree of humility as well.  We must weigh up where we are now, because we’ve all got to start from somewhere right?  And things will get easier once we’ve defined a starting point.

4.    Know where you want to be? – And be honest about it.

So what’s the destination?  Every ship has a course set, when you get in the car, you usually have a destination in mind, so where do we want to end up with this quest of becoming a better programmer?

5.    Work out how we will get there.

This then is the final step of the PLANNING phase.  There are a myriad of ways that we can achieve our aims and get to our destination, and during this year I intend to make use of as many of them as I can.  Some of them are free, like looking up what you want on Google, or attending community groups etc, but some of them aren’t free, like books, or attending conferences.

So, where am I at the moment then?

Well, I definitely want to improve my C++ programming, in fact, I feel I need to.  Why?  Advancement at work, making myself more employable if I ever decided to leave where I am at the moment, personal satisfaction, the ability to sit through a C++ presentation and follow more of what’s going on.  If my week at ACCU showed me something, is that I understand more than I think, but I still have a long way to go.

So why am I putting myself through all this?  After all it’s going to take at least 10,000 hours of practice to get to where I want to be.  I think I covered some of it in the previous paragraph, another reason would be to build a good reputation with my colleagues, or should I say a better reputation with them.  But also one day, I’d quite like to have the confidence to get up in front of people and present on wheat I’ve done, what I’ve learned and how it can help others.

In terms of C++, I’d say I’m on the bottom rung of the ladder, I know enough to be effective at work, but I wouldn’t feel confident in suggesting a whole new way of sing something, as I’d be far too nervous about sharing my ideas.

So I plan to blog each time I do something, or learn something new.  So I’m not going to make any promises on a posting schedule, or maybe I should?  I’m not sure, I’ll see how I get on.  I will also note any books I’ve found helpful in this quest as well, and my hope is that someone somewhere will learn from the mistakes I’m bound to make in this endeavour.  I also hope I’ll be able to post an interview or two with some respected members of the development community, but that’s a future thing, not a now thing.