Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Sometimes I have seen some code or part of the project which I could improve but is not related with my current team project.
Those times I have a conflict because despite wanting to help, many teams lack enough people and doing extra work seems like betrayal. Obviously any managers will appreciate much more if you focus your effort on their tasks
What do you do in in these cases?
I have two guiding principles in cases like this:
I am here to do what my boss wants. If it's sweep the floors I can either do it or find another job but as long as I'm here that's what I'm to do.
If the boss makes a bad decision and I know better and tell him and he decides it anyway, it's the boss's prerogative. If I don't tell him then it's my fault.
Unless there's overriding circumstances this dictates that in the case where the code is outside my assignment I tell my boss that the code can be made better, and give him an idea what that means to him in real world terms, and ask whether he wants me to do it or not.
Yes, it does come back to bite me sometimes when I don't just do it, but he's paying me to do X and if I'm tinkering with Y then I'm not doing what I'm paid to do. He just has to pay me to fix it when it does come back to bite me(us)!
I think the key part of your statement is this:
which I could improve but is not related with my current team project
This sounds harsh, but it is based on experience and should be read with an open mind - keep out of it. One thing you learn as you get more dev experience under your belt is that you stay in scope, don't go diving off to fix something that is not scheduled. Here are a couple of reasons why:
when someone is planning the project, they are working with a known set of problems. If you randomly decide to "fix" things you are changing that known set, it is like when you are navigating using a map and someone is changing the map on you
you may think your fix is good for the product but it introduces extra complexities, like who is going to test your fix?
no matter how good you think you are, you run the risk of introducing another bug or unintended side effects into the application
how do you communicate your change to the other team members who may be working in that area?
how do you know for sure the scope of your change, how do you know that you haven't suddenly changed the context of a piece of code elsewhere?
You have good intentions, but if you start doing things like this you may be seen as a cowboy, and others will dislike you pretty quickly.
It is a skill you have to learn - know when not to touch things. You will see ugly code - don't touch! Don't recode things simply because you think it can be done better.
I hope this helps :)
I worked for a small company in the past, and if I saw something that I knew would impact me or someone else down the road, I generally fixed it then and there if I could do so in a short time frame without breaking anything.
You know the kinds of problems I'm talking about. If I don't spend 10 minutes to fix it now, it's going to cost me 30 minutes (over and over) later.
Otherwise, it went on the whiteboard with the other things to do (which was always full) and someone got around to it eventually.
You either clean it up when you're in someone else's house, or you step around their mess. Both choices can cause trouble. Which to choose depends entirely on you and your situation.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
What do you do when you get assigned a project that is just way too hard to do:
Say it's a mammoth project and your boss thinks you alone can handle it
You have knowledge to do somethings, but some other things are a little beyond your expertise at this point in time
Your boss probably thinks it's something that can be done by one person in probably one month
SO users, I would love realistic answers here. This is a real world situation and I am trying to figure out my response to my boss tomorrow on how to approach him delicately.
I just wanted to add an update to my note here. The app in question that my boss is targeting is a "NING like" web app. My hesitation is mostly being the only person being assigned to it for such a complicated app in such a short time period.
This is a situation that everyone has to deal with on a regular basis simply due to the nature of work. (Typically, if you know everything you need to know to complete a job, you've already completed the job and don't need to do it again. :) )
Be honest with your boss about your anxiety. Your manager needs to understand your assessment of the project's risk profile. Odds are good that you'll be doing it anyway. That's OK! This is your chance to shine! :)
Break the problem down into tasks you understand and tasks you don't understand, then start tackling issues one at a time. I, personally, like to alternate between easy tasks and hard tasks. Completing easy tasks helps me feel like I'm making real progress on a gut level, which is important for my personal motivation. Completing hard tasks addresses potential problem areas earlier in the schedule. This mitigates the tail-end risk of the project by evaluating unknowns earlier, rather than letting them fester and explode when you've got 2 days left and no more planning/wiggle room. It also helps your stress level because you know you've gotten the ball rolling on the project's scary bits. Remember-- your unknown areas are where you don't understand the problem domain, so that's where the real risk of schedule/budget slips lie. You need to mitigate those risks early and often. Get the ball rolling with colleagues that you can consult to learn how to do these things.
The one month goal is probably a target. I don't believe it's reasonable to expect person A to realistically estimate person B's scheduled completion of a task in the general case. To track your progress against the target, set up milestones, none longer than 16 hours/2 days, and track your completion rate against them. This goes hand-in-hand with your list of easy/hard tasks.
The simple fact is that, sometimes, you'll just get dumped in over your head. In that case, you may have to make the best of an overwhelming situation. My very first task at my first job out of college was to design a reliable, transaction-oriented, peer-to-peer n-way server synchronization system for high-volume, high-rate data. I told my boss up front that I did not have the expertise for this, and at the time I didn't have enough experience to understand that I needed to push back on the requirements. (In retrospect, given the political environment, I don't know if pushing back on the requirements would really have helped anyway). That was simply a case of a poorly managed project that took about 18 months to ultimately collapse under its own weight. I still leveraged the opportunity to learn a lot and take some knowledge about the way my particular organization worked, though, and that can be very valuable no matter what. :)
Good luck! :)
Edit after question update
Ok, if I understand your update correctly, we're definitely in #4 territory here. There's nothing realistic about creating a competitor for Ning in one man-month. I assumed in my prior answer that you were dealing with someone who had a base understanding of software development. Based on that:
Ask your boss to clarify the requirements more. Perhaps (cross your fingers!) you simply misunderstood what you were being asked to do, or the scope of the project. Always assume competence until absolutely proven otherwise for social reasons. Maybe you were only being asked to come up with an overall design and some very simple proof of concept?
If your boss is truly this out of touch with reality, put together a sensible, 15-minute back-of-the-envelope estimate with him/her on a whiteboard or a shared piece of paper. It shouldn't be hard at all to blow all kinds of holes in this one month to completion. Perhaps your boss thinks you'll be able to reuse some internal code that you're not aware of? This will bring any faulty assumptions your manager is making re: project scope to light.
If your boss is absolutely unreasonable (this doesn't happen often, but it occasionally does-- perhaps the company needs a killer app by the end of the month to sell to avoid going under), prep your resume for an intra- or extra-organizational move (depending on how big the place you work is). Unrealistic expectations on that order can be a sign of organizational desperation or malfunction, and your position may simply not exist 3 months from now.
Don't panic. You may have misinterpreted the goal your boss has. It sounds like he was not very clear if he said only "Ning-like."
Research Ning. What are all the things Ning can do? On Ning's Resources link, they list at least 21 major social network features.
Write up a high-level statement of the goal for this project. Include all the features Ning lists. Also include an objective for how many users this app should serve. Don't try to think about how to solve these goals objectives, or how many programmers it'll take or how long it'll take. Just list them. Keep this write-up to one or two pages.
Present the list to your boss. Ask him, "does this sound like what you had in mind?" Ask a few direct questions to ensure he has looked at your write-up:
"Who are the target users for this application?"
"How many new users per month do you expect to sign up?"
"What level of uptime do we need to support?"
"What's our budget for hosting this service?"
"Do you need this application to support international users?"
"What is the end-user license agreement (EULA) for this application?"
It may become clear at this point that your boss has more modest goals than you assumed. Perhaps he does not intend to duplicate all the capabilities and scale of Ning. So then it becomes a task of getting your boss to articulate more clearly what subset of Ning features or capacity he needs.
Install Drupal, Joomla, or Wordpress, download some plugins, and design a custom site for your boss. That'll probably give him 99% of what he wants, and it's the only way you'll be able to do it in one month.
Don't start by saying "No" or "It can't be done" or "Its too hard" or any of the other things you said in your post. Most managers in a company do not even begin to understand the effort level involved in a programming project and need a little education with their software planning estimates.
I would suggest a conversation which includes the following steps.
Estimates: review the effort level you believe is required for this project to be a success. Make sure that you have thought out tasks in enough detail so that you can answer questions.
Education: if your boss doesn't understand why something will take a certain amount of time, explain as clearly as you can (good analogies tend to help, bad ones can be devastating).
Alternatives: if you believe there is some middle ground or some set of sub features which will fulfill the project needs discuss these alternatives. Managers hate when an employee says something is hard or difficult, they want workable options.
Alignment: are you sure that you and your boss are on the same page about this project? Perhaps you see it as a piece of mission critical software and your boss sees it as a minor enhancement to your existing tools. Be sure that you both have the same expectations; otherwise, you may be planning more complex software than what is being requested.
The most important thing I ever learned in software was how to "push back."
It doesn't always mean saying no. What it means is providing your best estimate of what the impact of new work is. Whether you're saying "yes" or "no", you say, "we can do that, but it will require (x, y and z resource). I think it will take (n days for me, n*a for person b) to understand problem b), but I know how to handle (c, d and e). I've never had to solve problem b before, so I don't know if my estimate for that is realistic."
The difference between "yes" and "no" is whether the cost equation is acceptable.
Any good manager will respect your analysis, question some of your assumptions, expect a round of rethinking, and then, either accept the risks, find additional resources, or abandon the project.
If they say "I see what you're saying, but you're going to have to accomplish the impossible anyway," start looking for another job.
Would your boss not understand the truth? Just talk to him about the requirements of the project, and mention what can and can't be done.
Here's how I would plan it out:
Don't panic and to react - tell your boss that you would like to review the request and will get back to him shortly with questions and concerns
Go through the spec (or if there is no spec, the email or write down the request somewhere) and create a work breakdown structure for each delivery. This should be done to a level where each item is understandable (User Login, Message Entry, etc.)
For each item, est. the amount of work and +/- % amt. based on your knowledge, questions, risks, etc.
Create a list as you're going through the spec of any major/important questions (how many people is this targeted for? does this include the ability for users to IM, etc.)
You now have a rough timeline, risk assessment and list of questions to review with your boss. He'll see that you put some effort into it, may open his eyes to the complexity and provide him with confidence that you are not knee-jerking reacting. He might demand you do it in the timeframe he provided anyway....look for another job, you have at least a month.
What you say is that your perception of the task scope and complexity differs greatly from the perception your boss has. Great.
Most likely you're both wrong: you have misunderstood the requirements and the boss underestimated the task or fell into the trap of wishful thinking.
It's best to go through the requirements with your boss once again, work out together that deliverables are required, try to guestimate amount of time and resource needed to deliver these. If there are blind spots in implementation that you feel you lack skills or expirience for, make this clear and work on the assumption that you'll have spend cash to source these externally (that will at least give you an idea of a market price).
I am sure, the longer you and your boss spend discussing and researching the project, the more detailed the dissussions will become and the better idea of what is feasible will emerge.
The worst thing you can do is to keep quiet. Any good boss relies on developers to give some assessment of a project: either affirmative or hear more questions.
You don't have to say "no", that's not your job to decide whether to go ahead, but you have to be asking good questions.
It really depends on the relationship you have with your boss. If you can, I would just be open and honest with them. Tell them a few things are beyond your level of expertise and you would have to do some research, lengthening the project time. And stress the point that you don't believe you can get it done in a month and you're requesting a team to help.
It's possible your boss doesn't really understand the full scope of the project. If you can break it down into a list of tasks or sections to show how much work really has to go into it, they might see where you're coming from.
In the end, if your boss still wants you to go through with it, just keep stressing that you will do your best but you cannot make any promises about the deadline.
You need to be realistic with your boss. You will come out much better having over-delivered on the project rather than under-delivering on an aggressive timeline.
You have to be honest and tell the boss that there's a problem. However you need to show how much exactly of a problem it is so that you don't sound like an incompetent person waiting for a pink slip.
You need to carefully analyze what is to be done and break it into small parts and see which of them you can do and which you can't. It's normal to have parts in the project which look possible but hard to do - every normal boss usderstands that.
This way you show that the problem is not imaginary and it's not your desire to get nice salary for trivial job.
The truth of course is always the right answer, which your boss will find out eventually, better to fail early.
But with that said, is it something you just don't want to be involved in. Make sure you explain to your boss that you don't want to commit to something that you're sure to fail at but let him know that it could be a learning experience and at least be involved at some level, even if it's to look at the solution after it's done.
Create a realistic schedule and present it to your boss. Ask your boss for his input regarding the schedule. Maintain a positive attitude and let him know that you are both working toward the same end goal. Tell him that this is your best professional estimation of the amount of effort needed to meet all the requirements. Point out where the complexities are if challenged. Be firm and clear and above all else give him an opportunity to speak his concerns. Demonstrate good listening skills and address each of the issues he presents in a language that he feels comfortable with. I wish you all possible success in your project.
If estimations are not yet there then your first task is to do a realistic project estimation. Second task would be to check what technologies are required for the project and check if the knowledge is already available. If not then estimate for the training and gaining the knowledge. I understand boss is boss but you do your part and rest is up-to him. If the boss appreciate others opinion then he will understand but if he is like "I am always right" then you do whatever you can(work as best you can and also look for a new job).
Its a bit on the side of all the good advice I've seen here, but I'll say it anyway: most managers are actually quite smart. Senior managers I've met have all been very smart. The problem is that, as Eric Raymond puts it, they are "differently optimised". So they may need some education. If you assume that they will be reasonable once they know all the facts then you will almost always be correct.
Of course you do occasionally get people who behave unreasonably, or think that saying "make it so" like Captain Picard is Leadership. But they are rare, and do not last long.
Go fight club on him? Get free monies and airfare!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I was asked to make a clone of this: http://www.bragster.com/
Ok, not a clone per se, but a site with similar functionality on a lower budget! How low might one ask? Under 10K, probably under 5K.
My question: how do I explain to a non-tech savvy friend, that this is not possible, in the nicest terms, and convince them not to go to rentacoder.com and try to pay someone to not do it for them.
Has something like this ever happened to you, and how did you deal with it?
people never want to hear "that's impossible" especially entrepeneurial types, it just makes them more dogged. so just show them what -is- possible for their 10k and let them come to their own conclusion.
So, while drawing on other sites for inspiration is fine, "recreate X" is not a scope, it generally means the client hasn't thought it through. For a start, you don't know which parts of that site are really standing out to the client.
So sit down with them and plan it properly, get them to lay out what they want from the ground up, without resorting to "however bragster/youtube/ebay do it".
Just bullet point it, really quick and dirty. you'll then have an idea of the true scope.
i want slick design
i want video uploads
i want video streaming
i want comments
ratings
sharing
competitions
blog
store
leaderboards
etc. etc.
then you can throw some numbers next to each one, and watch them add up to over 10k. this will illustrate your point, and help your friend/client far better than "Trust me don't bother it's impossible"
Extending Kyle's answer a bit - maybe try an analogy for their business.
For example, if they're involved in construction, ask them whether it would be possible to create a 1km bridge spanning a river for $500k (no idea what the actual cost would be).
The difficulty with IT is obviously that it's an intangible thing. Make an analogy that's tangible.
Find a site that looks like it cost $5,000 and send your friend a link to it.
Everyone knows a good website takes six to eight weeks to develop.
I was an a similar situation. A friend pitched me a business idea for a social networking site. I asked her, "sounds fun, but how exactly is this going to be competitive with all the sites that have well-established userbases?"
Granted, I wasn't expecting a good answer to that question, so maybe it wasn't incredibly nice. Still, she thought about it, and twigged that the idea wasn't going to make any money, and that she had underestimated the difficulty of the undertaking. I didn't have to tell her so in any condescending, didactic sort of way, so I didn't feel like too much of a jerk about it.
Come up with several metaphors that point out how out of place you think the request is, and use them repeatedly until the point is made. Brute force attacks for the win!
In general, it is not advisable to do rough estimations because the result will be wrong. You would be under estimating because of a lot of things.
In this case (and just because you are certain the task is impossible given the cost requirement) you could do a rough estimation where you divide the project in specific tasks and maybe milestones with time and resources required for each. Give this estimation to your friend and tell him that is a first-approach/very-rough-estimate/very-risky-because-of-lack-of-a-formal-analysis.
Other posts here in SO may provide some guidance to you: https://stackoverflow.com/questions/tagged/estimation
Shall I forward all the horror stories I get from people who used services like rentacoder? Yikes.
We all know that if they go that route, it's roughly equivalent to throwing the $5000 in the shredder. Maybe you can suggest they find a partner to start the business with who can do the coding. If they get someone jazzed about it, and offer them equity, a) they're not out the $5000 and b) they have at least a chance of getting code that doesn't suck.
Here in the bay area, at least, there are any number of hackathons and meetups where developers looking for projects go. If the idea is good, and the person promoting it is sufficiently enthusiastic and personable, someone will be interested.
check Clipshare, http://www.clip-share.com/
you need to "setup" an ffmpeg or another engine to encode videos, flix or another you want in the server, but its pretty easy to setup in general and cheap also.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
You and I want to be the expert on computer programming or website design, but sometimes a customer would rather try their hand at your specialty than concentrate on real estate sales, marketing, or being a former member of the Israeli army. Then we have a choice: either figure out how to tell the prickly customer their logo would NOT be better spinning in 3-d with a righteous lens flare, or perhaps suffer the small indignity of making link texts as verbose as possible in direct opposition to any style guide ever written.
Have you been able to convince your customers to focus on whatever it is they are trained to do so they will let you execute your technical skill to the best of your ability?
I always try to point my clients in the right direction with regard to design. Sometimes it's just not possible though; they want something that's dreadful design, but they're convinced it's essential to their system. If they're unconvinced after a modest pitch, I just do what they want. They are, after all, the ones paying me (usually) thousands of dollars to build to their spec.
Often the reason the client wants to get involved is they are concerned consciously or unconsciously you don't understand the details of their business or how they do it.
The best approach is to work with the client to learn their business. This involves zero assumptions and learning the "how they do it" of their business. From that, discover all the data they use, what states the data sits in at what point in their process.
Keep taking it back to them and eventually they will realize that not only do you understand their stuff, what they want, and what direction they want to go in, but that you might even know the implications or impacts better than them.
After this they will usually stay out of your hair. This can be hard though when working with micromanaging types, or engineers. By nature they want to know how everythign works which is great. The timing of when it's best to learn how it works is the tough part.
Often you can get stuck in more conversing about solving a problem than it would take to just fix it. Maybe you can tell us more about the client's personality.
The trick is to get them to make the right decisions, but think it's their idea. :-)
You can't have this conversation with them easily in the abstract, but you can drill down and guide them towards the side of righteousness on each individual decision. Eventually, after you've been through this a few times, they'll start to trust you.
If possible, it helps to wait a day. Tomorrow they may be less clear on exactly what they asked for. (Do they really have their heart set on a flaming logo, or was it just a whim?) Then, in your response, you: describe what you recommend, and why. Restate agreed-upon objectives, and show how the solution meets the objectives. And make it sound like it was their idea. ("The point you made yesterday about xxx is really excellent, and I think that suggests a yyy solution.")
At this point you have a choice. You can ideally pretend you never heard their silly suggestion. Or if you feel you have to, respond to it tactfully and explain costs. ("I'm a bit concerned about the animated logo idea, because it may not convey the brand image the way you requested. Of course if you want to go this route, we certainly can--in which case I'd suggest we get our graphic design consultant involved. Let me know if you want to explore this further and get a quote from the consultant for his services.")
I found that customers are always easier to convince by "optical evidence" than by theoretical arguments - so you could e.g. show them logos or the general style used on websites which won a price for their usability, or maybe even show them how some big competitor is doing it, and then point out the benefits based on what they see.
I've also once managed to get rid of a really terrible user interface suggestion by making screen mock-ups of how this feature would actually look and work - and I made sure to make thes mock-up as unappealing as possible ;-) When I presented them, the client quickly realized that there were better ways of achieving his goal.
Knowledge is power. When you know a client is doing something wrong, have the facts ready as to why and present them quickly and in plain english. You need to remind them why they hired you in the first place.
Bearing that in mind, sometimes clients insist on shooting themselves in the foot. Have backups ready, use version control, but most of all: don't antagonize them. Your reputation is worth a lot more than their 3d-logo-spinny site.
Very carefully.
You've got several conflicting issues here: you want to keep the relationship (and the revenue), you want to do good work, and you don't want to end up with your name on a turkey.
Start by asking lots of questions about the business aspect: what do you want it to do, who do you want to reach, what impression do you want to give. Sometimes that will let you turn the discussion to more useful topics.
If that doesn't work, sometimes it helps to mock up the customer's idea and your idea, and compare them; if yours is clearly superior, they may see it.
If not, sometimes you have to remember that contracting/consulting is a form of prostitution; you do what the customer wants, whether it's your favorite thing or not.
The other thing to remember is a lesson I got from another consultant years ago: some customers aren't worth the trouble. he recommended that once you have enough business to live, you make a practice of firing your least liked 10 percent of the customers. Over time you develop a customer base that you can work with, and give the turkeys to someone else.
The problem with customers is that they are the customer. They have hired you to do a project to their specifications. What they seem to have missed in your example is that they have hired you because of your experience. You need to remind them of that fact in a gentle way. Perhaps a story such as "At one client, we used a logo like that and they expereinced a drop in traffic. Once we switched to a flat icon the traffic returned." Doesn't have to be true, per se, but you need to sell it.
All you can do it explain to your customer that they hired you for your expertise in design, but at the end of the day, the customer is always right.
If you find you don't enjoy working for customers like that, simply state at the beginning of a new project that you require complete creative control. If they still want rotating logos, then you'll have to put up with it for that project but at least you can decline any offers from the same customer in the future.
Closed. This question is off-topic. It is not currently accepting answers.
Closed 10 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I've been working with a small group of people on a coding project for fun. It's an organized and fairly cohesive group. The people I work with all have various skill sets related to programming, but some of them use older or outright wrong methods, such as excessive global variables, poor naming conventions, and other things. While things work, the implementation is poor. What's a good way to politely ask or introduce them to use better methodology, without it coming across as questioning (or insulting) their experience and/or education?
Introduce questions to make them realise that what they are doing is wrong. For example, ask these sort of questions:
Why did you decide to make that a global variable?
Why did you give it that name?
That's interesting. I usually do mine this way because [Insert reason why you are better]
Does that way work? I usually [Insert how you would make them look silly]
I think the ideal way of going about this is subtly asking them why they code a certain way. You may find that they believe that there are benefits to other methods. Unless I knew the reason for their coding style was due to misinformation I would never judge my way as better without good reason. The best way to go about this is to just ask them why they chose that way; be sure to sound interested in their reasoning, because that is what you need to attack, not their ability.
A coding standard will definitely help, but if it were the answer to every software project then we'd all be sipping cocktails on our private islands in paradise. In reality, we're all prone to problems and software projects still have a low success rate. I think the problem would mostly stem from individual ability rather than a problem with convention, which is why I'd suggest working through the problems as a group when a problem rears its ugly head.
Most importantly, do NOT immediately assume that your way is better. In reality, it probably is, but we're dealing with another person's opinion and to them there is only one solution. Never say that your way is the better way of doing it unless you want them to see you as a smug loser.
Start doing code reviews or pair programming.
If the team won't go for those, try weekly design reviews. Each week, meet for an hour and talk about a peice of code. If people seem defensive, pick old code that no one is emotionally attached to any more, at least at the beginning.
As #JesperE: said, focus on the code, not the coder.
When you see something you think should be different, but others don't see it the same way, then start by asking questions that lead to the deficiencies, instead of pointing them out. For example:
Globals: Do you think we'll ever want to have more than one of these? Do you think we will want to control access to this?
Mutable state: Do you think we'll want to manipulate this from another thread?
I also find it helpful to focus on my limitations, which can help people relax. For example:
long functions: My brain isn't big enough to hold all of this at once. How can we make smaller pieces that I can handle?
bad names: I get confused easily enough when reading clear code; when names are misleading, there's no hope for me.
Ultimately, the goal is not for you to teach your team how to code better. It's to establish a culture of learning in your team. Where each person looks to the others for help in becoming a better programmer.
Introduce the idea of a code standard. The most important thing about a code standard is that it proposes the idea of consistency in the code base (ideally, all of the code should look like it was written by one person in one sitting) which will lead to more understandable and maintainable code.
You have to explain why your way is better.
Explain why a function is better than cutting & pasting.
Explain why an array is better than $foo1, $foo2, $foo3.
Explain why global variables are dangerous, and that local variables will make life easier.
Simply whipping out a coding standard and saying "do this" is worthless because it doesn't explain to the programmer why it's a good thing.
First, I'd be careful not to judge too quickly. It's easy to dismiss some code as bad, when there might be good reasons why it's so (eg: working with legacy code with weird conventions). But let's assume for the moment that they're really bad.
You could suggest establishing a coding standard, based on the team's input. But you really need to take their opinions into account then, not just impose your vision of what good code should be.
Another option is to bring technical books into the office (Code Complete, Effective C++, the Pragmatic Programmer...) and offer to lend it to others ("Hey, I'm finished with this, anyone would like to borrow it?")
If possible, make sure they understand that you're critizising their code, not them personally.
Suggest a better alternative in a non-confrontational way.
"Hey, I think this way will work too. What do you guys think?" [Gesture to obviously better code on your screen]
Have code reviews, and start by reviewing YOUR code.
It will put people at ease with the whole code review process because you are beginning the process by reviewing your own code instead of theirs. Starting off with your code will also give them good examples of how to do things.
They may think your style stinks too. Get the team together to discuss a consistent set of coding style guidelines. Agree to something. Whether that fits your style isn't the issue, settling on any style as long as it's consistent is what matters.
By example. Show them the right way.
Take it slow. Don't thrash them for every little mistake right off the bat, just start with things that really matter.
The code standard idea is a good one.
But consider not saying anything, especially since it is for fun, with, presumably, people you are friends with. It's just code...
There's some really good advice in Gerry Weinberg's book "The Psychology of Computer Programming" - his whole notion of "egoless programming" is all about how to help people accept criticism of their code as distinct from criticism of themselves.
Bad naming practices: Always inexcusable.
And yes, do no always assume that your way is better... It can be difficult, but objectivity must be maintained.
I've had an experience with a coder that had such horrible naming of functions, the code was worse than unreadable. The functions lied about what they did, the code was nonsensical. And they were protective/resistant to having someone else change their code. when confronted very politely, they admitted it was poorly named, but wanted to retain their ownership of the code and would go back and fix it up "at a later date."
This is in the past now, but how do you deal with a situation where they error is ACKNOWLEDGED, but then protected? This went on for a long time and I had no idea how to break through that barrier.
Global variables: I myself am not THAT fond of global variables, but I know a few otherwise excellent programmers that like them A LOT. So much so that I've come to believe they are not actually all that bad in many situations, as they allow for clarity, ease of debugging. (please don't flame/downvote me :) ) It comes down to, I've seen a lot of very good, effective, bug free code that used global variables (not put in by me!) and great deal of buggy, impossible to read/maintain/fix code that meticulously used proper patterns. Maybe there IS a place (though shrinking perhaps) for global variables? I'm considering rethinking my position based on evidence.
Start a wiki on your network using some wiki software.
Start a category on your site called "best practices" or "coding standards" or something.
Point everyone to it. Allow for feedback.
When you do releases of the software, have the person whose job it is to put code into the build push back on developers, pointing them to the Wiki pages on it.
I've done this in my organization and it took several months for people to really get into the hang of using the Wiki but now it's this indispensable resource.
If you have even a loose standard of coding, being able to point to that, or indicating that you can't follow the code because it's not the correct format may be worthwhile.
If you don't have a coding format, now would be a good time to get one in place. Something like the answers to this question may be helpful: https://stackoverflow.com/questions/4121/team-coding-styles
I always go with the line 'This is what I would do'. I don't try and lecture them and tell them their code is rubbish but just give an alternative viewpoint that can hopefully show them something that is obviously a bit neater.
Have the person(s) in question prepare a presentation to the rest of the group on the code for a representative module they have written, and let the Q&A take care of it (trust me, it will, and if it's a good group, it shouldn't even get ugly).
I do love code, and never had any course in my live about anything related to informatics I started very bad and started to learn from examples, but what I always remember and kept in my mind since I read the "Gang Of Four" book was:
"Everyone can write code that is understood by a machine, but not all can write code that is understood by a human being"
with this in mind, there is a lot to be done in the code ;)
I can't emphasize patience enough. I've seen this exact sort of thing completely backfire mostly because someone wanted the changes to happen NOW. Quite a few environments need the benefits of evolution, not revolution. And by forcing change today, it can make for a very unhappy environment for all.
Buy-in is key. And your approach needs to take into account the environment you are in.
It sounds like you're in an environment that has a lot of "individuality" to it. So... I wouldn't suggest a set of coding standards. It will come across that you want to take this "fun" project and turn it into a highly structured work project (oh great, what's next... functional documents?). Instead, as someone else said, you'll have to deal with it to a certain extent.
Stay patient and work toward educating others in your direction. Start with the edges (points where your code interacts with others) and when interacting with their code try to take it as an opportunity to discuss the interface they've created and ask them if it would be okay with them if it was changed (by you or them). And fully explain why you want the change ("it will help deal with changing subsystem attributes better" or whatever). Don't nit-pick and try to change everything you see as being wrong. Once you interact with others on the edge, they should start to see how it would benefit them at the core of their code (and if you get enough momentum, go deeper and truly start to discuss modern techniques and the benefits of coding standards). If they still don't see it... maybe you'll need to deal with that within yourself (especially on a "fun" project).
Patience. Evolution, not revolution.
Good luck.
I don a toga and open a can of socratic method.
The Socratic Method named after the Classical Greek philosopher Socrates, is a form of philosophical inquiry in which the questioner explores the implications of others' positions, to stimulate rational thinking and illuminate ideas. This dialectical method often involves an oppositional discussion in which the defense of one point of view is pitted against another; one participant may lead another to contradict himself in some way, strengthening the inquirer's own point.
A lot of the answers here relate to code formatting which these days is not particularly relevant, as most IDEs will reformat your code in the style you choose. What really matters is how the code works, and the poster is right to look at global variables, copy & paste code, and my pet peeve, naming conventions. There is such a thing as bad code and it has little to do with format.
The good part is that most of it is bad for a very good reason, and these reasons are generally quantifiable and explainable. So, in a non-confrontational way, explain the reasons. In many cases, you can even give the writer scenarios where the problems become obvious.
I'm not the lead developer on my project and therefore can't impose coding standards but I have found that bad code usually causes an issue sooner rather than later, and when it does i'm there with a cleaner idea or solution.
By not interjecting at the time and taking a more natural approach i've gained more trust with the lead and he often turns to me for ideas and includes me on the architectural design and deployment strategy used for the project.
People writing bad code is just a symptom of ignorance (which is different from being dumb). Here's some tips for dealing with those people.
Peoples own experience leaves a stronger impression than something you will say.
Some people are not passionate about the code they produce and will not listen to anything you say
Paired Programming can help share ideas but switch who's driving or they'll just be checking email on their phone
Don't drown them with too much, I've found even Continuous Integration needed to be explained a few times to some older devs
Get them excited again and they will want to learn. It could be something as simple as programming robots for a day
TRUST YOUR TEAM, coding standards and tools that check them at build time are often never read or annoying.
Remove Code Ownership, on some projects you will see code silos or ant hills where people say thats my code and you can't change it, this is very bad and you can use paired programming to remove this.
Instead of having them write code, have them maintain their code.
Until they have to maintain their steaming pile of spaghetti, they will never understand how bad they are at coding.
Nobody likes to listen someone saying their work sucks, but any sane person would welcome mentoring and ways of avoiding unnecessary work.
One school of teaching even says that you should not point out mistakes, but focus what is done right. For instance, instead of pointing out incomprehensible code as bad, you should point out where their code is particularly easy to read. In the first case you are priming others to think and act like crappy programmers. In the later case you are priming for thinking like a skilled professional.
I have a similar senario with the guys i work with.. They dont have the exposure to coding as much as i do but they are still usefull at coding.
Rather than me letting the do what they want and go back and edit the whole thing. I usually just sit them down and show them two ways of doing things. Thier way and My way, From this we discuss the pro's and cons of each method and therefore come to a better understanding and a better conclusion on how should we go about programming.
Here is the really suprizing part. Sometimes they will come up with questions that even i dont have answers to, and after research we all get a better concept of methodology and structure.
Discuss.
Show them Why
Don't even think you are always right.. Sometimes even they will teach you something new.
Thats what i would do if i was you :D
Probably a bit late after the effect, but that's where an agreed coding standard is a good thing.
I frankly believe that someone's code is better when it's easier to change, debug, navigate, understand, configure, test and publish (whew).
That said I think it is impossible to tell someone his/her code is bad without having a first go at having him / her explaining what it does or how is anyone supposed to enhance it afterwards (like, creating new funcionality or debugging it).
Only then their mind snaps and anyone will be able to see that:
Global variables value changes are almost always untrackable
Huge functions are hard to read and understand
Patterns make your code easier to enhance (as long as you obay to their rules)
( etc...)
Perhaps a session of pair programming should do the trick.
As for enforcing coding standards - it helps but they are too far away from really defining what is good code.
You probably want to focus on the impact of the bad code, rather than what might be dismissed as just your subjective opinion of whether it's good or bad style.
Privately inquire about some of the "bad" code segments with an eye toward the possibility that it is actually reasonable code, (no matter how predisposed you may be), or that there are perhaps extenuating circumstances. If you are still convinced that the code is just plain bad -- and that the source actually is this person -- just go away. One of several things may happen: 1) the person notices and takes some corrective action, 2) the person does nothing (is oblivious, or doesn't care as much as you do).
If #2 happens, or #1 does not result in sufficient improvement from your point of view, AND it is hurting the project, and/or impinging on you enough, then it may be time to start a campaign to establish/enforce standards within the team. That requires management buy-in, but is most effective when instigated from grass roots.
Good luck with that. I feel your pain brother.