Slashdot Mirror


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?"

25 of 74 comments (clear)

  1. XP by VincenzoRomano · · Score: 4, Funny

    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]
    1. Re: XP by Kithraya · · Score: 2, Insightful

      Maybe Extreme Progamming can help.

      No, Extreme Programming can't help anything except to drive decent/good programmers crazy, support lazy/untalented programmers, and cut everyone's productivity in half (or worse).

      From experience with both, I highly recommend Scrum over XP any day of the week. I still hate Scrum (if I wanted to spend all of my time in meetings, I'd have become an accountant intsead of a programmer), but it's far better than XP.

    2. Re: XP by chromatic · · Score: 2, Insightful

      Yeah, all those terrible practices such as testing, refactoring, incremental design, customer involvement, coding standards, and ubiquitous language shared with the customer's business domain really get in the way of coding sometime.

  2. Wow. Quit now by BadAnalogyGuy · · Score: 5, Insightful

    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.

  3. Easiest Solution... by CowboyBob500 · · Score: 2, Insightful

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

  4. best practices by StrawberryFrog · · Score: 4, Interesting

    It's a vague and non-specific question.

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

    --

    My Karma: ran over your Dogma
    StrawberryFrog

    1. Re:best practices by Ramses0 · · Score: 2, Informative

      There are two ways to motivate people- carrots and sticks. If they don't change when you beat them with a stick then you shove the carrot... wait, what am I saying. :^) ... Stick-like motivation can only go so far, and in many corporate / company cases you personally have very little stick to whack people with. The secret is to find something that "the boss / the owner" is passionate about (it might not be technology, but instead uptime / sales / reliability, etc), and then you work to provide many carrots that will lead your coworkers on the path towards meeting your needs and what will also end up making the boss happy.

      Let me give a concrete example. I worked at a startup right around the transition from PHP3-PHP4. There was no such thing as PEAR or MVC frameworks, etc. and there was a wide variety of programming skillz at the shop. We had an existing form-validation framework that was (how to say) heavyweight. All form fields stored in databases, serialize a bazillion objects an every page-submit, session-sizes of 20-30kb for 1-2kb worth of actual data, random page-flow/state bugs, db-synchronization problems, etc. Some people liked it, some people didn't, some people said: "WTF, I will just write straight PHP and do my own ad-hoc input validation, etc" (which was OK in some cases, but made maintainability much more difficult once the form started getting complicated).

      Boss recognized that some things needed improvement, but wasn't really capable of getting involved and setting specific technical priority (and that's not really his job). He was kindof a control-freak, though, and was really keen on "seeing all the error messages that a user saw", so that he could go in and try to rewrite the forms or prompts or whatever so they'd be more clear. Anyway, I wired up some stuff so that error messages could be stored in a database ("integer"=="db" or ad-hoc strings during development), errors onsubmit were dumped into a database of $user, $app, $error, $field, $val, $time, and wrote up a little viewer that would pull errors out for sorting / filtering, and a little editor that would let you edit error messages so they were more clear.

      Then I sat back. Pretty soon boss was using error-message viewer/editor, the improvments to the framework for form validation indeed ended up fixing bugs and increasing performance both in session sizes as well as development times, and other programmers ended up getting irritated by "fix this error message, change that error message, why can't I see your error messages" stuff. Once all the tools were in place and with some gentle advocation, they took to the new system and pretty much standardized on it *of their own volition*. There really is no other way to "herd cats".

      Read the books the OP recommended, and recognize that it's about 20% technology / tool changes, and 80% convincing other people to convince themselves that there is a better way. Build lots of little carrots that *do* in fact make things demonstrably better, and make sure the existing process *is indeed* more painful than the one you are suggesting / building towards. And good luck.

      --Robert

  5. Create simple rules by Bragi+Ragnarson · · Score: 5, Insightful

    Create and enforce simple rules:

    1. Limit access to deployment server - only one or two person can access the server. Even better - create automatic deployment scripts that can be run on the server by those persons.
    2. Create staging server - where you deploy the code from repository. Do not deploy to production until you get a "go" from the client on staged version.
    3. Use Trac - it is a great piece of software that allows sharing information between developers. It provides wiki, ticket handling and repository viewer. And you can subscribe to wiki changes RSS so you can easily publish documentation about your classes.
    4. Use framework - frameworks usually come with a set of coding concepts that ease code reuse.
    5. Communicate findings about bad practices - just talk with your colleagues and tell them how can they write better code, with examples
    6. Introduce unit testing - person that writes unit tests gets a chance to look at own code the second time, which usually means improvements and cleanups.

    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)
    1. Re:Create simple rules by mr.hawk · · Score: 2, Insightful

      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.

      In my experience people will often go out of their way to do things the wrong way. Not saying having a platform that encourages/discourages certain practices is a bad thing but without a strong leadership setting and enforcing standards I believe the impact would be minimal.

    2. Re:Create simple rules by QuestorTapes · · Score: 3, Informative

      Sometimes I've found management to be an obstacle in enforcing some of these types of rules. If that happens, a few ideas for coping:

      > 1. Limit access to deployment server - only one or two person can access the server.

      Sometimes managers insist on either retaining their own access to production boxes or delgating that authority to the 'village idiot'. See below.

      > Even better - create automatic deployment scripts that can be run on the server by those persons.

      If the wrong people are given access to the production boxes, try to limit everyone's access to running a limited set of scripts that log all operations performed, along with who did them, and let you easily roll back the last change. Don't let anyone access the box directly. Then put together an automated failure report that tracks what changes occurred before the box broke. This information can be useful in the uphill battles to stop the idiots from breaking the server.

      If the question "why did the server go down?" comes up every month, it's useful to have a printout ready that says that each time it happened was immediately after Jimmy moved untested code into production, along with details.

      > @. Create staging server - where you deploy the code from repository. Do not deploy to
      > production until you get a "go" from the client on staged version.

      Also, if the validation process becomes subverted by pushes to "get it out the door", set things up so it can be easily rolled back.

      > 3. Use Trac - ...

      Never used it, but it sounds like the kind of thing you definitely want.

      > 4. Use framework - frameworks usually come with a set of coding concepts that ease code reuse.

      Maybe; some are good, some are bad. I've had the misfortune of helping developers select the right framework, only to have management scrap the recommendations and buy overpriced crap that's "oooh, shiny!". If you adopt frameworks, treat them as "on probation". Review and be prepared to get rid of them if they aren't supporting you.

      > 5. Communicate findings about bad practices - just talk with your colleagues and tell
      > them how can they write better code, with examples

      Don't preach. Write it down (Wikis are good for that), and reinforce it in a non-threatening environment like peer code reviews/stand-up meetings.

      > 6. Introduce unit testing - ....

      Agreed.

    3. Re:Create simple rules by oyenstikker · · Score: 2, Informative

      Fire bad programmers. They will undermine all your attempts if you let them.

      --
      The masses are the crack whores of religion.
    4. Re:Create simple rules by Anonymous Coward · · Score: 5, Interesting

      7. Code reviews -- I can't tell you how many times I've caught typos or other problems in my own code as I've been explaining it to my code reviewer. I've also caught other coder's typos/problems when I've been a code reviewer. It also makes it less likely for one programmer to make a change in a dark corner somewhere and put it out there for the world to see without at least someone else's eyes having seen it first.

      8. Design reviews -- if you're going to make a major change, after you've done some planning for the change but before you implement it, get other interested parties involved in reviewing your design. They may have other ideas for how to implement the change that may be better/simpler/less expensive/etc. than what you have planned, or they may have questions that will get you thinking about your own design in a new way. The design review process can be formal, in a meeting scheduled for the purpose of reviewing the design, or it can be informal, just you emailing the design to a few people and asking them what they think.

  6. Try Agile (or Agile with XP) by thrill12 · · Score: 2, Informative

    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
  7. How can yo do group dev. without source control? by KillerCow · · Score: 4, Insightful

    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.

  8. You have a "people" problem, not a technology one. by JaredOfEuropa · · Score: 4, Insightful

    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...
  9. Lightweight Management by Brainix · · Score: 4, Insightful

    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/
  10. Relax by Dr.+Hok · · Score: 2, Funny

    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...
  11. Good book by Scarblac · · Score: 2, Informative

    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.
  12. Real advice by s31523 · · Score: 3, Informative

    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!

  13. Replies... by iamdjsamba · · Score: 2, Informative
    So many things to answer.

    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
  14. Re:Code needs comments by s31523 · · Score: 3, Insightful

    Well, we can agree to disagree. I hope I didn't imply "don't comment" your code, because that is not what I propose. I propose smart, effective commenting. I like McConnell's book Code Complete, or Kernighan and Plauger's book The Elements of Programing Style. I merely agree with Kernighan/McConnell, et. al. on "Don't comment tricky code . . . Comments can't rescue difficult code" And as emphasized in The Elements of Programming Style, "Don't document bad code - rewrite it".

    And for what it is worth, McConnell references a study done by Lind and Vairavan that shows code with large numbers of comments also tended to have the most defects and tended to consume the most development effort.

    I stand by my advise to re-write code that is clunky and awkward and requires a 100 page essay to describe it.

  15. Similar experience by Kell_pt · · Score: 2, Informative

    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
  16. Joel has this one nailed by spinkham · · Score: 2, Informative
    Joel Spolsky is somewhat of a blow hard, but he has some excellent articles. The Joel Test: 12 Steps to Better Code is one of them. It's the absolute bare minimum list of things you REALLY need in a development project.

    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.
  17. Very Extreme Programming... by Anonymous Coward · · Score: 2, Funny

    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

  18. Re:Wow. Run away now by try_anything · · Score: 2, Insightful

    Running away is the right choice. Being a "fixer" for a dysfunctional team is a job for an experienced guy with credibility and authority, who will probably be very well paid for it. A junior guy who needs to "Ask Slashdot" will not be able to make a dent in his colleagues' sloppy practices. Besides, if you're an inexperienced coder, you should be learning from people who do things right, not struggling with crappy people who set a negative example and make it hard for you to follow good practices.