Technologies To Improve Group-Written Code?
iamdjsamba asks: "I've been working at my company as a programmer for about 4 months now, and it's apparent that the working methods could do with a refresh. Practices that we need to start changing are things like: non source-controlled changes that get uploaded to our website when they aren't ready; poor code commenting; and very little in the way of code reuse (if I write a class that could be useful to others, I have no easy way of telling everyone about it). I'm currently looking into ways to change this, and was wondering if anyone on Slashdot had experience of what's good and what's not?"
Maybe Extreme Programming can help a little bit.
Maybe Computers will never be as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]
You clearly don't have any managers or developers with any experience because the first thing that a bright manager or an experienced developer would do is install a source control system so that you don't end up in the kind of development shithole you've found yourself in.
I'd recommend leaving for a company that's going to be around for more than a year.
...for the first two (non-source controlled changes and lack of comments) is simply to tell all the developers that if they don't start doing this right now then they will be fired. Both of those things are individual problems and are some of the signs of a bad developer. If they're not prepared to improve their own personal precedures, show them the door...
Bob
Listen to my latest album here
It's a vague and non-specific question.
.net world, tools like fxCop and nCover can be used, even integrated into the build process. The build can be set to break if the quality or coverage criteria aren't met. There may be such tools for your environment.
You've mentioned some of the practices that can help: have source control, have a build server attached to it.
Look into why this is a good idea: it automates ad-hoc, lengthy and painful build processes. Why are you getting "changes uploaded to our website when they aren't ready" ? make it so that going via the check-in and automated build is the best way to do this.
Look into code review methods.
Get some of your co-workers interested in best practices, and in being agents of change themselves. Are the problems apparent to them, or are they happy with the status quo? Can they get on your side here? Remember what the wise man (Martin Fowler) said: "if you can't change Your Organization, change Your Organization."
You don't say what tools you are working with, but in the
My Karma: ran over your Dogma
StrawberryFrog
Create and enforce simple rules:
And you can always switch to Ruby on Rails. It is a good example of framework that helps doing things the right way and gets in the way when you want to do something wrong.
Bragi Ragnarson Lawful Good (I change the law when it's not good)
Seems that could be an interesting solution to your problem. More info here:
:)
http://www.agilealliance.com/ (see the article library and the Agile Manifesto for more info).
It ofcourse does depend on what type of projects you are in, I would not recommend this if you make critical applications that could endanger lives - but seeing your post I think you don't have that restriction
Slashdot: stuff for news, nerds that matter, matter for news, stuff that nerd
How can you do group development without source control? Do you have bug tracking? Automated builds? A deployment policy / methodology / sign-off (or just someone who is responsible for it)?
It sounds like you've got a group of undisciplined cowboys. Good like imposing structure on them.
Source control, and comments are absolutely required. The only reason not to do them is due to personalities, and if you have that problem, you don't have good devs.
Where is the team lead / project manager in all this? Start there. This is a leadership problem that is causing business problems (bad releases, poor quality control, poor communication, no reuse, no reproducibility, no records).
Look into sucking down some things from XP. Daily stand-up meetings, unit testing, and continuous integration would be a good start. They sound bad to cowboys, but they solve these exact problems.
It sounds to me you first need to get a few simple processes in place: building, reviewing, testing, releasing. This is no rocket science; you can probably come up with a simple, workable process yourself with a few hours effort. The real challenge is getting the rest of the team to follow your rules. You are probably not in a position to force the others to work to procedures, so talk to the other devs and the team leader, put a few ideas on paper, and convince the team leader or PM to implement those ideas together with the team.
I would not go with anything like XP or any other far-reaching methodology. No better way to make your programmers hate you and their jobs is to force them to do things completely different. Instead, once you got the basics right, get a few guys interested in XP (or whatever), ask them to do a pilot, and get them to share their experiences. Once you've shown that it works and you have a few others championing the methodology, convincing the rest will be a lot easier.
If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
I firmly believe that social problems require social solutions, business problems require business solutions, technical problems require technical solutions, etc.
Two of the issues that you mention are poor code reuse and a lack of code comments. These sound like human problems. Don't try to solve them with technology.
Your company may benefit from a different project management style. As many people have mentioned, you may be interested in Agile (specifically Scrum and XP). Lightweight management, lightweight processes, and lightweight tools can breathe new life into a company.
Good luck!
Raj Against the Machine! http://social-butterfly.appspot.com/
Your problem is that you've been there only 4 months. Wait another 4 months and you're as much sedated as the others and you won't notice it anymore. Works perfectly...
Say out loud: I'm an Aspie and I'm somewhat proud, I guess. Uh. Can I write an email in all caps instead? Hm...
Buy a copy of The Pragmatic Programmer for everyone in your team, and make people read it. It's a treasure.
Then you'll at least know what the goal is; how you can get people to change their ways and habits is a problem I haven't found an easy answer to yet.
I believe posters are recognized by their sig. So I made one.
You need to move to the new discussion system.
Nothing great was ever achieved without enthusiasm
"I have no easy way of telling everyone about it" You can send one email, and cc everyone you want to see it! Doesn't get much easier than that. Make a common classes namespace or folder or something and put very reusable stuff in there.
nothing
You mean like this one?
Your wish is my command!
And it is done. Learn to have some patience.
Source control is a must. And a hitting lazy employers with a big stick also helps.
Here.
You don't say what language you're using, but if it's dynamically typed, you might like to look into switching to a statically typed equivalent. Static typing enforces a certain minimum level of self-documentation, reducing the damage caused by undisciplined programmers skimping on comments; it provides a certain minimum level of correctness guarantees, reducing the damage caused by undisciplined programmers neglecting to write unit tests for "obvious" cases that "can't" go wrong; and it provides guaranteed interfaces, making code reuse considerably easier and making it simpler to predict how modules of a complex system will interact.
Of course, whether this is a viable option very much depends on what you're doing, how much of an investment you have in your existing unsafe technology, what libraries you need, etc.
Sounds like your organization is either relatively new to the software engineering game or just plain incompetent. The fact that you at least recognize the problem is a good thing. First, find out if there are others like you that find the current practices inefficient. If there are some others, band together and come up with an attack plan focusing on small progressive steps. You can't change the big machine overnight, so you will have to be patient.
"Practices that we need to start changing are things like: non source-controlled changes that get uploaded to our website when they aren't ready;
Build a better practice then show it to people. Hopefully you do have some sort of CM tool for your source code and you have a couple of cowboys just uploading source code. IF you don't, check out Subversion (http://subversion.tigris.org/). To deal with the cowboys, gather some stats on the problems causes by cowboy code being uploaded and then present the hard evidence (this unapproved code cost us $5000 dollars in man-hours) to a manager. The kicker is you MUST have a plan ready to present that will cure the problem. For instance, make the server only accessable by a software librarian/integrator and only he/she can put stuff up on the server which requires code be at least built and run against the current development tip.
poor code commenting;
I am a proponent of well written code. If code is too complicated or hard to understand such that is needs commenting, I say re-write it. Of course there are exceptions. A good ol' fashion code review process could fix this. And I am not talking about a heavy weight CMMI process here.. Simply print out the damn code and hand it to a seasoned developer who owns a red pen.
and very little in the way of code reuse (if I write a class that could be useful to others, I have no easy way of telling everyone about it).
This happens a lot, especially with teams that haven't melded together and don't communicate well. Simple weekly stand-up meetings can help (short, 10 minute meetings in a room with no chairs) just to communicate issues and announce cool things like your nifty new class. It also helps to have a group website or message board so you can say "I did xyz, and I think everyone might benefit. See my blog/post on the group site". Don't have a site or anyone with IT skills to get one up? Try Joomla, it is an easy site content management system that is great for this sort of thing (http://www.joomla.org/)
Good luck! If you play your cards right you could be the hero, or the zero, so watch out!
1) Just to give context to who I am; I am a placement student in the third year of my degree (UK based), therefore holding no power.
2)XP is for some and not others. Having researched into it a while a go, I wasn't taken by it. And to get people to change their practices is always difficult. 3) I work in the IT department for a company that offers careers advice for students; the stuff I work on is web based: Written in java and jsps.
4) We are gradually transitioning to a CVS; all new stuff is put into one, it's the old code that isn't in the right format. The idea of this thread was to try and find intermediary measures/ additional features to aid in my job.
5) There are quite a few simultaneous projects, say 4 or 5, and a coding team of about 20-30 people.
6) We already have a staging server, and all changes are made on the files on there, which is why the changes sometimes get uploaded without being ready... We have coding guidelines and tools to aid development, but most don't use them.
7) Much of the problem arises from the fact many of the changes are minor, to one or 2 lines of code. As a result they are released ad hoc, and as they are only small there is no project manager. Everyone in the team can release content, and generally they are left to their own devices for testing and suchlike.
8) As for emailing everyone to tell them about re-usable code, what about people joining the team at a later point? And what about when someone comes to work on something that could find the code useful, but doesn't remember the email?
Sorry if that's a lot of very non sensical information in one go, but it gets the point accross.
Thanks to everyone so far, it's really good hearing these comments. All comments welcomed, and i'll keep you posted as the changes happen.
http://studentseeksnoodles.blogspot.com: General thoughts of an
It sounds like they have source control, they just don't have proper processes to only take prod code from source control.
They need leadership, without leadership buy-in, there's no way that's going to change. Until the cost of going down exceeds the costs of changing their ways, don't expect any changes.
As for XP - bah! It has some sound ideas (test test test) but that's about it. XP is a guaranteed nightmare down the road for maintenance (good for POCs though0. The meetings are actually a detriment in about 95% of the cases (I'll grant they're good sometimes) since most devolve into merely "I worked on X, Y, Z, and am behind on J" type things that just waste everyone's time. Team leads should know if someone's behind, with a 1-2 min discussion touching base with devs, otherwise, leave them to work instead of interrupting their day with a pointless "15 min" meeting. I've never seen these things be 15 minutes precisely because of the everyone feels obligated to mutter on longer than the previous person so they seem to be doing something important syndrome. If you require meetings, the team lead should summarize, and then call on anyone needing to supply deeper info, otherwise a small open session for questions, and off to work you go.
The cesspool just got a check and balance.
I'm assuming that they have some sort of source control already but just make changes and upload them to their website without checking into source control first and making sure it's tested and ready.
"non source-controlled changes that get uploaded to our website when they aren't ready"
If that's the case then it's a matter of getting new procedures put in place. Good luck with that!
1. It's a 30-year old publishing company, out of which the current 20-strong IT department has evolved. The IT department was born around 15 years ago when someone had the idea of "putting some of our stuff on that new Internet thing".
2. Historically everyone has worked on small 1-person projects, hence teamwork and sharing and re-use are foreign ideas.
3. The hierarchy is very flat reflecting the above: there are a dozen or so techie software engineers, for many of them it's their first job since college and they've been here several years. There are a few managers who are somewhat divorced from what's going on in terms of software development.
I am that more experienced developer that many of you are blaming in your posts. I joined a couple of years ago. In a rare moment of strategic thinking the managers acknowledged that they have a lot to learn and formed a Process Improvement Team and invited me to join it. Unsurprisingly the first two things we proposed were a source control system and automated build tools, and we recommended that all projects should be re-organised, imported into CVS and built and deployed using ANT.
The good news is that all new projects are put into CVS as a matter of course. The bad news is that the majority of existing projects are still floundering outside of source control. there is a perception that the department is too busy to take time out to learn about new stuff (and yes I can anticipate the obvious answer to that: we'll all be less busy if we're more organised), or there is a general inertia from engineers and their managers to make sure it happens.
I've made sure that the stuff I work on most of the time is under CVS/ANT control, but on the few occasions I'm required to maintain legacy code, my blood pressure rises appreciably. I've also created a Java utilities library, and I used to send emails about new classes there, but I don't think anyone else has voluntarily used it or added to it.
We also have an in-house content management system which doesn't lend itself to source control.
I don't actually have any more to add, as I'm fast becoming one of the people who are beyond caring, and actually I've got a really important deadline to meet so I haven't got time ... ;o)
"I'd recommend leaving for a company that's going to be around for more than a year."
Yes, I recommend running away from any problems that life may throw your way. Can't handle job issues? Run away! Can't handle political issues? Run away! Can't deal with the opposite sex? Run away! You'll go far.
I have two important specific methodologies that I've had good experience with:
Get everybody in your group on a single IRC channel and make them talk about code there, instead of face to face. This change the dynamic and tend to make things more transparent.
Make everybody review the diffs that people come up with. A good way to get this to be done reasonably easily is to make your version control mail out diffs, and then delegate review to each person in turn - say, one week each.
Eivind.
Doubting the existence of evolution is like doubting the existence of China: It just shows that you're uninformed.
poor code commenting;
I am a proponent of well written code. If code is too complicated or hard to understand such that is needs commenting, I say re-write it. Of course there are exceptions. A good ol' fashion code review process could fix this. And I am not talking about a heavy weight CMMI process here.. Simply print out the damn code and hand it to a seasoned developer who owns a red pen.
You are soooo wrong. I deal with code every day that is well written but uncommented and therefore unmaintainable and in my mind it should be thrown way. To say that code that is well written, does not need comments, is basically saying that you should be able to understand evething from the variable and function names. This may work if the code is so simple and self contained such that every thing is obvious from looking at a single source file. In the real world, especially the Object orientented world, this is simply not the case.
The fruits of the labour of professional programmers is the code they write, it should be clean, tidy and commented, otherwise it is indistinguishable from the hacks of amatures.
The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
Source control is a must. If you're working with a large team, source control technologies that include PVCS, Merant VM, or Microsoft Visual Source Safe won't work. The check in / check out features in these technologies place locks on particular files. If team members ever leave work without checking code back in, this will cause major headaches. Also, developers don't have the ability to work on the same source and merge the code back in. I'm a big fan of Subversion (SVN) or CVS. Developers are free to work on any source code file they need to. When two or more developers work on the same file, they can perform a merge to resolve any conflicts. When using source control technologies, your developers must always provide comments each time they make a new commit to the source control repository. Without this, you may as well just dump the source control software. Developers not commenting? Bad bad bad, have them follow standards. Perform code reviews if necessary.
Sounds like you need to hold more meetings to get everyone on the same page. You should make it so that at the meeting, each person gets a few minutes to talk about what they have done in the past week or time period since the last meeting and get to talk about what they will be working on during the next week. Also, use the first meeting to lay down some guidelines and talk of implementing some source control.
Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
Precisely why?
Hm, sort of like an XP meeting then. Hm.
how to invest, a novice's guide
We've gone through a similar experience when we grew from a team of 2 to a team of 8 in 3 months. Things we learned to be helpful in the way of tools:
- A Subversion repository for every project, and one repository per person, to host "private" projects. Also, TortoiseSVN for a windows shell integration with Subversion.
- Install Trac for every subversion project. Use it for writing documentation, and for following up on issues by posting Tickets. Tickets help a lot in maintaining the focus on problems and future developments. The integration with Subversion changesets and milestones is bliss.
- Install the appropriate modules for Trac for permission management, and allow your customers and testers to post tickets themselves. Eases up a LOT in the way of issue tracking and fixing bugs fast. It's a great way to have other people build your to-do list dynamically.
- Use frameworks for development. If you're programming with PHP use Symfony for real programming (and not just random code bits).
- Have a shared folder for files.
- Use an appropriate database backend and install common tools for database access (phpMyAdmin, pgpPgAdmin).
- Use the right tools for the job. As an example, remmember that MySQL works well as a fast database backend. But if you stick to MySQL for real applications where integrity and object mapping is relevant, you won't be doing real DB development unless you use views, functions and stored procedures. If you don't have these features, you'll never use them. If you use them, use PostgresSQL.
- Buy a billboard, a big one, and have a handy set of markers available. Do not underestimate the power of a billboard.
These are just things that worked and still work for us. There are plenty more things you can do, but first step is realizing the NEED for change, and getting everyone to work towards that.
"I don't mind God, it's his fan club I can't stand!" E8
The Joel Test
1. Do you use source control?
2. Can you make a build in one step?
3. Do you make daily builds?
4. Do you have a bug database?
5. Do you fix bugs before writing new code?
6. Do you have an up-to-date schedule?
7. Do you have a spec?
8. Do programmers have quiet working conditions?
9. Do you use the best tools money can buy?
10. Do you have testers?
11. Do new candidates write code during their interview?
12. Do you do hallway usability testing?
Read the article for details
Blessed are the pessimists, for they have made backups.
Maybe Extreme Programming can help a little bit.
Actually, I advocate "Very Extreme Programming" in cases like these.
This best practice programming technique is not generally applicable, but it is very effective if implemented correctly. It was first popularized by the well known developers, Smith and Wesson. Smith & Wesson, Glock, and other companies produce commerical tools to assist in managing interactions with extremely difficult co-workers, which may be the only fix for the solution you find yourself in.
Good luck!
--
AC
I suppose someone was going to ask that. For anything other than small projects, XP generates generally unmaintainable code unless it's coupled with strict architectural design guidelines. Something not done in those 'XP' projects I've witnessed. Indeed, the XP advocates generally reject anything having to do with formal design architectures. Ergo, true XP as defined by the advocates generates unmaintainable code as projects scale. Hell, all large projects generate unmaintainable code unless architectural guidelines and designs are adhered to.
and they never happen like that in my experience. Matter of fact, my experience jibes with that of everyone I know that's tried the XP bandwagon.
Note that I don't dismiss XP as inherently bad. It does support some good points. But as a design/project/management philosophy for large projects that have extended maintenance windows with code and requirements changes, XP will lead you quickly down the never-ending chasing your tail code-breakage nightmare. At least for any project I've been associated with. XP won't make good coders out of bad coders, or allow bad or moderate coders to generate "good" projects, despite what they want you to believe.
The cesspool just got a check and balance.
I've spent the last six years developing CGI code. For the first four of those years, we had no real testing system and no source control; for the most part, we basically just made changes on the server and tested them quickly, hoping they worked. We did have a testing tree on the same server, but it wasn't an exact mirror because pie-in-the-sky development was going on there as well. There were 2 to 4 developers total (including my boss), and most of our changes were in response to frantic requests from management, who needed such and such feature RIGHT NOW. Needless to say, this was a bad system, and things were often broken in production while we worked on them.
To solve these issues, we ended up devising a system wherein we kept our source code in Subversion, and each developer had their own test tree which could be accessed from the web, so that we could test our own changes to code. When we finish making changes, we have a script to commit them and another script to put them into production. We have access to the production tree, but under a different account, so that it's inconvenient to get to it. On the other hand, our commit and go-live scripts are quick and easy to use, and now it's a completely natural thing to do, and it barely takes any more time than editing things right in production (not counting, of course, the many hours of time saved by not having to deal with bug reports or code hastily). All in all, the time savings have been huge, and these small changes have drastically reduced our downtime and bugs in production.
Furthermore, there's an understanding that once in a great while someone will need direct access to the production code. The difference is that it's harder to get to than our test code, so we only tweak production code in the extremely rare cases when it's absolutely necessary and for whatever reason it can't be done in test first (I can't recall an instance where we've actually done this, but the option is there just in case). The nice thing is that we don't take the morale hit from the lack of trust because we know that if we needed to, we could change production code.
We also have a simple home-grown web-based bug tracking system that allows our users to submit bugs and feature requests, and queues them up so we know what to work on. All people need to do to enter a bug is to put in a synopsis and description, and then attach a file if applicable. All we need to do when we fix a bug is change the status to closed and write a short message. It doesn't involve a lot of tedious and unnecessary entry on the part of either the users or the developers, so people happily use the system. The developers don't have to be told to use it at all, because it provides a simple, automated way of tracking outstanding issues. The users quickly realize that the only reliable way to get their bugs fixed is to submit them through this system (rather than stopping by our office, emailing, or calling on the phone) so they use it too.
So I guess my whole point is this: You don't necessarily need a complicated methodology. All you really need to do is set up a few ground rules and then script them so they're easy to follow, and make it inconvenient to break them. Source control is also a must (we use Subversion) as it provides everyone with peace of mind, as well as distinct points in the code that we know are stable, so we can roll production back if there's ever a big disaster. You don't have to turn all your developers into code monkeys to get solid work out of them. The key is that you not overcompensate for your problems. If you take away your developers' freedom and replace it with busy-work, you'll end up being far less productive than you could be. The good news is that your problems can be solved without having to do this.
Why?
Well, a well-written code -- which is also a mandatory thing, to me -- will make it very clear WHAT is being done.
A comment's purpose is different: comments should tell you WHY it's being done this way.
Example of a typical bad comment:And a better comment:Depending on how conscientious you are, you might even want to explain why it's BUF_SIZE-1 and not BUF_SIZE. Yes, of course, YOU know. Right now. The next person peeking at the code -- which might be yourself, in three years and in a hurry -- might not, though.
Otherwise -- good post. Thanks for posting.
-- B.
This sig does in fact not have the property it claims not to have.
.NET is an ideal codeing, however you need to get your ducks in a row befor you start changeing thigs. you process my be great, but you need to chack your technology and also it could be a USER error, rather than a you error....of corse is ever REALLY a user error?lol.
consider yourself warned....
I find it much better to have frequent prototype revisions with the customers than running a big project in successive steps, only to find in the final testing stage that the basic structure one adopted from the beginning has some fundamental flaw no one had foreseen.
Try a cat o'nine tails-- they built the damn pyramids with them!
every day http://en.wikipedia.org/wiki/Special:Random
We have a couple of practices that we have put into place at my job. These are examples that are specific to the tools we use (subversion, bugzilla) but there is no reason they couldn't be generalized:
1. General release bug
1.a When any new feature or bug is found it is set as a blocker on this bug if it is to be done for the next release, if it isn't going to be done for the next release, it is set to a milestone value of future.
1.b When a release is given a date/version number we create a specific release bug and move the dependancies over to it.
2. subversion directory structure:
project\
branches\ - contains branches of the code
tags\ - contains named releases for development, testing releases, and new versions
trunk\ - contains the latest copy of the source code
published\ - contains the binary copy of the last release (to staging or production)
2.a when a production release is going to occur we tag the RC as if it is going to be the release.
2.b to commit any revision in the project you must have an open bug that you say in the commit message. I wrote a pre commit hook that checks bugzilla to see if the bug is open and if it is, it puts the message onto the bug as a comment along with a list of files that have changed. If the bug is not open (new, unconfirmed, assigned, reopened) then the commit fails.
The release must sit on the staging server until all the bugs for the deployment are verified to be fixed.
... such as refactoring? I'm curious what other XP practices these projects didn't practice.
I agree with the problem of bad coders, but I'm not aware of any development process that can generate good results from monkeys by anything other than occasional happy accident.
how to invest, a novice's guide