Help with programming efficiency and speed?

Tom Knowlton
Tom Knowlton used Ask the Experts™
on
This is embarrassing to admit, but I just started a new job, and within a month, my manager has asked me to come to his office so he can talk with me about my lack of progress on the projects I've been given to work on.  This has happened about 4 times.

Finally this last time I just asked him - should I look for another job?  He said no, that I was misunderstanding his intentions.  He says he wants me to improve and that he wants me to think about ways I can get my projects done faster.

I am a slow programmer.  I've been in IT for 17 years, and about 13 of those years have been spent doing computer programming in several different languages, small and large companies, on small and large teams.

I love programming.  But I'm not gifted.  For me, personally, I don't mind being slow at it.  I don't mind the struggle to understand something.  But in the real world - no employer has patience for that, or the ability to "give me more time".  Employers want you to finish as quickly as possible and be accurate.  I don't have speed but I do have passion.

I don't know if I would say I am smart.  I fall apart inside when put on the spot during a verbal face to face discussion.  I don't think on my feet very fast.  I feel the need to mull it over and think about it for a while -- instead of giving a gut reply to a pointed question that usually I regret a few minutes later.  I'm a plodder, not a sprinter.

Okay, enough of that.

What can I do to become faster?

Are all of you super fast and genius programmers?  

I'd like to hear from those of you who are.  Are there key things you do with every project that you feel are crucial to finishing quickly?

I'd also like to hear from those of you who are perhaps plodders like me, who enjoy programming but aren't very fast.  If you feel that you have improved - I'd like to learn about your journey.

Thank you,

Tom
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I think your best bet would be to get someone that can create the models for you. Usually, the hardest part of creating a program is designing how it should work. Which part links to where, etc. Once that is accomplished, you just have to deal with it block by block and create the actual code, which is usually a lot simpler. If you find you have to do it slowly, just get someone that has a more innate talent for it and can create it for you in detail.

I am sort of opposite you. I usually just have a general idea of the model I'm going to use, almost always most of it is in my mind and I prefer to just plunge in, create code and debug/change as I go along. I find it's much easier for me to work this way, even though occasionally I have to redo some things because of a later change/need.

One other thing which would speed up your programming is building/collecting lots of modules for many different needs. There are many things which are repeated in many, many applications. Copy/paste is a valuable friend. Many times, you can create functions to work on any application.
For example, you can create a module that has a function to connect to any database, which accepts connection arguments. You would then import/paste that module to your current project and simply use in your code something like: ConnectToDB("MyServerName","MyUser","MyPass","MyDB").
Likewise, many functions can be created that will increase your programming speed.
Top Expert 2013
Commented:
I've been programming since the 60s, and I can still cut it; but I am not fast. I am quick but not fast.

If you have been programming 17 years, you already know how to do a lot of things logically.  It does not matter what language you are using the logical sequence that has to happen is the same.

So my approach is to pick up a pencil and a piece of paper and write down the sequence.  It does not matter if the sequence is complete or correct.  It is just a list.

Then I just start coding.  When I need a subroutine, I don't think about it, I just put in a place holder.  When I get to the end of the list, I have a draft of the mainline,  and it has only taken a couple of hours.  Now I take a break.  

When I come back I actually go to work coding down through the mainline.  When I come to a subroutine, I probably have some idea of what code is going to be needed so I note it, and continue on. Now I have a shell that should be syntactically and logically correct, but most of the functionality is missing.

Next step is to work through each subroutine.  I almost always test each piece before going on to the next.  then for some strange reason the overall app has almost no problems when I test the whole thing.

Like I said I'm not fast, but I am quick on little pieces, and every big app is a collection little pieces; so I never end up delivering late, because I don't end up having to make massive changes at the end.

The key is think small, just the tiny function you are doing right now; and code and think, instead of separating the operations by insisting on knowing exactly what you are going to write before you code.

Cd&

Commented:
I totally agree with Cluskitt and with COBOLdinosaur.

I am someone who makes a good outline of what I want to do - so that there is a design plan and then I plunge in but I do not program straight away. What I do is write pseudo code in comments and usually with pen/paper (there are pens - I use frixion pens - that rub out amazingly well, heat sensitive, it makes me feel better using a pen than a pencil for some odd reason).

I then check if the logic is there in pseudo code and when I see that it matches the design I program it in, line by line. That way it does not seem as though I'm programming heaps - I am only programming one class, one function, one line - breaking it up in small bits just like COBOLdinosaur mentions.

What I do notice is that the design is crucial and knowing exactly what you want to write per section is crucial as well. But taking it line by line ensures you also test each line as you go.

I use a kind of variable table to test as go, especially with complicated loops. That way I can test with pen and paper to see if the code should produce what it is intended to produce.

A small background about myself:
I was a software developer that was seen as "much faster" as any other. I used to get the more complicated developing algorithms given to me to do, because almost anyone else would take a week to write it while I finished it (tested and working) in a day. That seems extreme but it is what it is. I headed out of software development mainly because I found it "easy" and wanted the more complicated aspect of IT - managing, leading and instructing IT people.

Because I have coordinated, led and educated programmers with exactly the same issues you face, I also know that people who program like you do have some very important skills that are needed in a software development team.

Many young and inexperienced software developers jump in, forget or do minimal design and program what they think is best. They spend hours debugging, testing and ensuring their code is working. Hand it in - and I bet within a year their code has been debugged, retested and changed a million times.

Your code on the other hand, will definitely be well thought out, well structured and even though you spend more time finishing it - the company spends much less time debugging it, retesting it and I'm sure most of your code will still look the same after a year!

As my lecturer told me when I was still learning how to program (15 years ago) - 90% of the programming code is written in 10% of the time. The other 90% of the time is spent debugging what messy programmers have written. My lecturer was trying to change our mindsets into creating good structured, well designed, easy to read and well programmed code. It should be called the Art of Software Development. And you are performing an art form, one that if you write it correctly the first time round saves the company 90% of time later on.

Another very good suggestion that Cluskitt mentioned is ensuring you save good functions and code and make them easily accessible when you write new code. There is nothing worse than reinventing the wheel! When I start to write new code I always first check if I've not done something similar before or if someone on the internet has not done it before in Open Source. There are so many examples of code everywhere that most code has already been written. It is just a matter of finding it - understanding the code you have found, making the changes to the code that is needed and implementing it in the right place in the right away.

Understanding and making small changes to your own old code is always quicker than writing it again. And the same principle counts for helper functions written by other people.

What programming language are you programming in currently? I am sure we could find a good set of reference sites with many code examples. Next to that, I would do what Cluskitt suggests - start making a library of functions you have written. Useful functions that can be used time and time again - and saves you a lot of time in programming.

I hope my thoughts help you in some way to realise that the skills you offer actually save the company money and time in the long run. And I hope that your company will realise that before they waste a lot of money on revisiting code created by the younger generation.
Tom KnowltonWeb developer

Author

Commented:
I currently write in C#.  At our company, I'd say 99% of what we write has no visual interface or GUI.  In other words, my world consists of console applications that run on the command line (in our case visualcron), DLLs and WebServices (and sometimes Windows Services).

Our code runs in a scaled environment.  I am new to writing code for this environment, but my understanding is that code that runs okay on just ONE machine with ONE request at a time to do some work --- does not or may not run as well when that same application is being run thousands of times a second.  Or, SQL queries that work okay on tables with 100,000 rows do not run as well as tables with millions of rows.
Commented:
Luckily there are many many many sites available with good help files and libraries of C# code.

For example - you can start at the Microsoft sites as C# is theres:
http://msdn.microsoft.com/en-us/library/aa287464(v=vs.71).aspx
http://msdn.microsoft.com/en-us/vstudio/hh341490

Others to try:
http://www.csharp-examples.net/
http://oreilly.com/catalog/csharpess/examples/
http://en.csharp-online.net/CSharp_Code_Snippets

The list could go on and on - what is important though, is to find sites that match what you require. So when you need something you would not have to look far.

If I were you, I would make a favorites folder with all the most useful sites for C#. That way you can reference them quickly!

Another idea is look for open source C# software. Download it - and have a look at the code they use for certain functions. Especially if it is similar to code that you need to write yourself. Someone else had done some research on this and found:
http://stackoverflow.com/questions/143088/open-source-c-sharp-projects-that-have-high-code-quality

And here they discuss that even further:
http://stackoverflow.com/questions/155217/good-c-sharp-code-samples


And there are also plenty of people who can help with particular coding problems (like on here!). Many people on here are willing to write code or help with writing code when a direct question is asked.

From what you mentioned above, the kind of code you have to write has to be optimized for performance, so the least amount of actions per thing you are trying to perform (it is the best way to program always, but in your case even more important).

There are great refactoring patterns and design patterns that help with this! As I mentioned in my last post - the design is the most important, if you have that right the code comes by itself.

Martin Fowler wrote a great book about Refactoring (and a workbook that goes with it). See: http://martinfowler.com/refactoring/. I have the book and workbook in my bookshelf and find it extremely handy! Especially for speeding up the code and if you learn the methods well - it will speed up your programming time too!

If you use UML as a design standard, do also have a look at Design Patterns by Gamma, Helm, Johnsen and Vlissides. Have a look here for their site: http://hillside.net/patterns or purchase the book (I have it in my bookshelf!).

What helps me the most when actually starting to code is pseudocoding or writing a comment about each line of code, before actually coding - checking the logic AND then coding it.
This is also a good resource:
http://www.programmersheaven.com/
Tom KnowltonWeb developer

Author

Commented:
Here is my summary of what's been posted so far:

Cluskitt
-Have someone create the models for me (have someone do the design).
-Gather code snippets into a library, one I take with me from job to job.  Make the functions project-agnostic so they'll work in almost any environment.
-Likewise, many functions can be created that will increase your programming speed.

COBOLdinosaur
-Remember that regardless of language, the logical sequence is the same.
-Write down the sequence using pen and paper.
-Create placeholders (method stubs) for the methods you will call (I've noticed that VS will auto create a exception in the methods it creates for you to ensure that they get implemented)
.Once the list is created I take a break (I presume to let the subconscious simmer a bit)
-Return and begin coding.  Soon you will have a shell that should be syntactically and logically correct, but most of the functionality is missing.
-Next step is to work through each subroutine.  I almost always test each piece before going on to the next.  then for some strange reason the overall app has almost no problems when I test the whole thing.
-Every big application is a collection of little pieces.

Wiesje
-Write pseudo code in comments and usually with pen/paper.
-If / when pseudocode matches the design, begin coding.
- I am only programming one class, one function, one line - breaking it up in small bits just like COBOLdinosaur mentions.

-Leverage what has already been done in the Open Source community.

http://stackoverflow.com/questions/143088/open-source-c-sharp-projects-that-have-high-code-quality

http://stackoverflow.com/questions/155217/good-c-sharp-code-samples


-Understanding and making small changes to your own old code is always quicker than writing it again. And the same principle counts for helper functions written by other people.

Luckily there are many many many sites available with good help files and libraries of C# code.

C# language resources online:
http://msdn.microsoft.com/en-us/library/aa287464(v=vs.71).aspx
http://msdn.microsoft.com/en-us/vstudio/hh341490

Others to try:
http://www.csharp-examples.net/
http://oreilly.com/catalog/csharpess/examples/
http://en.csharp-online.net/CSharp_Code_Snippets

and here on EE!

-Check-out refactoring:

Martin Fowler wrote a great book about Refactoring (and a workbook that goes with it). See: http://martinfowler.com/refactoring/.

-and Design Patterns

Design Patterns by Gamma, Helm, Johnsen and Vlissides. Have a look here for their site: http://hillside.net/patterns

I also have the Metsker book with a C# focus.

-programmersheaven.com
Tom KnowltonWeb developer

Author

Commented:
Is there an industry term for the kinds of activities that have been described?

I want to do some more research online about programming efficiency and speed.  What keywords might produce the results I am wanting?

Commented:
Oh that is a great article... especially point 3! Silly of me to have forgotten that.

I am always complaining about those programmers that do not know how to type.
So much time is wasted not being able to type quickly.

Point 8 - is also very useful. I myself use AutoHotKey. It is great for having shortcuts that you have created yourself. For instance: you could let AutoHotKey set up a new method by hitting the windows-m key combination.... just a small example.

And on Point 9: A very very useful book I have forgotten to mention to you - Code Complete by Steve McConnell - It is like a bible to me - although I believe I know most of it off by heart. Do purchase it - if you know everything in that book I'm sure you're programming speed will improve as well.

On the other points - thanks for sharing this article - I am sure to use some of the other points now too!

PS if you are thinking of using AutoHotKey, let me know - I can always help you set up things you need!
Tom KnowltonWeb developer

Author

Commented:
Thanks guys!

This is great information for me and a beginning.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial