答: Money is usually the biggest motivator, so you need to secure some if you want to expand your business. Have you and your business partners thought about taking a pay cut in order to afford a good developer? Unless you secure some investors or close more deals with new/existing customers, this is likely the only way you will be able to pay another person to work for you.</p>

Title: Hiring programmers for small companies?


问:
Hiring programmers for small companies?
I've been running a company for nearly 10 years, and all this time it's been just myself, another programmer (who's a great friend and cofounder), and a salesman (who's also a friend). Together, we've managed to do decent business and we've all managed to make a living, but we've been trying to expand for a long time now.

Unfortunately, there are a few problems:

The technology we use is not obsolete, but it's also not as popular
compared to other web development options like PHP

We work in a competitive market, competing against multi-million
dollar companies

We can't afford to pay new programmers or salesmen very well. We make
enough money for ourselves, but unless we got a significant number of
new customers we wouldn't be able to pay much.

Because of the fact we can't pay much, we use a slightly more rare
technology, and we compete against large companies, we find it
difficult to find new programmers or salesman.

We desperately need to expand, but when we try to get more customers, we can't support them with so few people (or their demands grow outside of our range of expertise) and when we try to hire new programmers and salesman, we usually don't get a high quality and they usually don't provide a major benefit for our company.

Does anyone have some suggestions or tips on how we could expand?

答:
You can try to get new grads who are desperate for a job willing to put up with less pay for the experience. But you will have to have a really good eye to pick out the undervalued person with high potential from the majority of them who are just plain bad.

The problem is even if you get the undervalued person who are really good, you shouldn't expect them to stick around since they will gain experience and move on.

It is more expensive in the long term to keep re-training new hires and facilitate knowledge transfer than to get proper financing and pay at least market rate, it is only at around market rate when team/culture/loyalty start to be the key. Money isn't the biggest motivator, but lack of money is the biggest Demotivator, great companies can retain top talent with so-so pay, but none of them became successful with crappy engineers and a sub-par pay.

You can also try to pay with stock, but unless your company seems to be have huge potential and will go on to be acquired/IPO, no one really want stock. If your company is this good then it isn't hard to get investor money.

ContentLicense: CC BY-SA 3.0

Title: Hiring programmers for small companies?


答:
If you can vet some good programmers and keep them available (not easy) then you might be able to hire them out directly as consultants working with your product.

This can be done directly, sending trained people to a customer's site or by hiring someone temporarily to solve a problem or implement a feature for a particular customer.

I guess I'm suggesting that you get your customers to pay for your new people/new features through service contracts.

Without service contracts it also seems to be difficult to keep a small company going without a significant re-investment in the company.

You may want to think of it this way:

If your goal is to earn the two of you a living, then you don't need to expand it and doing so will probably lead to it's collapse anyway.

If your goal is to create a new startup company that grows and prospers, chances are you guys shouldn't be drawing much in the way of salaries, all that money should be going back into the company (Either into obtaining new customers or into improving your product so that you can obtain more customers later).

The last successful startup I worked at the top people didn't draw salaries for the first two years and even then they only started because there was extra cash and they wanted to start recovering their investment.

Title: Hiring programmers for small companies?

Body:
I've been running a company for nearly 10 years, and all this time it's been just myself, another programmer (who's a great friend and cofounder), and a salesman (who's also a friend). Together, we've managed to do decent business and we've all managed to make a living, but we've been trying to expand for a long time now.

Unfortunately, there are a few problems:

The technology we use is not obsolete, but it's also not as popular
compared to other web development options like PHP

We work in a competitive market, competing against multi-million
dollar companies

We can't afford to pay new programmers or salesmen very well. We make
enough money for ourselves, but unless we got a significant number of
new customers we wouldn't be able to pay much.

Because of the fact we can't pay much, we use a slightly more rare
technology, and we compete against large companies, we find it
difficult to find new programmers or salesman.

We desperately need to expand, but when we try to get more customers, we can't support them with so few people (or their demands grow outside of our range of expertise) and when we try to hire new programmers and salesman, we usually don't get a high quality and they usually don't provide a major benefit for our company.

Does anyone have some suggestions or tips on how we could expand?


问:
How to handle errors back in an API environment
We're discussing the best way to handle errors in calls to a method.

We have a credit model where we allow users to deduct credits for certain actions.  We'd like to make a call to:

```<code>User.DeductCredits(10);
</code>```

Then the Deduct method will check things like

Does the user exist?

Is the user active?

Does the user have at least 10 credits?

If not, this result should fail.

We're currently writing this just as a class library, but trying to keep it open to convert to a web service in the future.  The options we've discussed so far are:

Throw an exception when an error occurs.

Create a new Result object that would have T has the type of data expected back, and wrapping that with a status code and message.

We didn't like option #1, because then code to call deduct credits would look something like:

```<code>try
{
   user.DeductCredits(10);
}
catch(InvalidUserException e)
{
}
catch(InactiveUserException e)
{
}
catch(CreditBalanceException e)
{
}
</code>```

Additionally, if we turn this in to a service, we can't force exceptions on the user.

The main reason we didn't like option #2 was that it seemed to be returning more data than what we need.  For example:

```<code>  var address = user.GetMailAddress();
</code>```

Now address has the status code and message, as well as a data property, or value property.  So to get the city, you'd have code like:

```<code>if(!address.HasError)
   state = address.Data.State;
</code>```

as opposed to:

```<code>state = address.State;
</code>```

So is there a best practice for this type of situation?  Is one option really any better than the other?

答:
I've been handling this by going ahead and throwing exceptions where warranted, and I've had my API (which happens to be used over JSON, not web services, but it shouldn't matter) always return an object that has an error property, the message number of the original call, and the return value.

The client I'm using to consume this makes the call through a layer that strips the real response out of the returned object, and throws an exception on the client if the error property has a value.   So once that client layer is written the experience of how exceptions work is pretty natural.  Maybe this would work for your prospective API users.


问:
Web Developer: Ask to play more of a Project Manager role
I am a Web Developer (working with PHP/WordPress/Symfony2) in a small company (still hiring but at the moment 5 staff), has ~8 months experience (currently a Computer Science student) and asked to fulfill more of a Project Manager role. I am not really even good at personal time management nor would I say my programming is that outstanding yet (still learning, frequently stuck on errors, sometimes server fault eg. setting up a development server and SVN). In reality, it appears compared to my peers, its actually good, but thinking about Google, Microsoft or even err ... Oracle maybe, my skills are probably quite lacking still

I thought either way, its a good learning opportunity. How do I start?

I think I need to have a proper way of collaboration or communicating each others progress and documentation. Theres SVN but being relatively new, it slows things down sometimes. How do I assign work such that people dont mess up other's code? I actually caused a colleague quite a headache when I edited some configuration, meant for personal development use.

I found myself waiting for another colleagues work (user management/login/registration) to be able to complete mine (ACL part for my "module", similar to blog posts). I actually wanted to "fake" a logged in user, but that didnt work out (entirely)

答:
you can start by reading a book Agile SDLC, it also might help to check MSF; this won't answer all questions above but at least it is a solid place to start from.

Agile
&
MSF


答:
I think you've reached the point where you need in infusion of capital in order to grow.  Your question should not be how you can get inexpensive developers, but how you can get the capital to pay good ones.  </p>

<p>This means you need to evaluate your business plan to determine whether the investment in developers will return more value than cost in a year or two.  If so, start looking for a loan or an external investor.  If not, there isn't really much point in growing.  </p>

Title: Hiring programmers for small companies?

Body:
I think you've reached the point where you need in infusion of capital in order to grow.  Your question should not be how you can get inexpensive developers, but how you can get the capital to pay good ones.

This means you need to evaluate your business plan to determine whether the investment in developers will return more value than cost in a year or two.  If so, start looking for a loan or an external investor.  If not, there isn't really much point in growing.


问:
Comparison of IDEs for C++ and C development on Linux: KDevelop, Eclipse, NetBeans, CodeBlocks and Anjuta
I'd like to note your experience of full scale IDEs on Linux.

I personally work mostly with vim, however other programmers would like
to see a real IDE. So I'd like to hear your personal opinion about different
IDEs and comparison between them, in following context:

C++ and maybe some C development (not Java, Python and other stuff)

Server side programming (no need for GUI development)

Working on Linux not "cross-platform" development.

Opinion needed regard:

How stable is it? If IDE crashes I don't need it.

Comfortable to use.

Powerful for debugging.

Integration with various build systems

Scalability over huge projects (projects of hundreds thousands of lines of code)

I used to work with KDevelop and it was very nice IDE and seems that KDevelop 4 is a huge progress. It seems also that many rather use Netbeans and Eclipse.

答:
Many GCC developers (and GCC has 5 to 9 millions lines of source code, depending how you count them) just use emacs  or vi with utilities like grep, ctags or etags, make, svn, gcc, etc.).

You don't need an IDE to develop a big software.

If your software is big enough (e.g. at least 0.3 million lines), you could even consider customizing GCC thru plugins or MELT extensions, for purposes of software metrics, software navigation, specific warnings, coding rules, etc.


问:
Why was I asked general, non-technical questions during an interview?
I got through the first phone interview at Amazon last week and they asked some basic technical questions during that interview.

Today, I had my second phone-interview and I prepared myself well expecting for another technical interview, but it was not technical at all.

After we introduced ourselves, he asked questions like:

Why do you like to do programming?

What do you Not like about programming?

What do you expect from a new job?

In the last project you worked on, how did you make sure the project was implemented to the client's requirements?

Was there was any project, that during the development, you felt like the design was bad, and if so, what did you do to fix the issue?

As an engineer how would you keep up with the new technologies?

Additionally, when I explained to him about a recent project I worked on, he asked me about why we decided to make a specific design decision and whether it was my decision.

I was wondering why he asked me these kind of questions; since English is not my native language, I assume that one of the reasons was to test my knowledge of the language.

And most of the answers I gave him were very short and since I felt like he's expecting more, I tried to come up with things to say and ended up just blabbering. Overall I think the interview went really bad because I couldn't clearly convey my points to him.

Why was I asked these types of questions, and what kind of answers do interviewers expect?

答:
Wow, the answers here are great!  I was all geared up to provide my own, but the mark was hit so completely, I only have one or two things to add!

First a basic premise on managing teams -  A developer's salary is not cheap.  And the learning curve to fitting a new person into a team is significant.  It's not just the cost of the person while they are learning how to blend into the team/company, but the team's time in getting the person up to speed.  A team should be helping each other, so when a new person joins, everyone should be prepared to chip in a bit to help the new guy and spending a little extra time making sure the first few communication attempts are clear.  That's going to mean a decline in overall productivity - a worthwhile trade, but not a cheap one.

So... the manager needs to know:

1 - will the new guy adjustment period be minimal - how a person raises issues, what a person does when they see a problem, and how a person interprets what he hears are all good indicators of how that person works in a team environment.  NOTE:  There is no perfection here, and sometimes a long adjustment period is totally worth it, depending on team chemistry.

2 - how long will the new guy stick around - so what if you love the new guy - if he leaves the company in a year, you have lost money on hiring him.  Even for a miracle worker, figure it takes around 3 months of barely-productive time from the new guy, and then another 3 of mostly-productive time.  Only after about 6 months is the new guy up and going.  By the end of a year, his productivity is starting to amortize that early period of non-productivity and team drain.  If the new guy submits his resignation around that time, you generally suffer a net loss.  The team feels burned, you didn't get the efficiency you hoped for, overall, from the new hire, and you invested a fair bit of capital fitting him in.  The first two questions above are what I call the "will he stay" questions - if the person wants a radically different corporate culture, then no amount of convincing will keep him around.  NOTE:  This can be almost impossible to diagnose with new college grads.  9 times out of 10 they don't have enough experience to really tell you what they will want - they aren't psychic, after all!


答:
There is several things to try:

You have to be very lucky -- this means interviewing large number of people -- it's hard work to find suitable people.

You have to have good timing -- it's easier to find people when noone else wants to hire

You have to give competitive salary -- small business is always a risk for programmers -- it's just not clear when the business is gone and the programmer again looking for work -- that risk pretty much means more money. Reduce likelyhood of that risk and more people will come.

If salary is poor, give stock options or similar stuff where future company profits will go to the programmer. This is always more risky than steady salary, but suitable for startups.

Don't spend all the money -- many startups have been started by "rotating" money inside the company and controlling the flow of money from the company to the outside world. New people are just part of the cycle, they get salary, and will eventually buy the company stock. Assuming they still trust the company. This makes the company survive longer making it better choice for programmers.

Provide good working environment -- even if your main business is outdated legacy stuff, it can be saved by providing state of the art tools and development environments which makes working more fun.

Focus on quality. Every programmer just wants to conquer the world. Just make it happen. If it happens with cobol, that's ok as long as you really get the world and noone knows you're using cobol.

Find places where experienced people are available. Visit local university. (more experienced people are well, more difficult to find, they tend to be busy..)

Title: Hiring programmers for small companies?


答:
QT and CodeBlocks are ok. I use CodeBlocks lately.

It can be configured for makefile projects, code completion mostly works, and doesn't hang like one in MSVS, go to definition is blazingly fast. Function browsing is also well done.

There are some minor issues, but for day to day work on Linux it's very good, IMHO.

Title: Comparison of IDEs for C++ and C development on Linux: KDevelop, Eclipse, NetBeans, CodeBlocks and Anjuta

Body:
I'd like to note your experience of full scale IDEs on Linux.

I personally work mostly with vim, however other programmers would like
to see a real IDE. So I'd like to hear your personal opinion about different
IDEs and comparison between them, in following context:

C++ and maybe some C development (not Java, Python and other stuff)

Server side programming (no need for GUI development)

Working on Linux not "cross-platform" development.

Opinion needed regard:

How stable is it? If IDE crashes I don't need it.

Comfortable to use.

Powerful for debugging.

Integration with various build systems

Scalability over huge projects (projects of hundreds thousands of lines of code)

I used to work with KDevelop and it was very nice IDE and seems that KDevelop 4 is a huge progress. It seems also that many rather use Netbeans and Eclipse.


答: I think with questions such as these, the interviewer is simply trying to get you to think outside the box (not just techie) in terms of problem solving and communication skills. Also, it is important to know that employers are not only interested in the technical skills that you've picked up from college or uni, they are also interested in your interpersonal skills and approach to different real world scenarios. In summary, I would say that before anyone applies for a job in any company or firm, do some background reading about the company and also find out what are the most likely skills they would be expecting you to show in the interview process not just skills for your job role.</p>

Title: Why was I asked general, non-technical questions during an interview?

Body:
I got through the first phone interview at Amazon last week and they asked some basic technical questions during that interview.

Today, I had my second phone-interview and I prepared myself well expecting for another technical interview, but it was not technical at all.

After we introduced ourselves, he asked questions like:

Why do you like to do programming?

What do you Not like about programming?

What do you expect from a new job?

In the last project you worked on, how did you make sure the project was implemented to the client's requirements?

Was there was any project, that during the development, you felt like the design was bad, and if so, what did you do to fix the issue?

As an engineer how would you keep up with the new technologies?

Additionally, when I explained to him about a recent project I worked on, he asked me about why we decided to make a specific design decision and whether it was my decision.

I was wondering why he asked me these kind of questions; since English is not my native language, I assume that one of the reasons was to test my knowledge of the language.

And most of the answers I gave him were very short and since I felt like he's expecting more, I tried to come up with things to say and ended up just blabbering. Overall I think the interview went really bad because I couldn't clearly convey my points to him.

Why was I asked these types of questions, and what kind of answers do interviewers expect?


答:
I have to admit i had a little chuckle when i read your issue due to the fact i had nearly the same problem and now we are well on the way to providing the latest technologies to our customers and taking on the bigger competition.

First of all you need to identify what platform will provide the services your customers need so time to sit down with your developer and do the old classic white board style product analysis..

We then employed a junior developer and put both him and me (being the primary developer) on the courses to get us up to date with the technologies we needed to use.

We then employed on a part time basis a consultant who was fully up to date with the same technologies and was able to assist in the development process.

Then for your primary developer as the same as it was for me it's a matter of putting in the hours and continually evaluating the progress of the development project ensuring you use the consultant for the harder more complex aspects and provide achievable goals for the junior developer.

I hope this helps.

Title: Hiring programmers for small companies?


答:
You need to think outside the cubicle.  Take advantage of your flexibility.

If you want to hire a top talent programmer, but can't pay a full salary... hire a part-time, top talent programmer.  You'd be surprised how many people would jump at a 20 or 30 hr/week job, so long as the hourly rate you were paying them was in line with what they'd be expecting.  It'll save you a lot of money, and let someone devote more time to side projects, or just enjoy a personal life.  Someone with more experience will be far, far more productive more quickly as a part-time hire than a less expensive, less (or no) experience full time employee.

Title: Hiring programmers for small companies?


问:
Is there a canonical resource on R programming?
Considering I have no programming background, Is there a resource out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on R programming? What about that resource makes it special?</p>

答:
I don't know if there is a book for a non-programmer in R or S but you can certainly start with the native R project site:

http://cran.r-project.org/

Starting with the Manuals section:

http://cran.r-project.org/manuals.html


答:
Read this article The Rise of Developernomics. It might give you some perspective on the market.

I've had some success hiring interns for a project. You have to be good at finding good, passionate, learners for this to work and be willing to spend some time mentoring. The biggest problem I've had with a well trained intern is that they'll leave for higher pay after graduation unless you're willing to make the ongoing investment in keeping them around.

I've been hired myself as a contractor many times, both full-time and part-time, and I've hired contractors as well. How well this works varies by the person and job and how well they match but you won't have as long term investment in them. If they don't work out, it's easier to let them go and if things do go well, you'll know that it's worth the investment to bring them in perm. If you can't afford to keep them around, you can let them go easier or work out a part-time plan.

Title: Hiring programmers for small companies?


问:
Should I learn java for mobile application development or will C# just do?
I'm looking forward to delving into the .NET framework but most mobile applications seem to be developed in Java. I'll most probably be targeting the less pricier phones like Nokia and motorolla not android or iphone OS. Can I do these stuffs in C#?</p>

答:
I started writing Android apps in Java having prior experience in C#.  I found that many fundamental concepts of the language are similar, so it was simply a matter of learning the few differences, especially with the libraries.  If you can learn, coding in the other would be very simple (based on my experience).

I would recommend starting with Java.  Android is on track to becoming the most popular mobile OS, so you know it will definitely be around for a while.  Also, Java is older, so there are countless libraries and tutorials available for you to use and learn from.  Once you understand the core concepts of Java, learning C# should be a breeze - and you'll really appreciate some of the neat features (like attributes and LINQ) that C# has to offer.

Disclaimer: I started with C# (primarily for ASP.NET MVC web development) and then learned Java for writing Android apps.  I haven't done any mobile programming with C#, so I can't tell you what it's like.

OwnerDisplayName: Alexander Suraphel

ContentLicense: CC BY-SA 2.5


问:
Contracting out software development; deliver user stories or business requirements?
We are a small company that I am lead developer on, and we have been having on and off meetings with a potential stakeholder for a good opportunity.  This stakeholder is helping us directly in getting a proposal together to a group of other stakeholders for software that they have a strong need for.  Hopefully if we sell them on our proposal (consisting of very high level features and general deliverables) then they will sponsor the project and it will grow organically from there to users around the country who will see how useful it is.

Problem is that we as a development are terribly bogged down as it is with prior projects, maintenance of existing production systems, and badly needed features on the backlog.  As it stands, because this project could be highly lucrative and there are no serious competitors, management wants to act FAST and get the most basic functionality out as quickly as possible, no matter the cost.

This isn't realistic for us without growing our team but that takes too much time.  They are thinking about contracting the development work out, but want me to be a business analyst and also have architectural say in the project.  When they finish major feature development, they anticipate my team taking responsibility over maintenance so clearly architectural control is important as we want the deliverables to be maintainable.

I am okay with this role, but am unaccustomed to it.  In house we typically don't use formalized requirements documents, and instead gather requirements from user stories, use cases, workflows and customer agreements.  We are used to formulating user stories but I am afraid that doesn't make sense to deliver user stories to an outside contract company as they will likely have their own project managment who might want to do things their way.  I wouldn't want to impose our unfamiliar project managment process on them if they find it alien and it slows them down.

I am thinking that extremely detailed formalized business requirements are in order because we want to be sure that they have the necessary guidelines to create quality software, but I have no idea what kind of effort this will take from myself alone.  I am also unsure of when to start.  Nothing is official yet, but I have 90% of the information I feel I need from stakeholders.  I just don't want to end up with management informing me that the deal was signed, we have to deliver in 6 months and to get him all the requirements documents by the end of the week.

Feeling a little in over my head here, do I formulate user stories or business requirements?  Any other helpful suggestions?

答:
As a contractor, here's what I think:

First, get to know your contractor. Talk with him a bit, have him talk with your lead developers. They need to assess his skill level and level of intuition. You can't just assume all contractors can be handed requirements, stories, or whatever you have. You've got to figure out what they can do on their own and what they can't.

Don't give out too much work at once. The contractor is unfamiliar with your company and the work should be checked on a bi-weekly or weekly basis if at all possible to make sure it is going in the correct direction.

If this is a from-scratch project, then:

After the first meeting, ask the contractor to develop a very minimal prototype of what you expect. Give him business requirements and don't tie him down too much. You want to see how good the contractor can do on his own. That way when you give him further instructions, you will not be telling him things he already knows and wasting time. Tailor your instructions to the individual that must execute them.

If the project is an existing project that needs changes:

Explain the project from a business perspective. Send him the project, let him set things up. Give him a day or two with it, and set up a meeting. Ask, explain, communicate, get comfortable, build rapport.

Rapport is going to be far more important than any set of project requirements. At the end of the day, your rapport is what's going to get that contractor to fix the project on short notice, or go the extra mile to make sure it's awesome. A cold set of requirements will not give you that.

Once you've gone through the initial stages, hook your contractor up with a lead developer contact who will be his liaison to the company. If he has a question, he can fire it off to him. They should meet weekly. I find Citrix Go-To Meeting is the best solution for this, screen sharing is a must.

Now, that you have established communications, if you want to implement some agile or just hand out bullet lists of desired features, it doesn't really matter. No methodology or system will ever replace the fundamental things humans need and expect.

We are humans first, developers second.

Caution though, this doesn't mean don't send documentation. You'd better send the best darn documentation and project requirements that you can muster. This guy is brand new, and he has to swim now. Make sure to throw a life preserver.

If you do decide to go Agile, I recommend pivotal tracker.


答:
Hiring good sales people is much harder than hiring good programmers, so I would suggest building a good tech team out of some good, reliable people (I believe in a star team, not a team of stars). You and your colleagues have strengths in management and sales so get other people to take over the everyday work like code writing, tech support, sales support so you can do what you do best.

The other suggestions about hiring interns are good and I've used that strategy before. But an equally good strategy is hiring older applicants who are less likely to leave in 6 months for a cooler company with beanbags or fancy coffee makers. They need less supervision, spend less time on facebook, will probably know your older language, and will get on with their job. And right now there are plenty of good people looking for a job.

Title: Hiring programmers for small companies?


问:
Datetime vs Timestamp in MySQL and PHP in practice?
I am not sure how to specify my datatype as datetime or timestamp, I think I will need both of them but on the different events. My website sells products and services worldwide and also have an account system for user to login. Please clarify the following:

Current date and time customer buys products from my website: Datetime?

Delivery date and time based on their location and date/time purchased, calculated from our system: Datetime?

Last time they logged-in on their account: Timestamp?

What is the code in php to store purchasing date (current date) and then store in the database?

Please elaborate how to use each of them as after reading plenty of explanation on the internet, I still don't quite get it.

答:
MySQL timestamps:

Are stored in UTC

They are converted to UTC on storage and converted back to your time zone on retrieval. If you change time zone settings, the retrieved values also change.

Can be automatically initialised and updated

You can set their default value and / or auto update value to CURRENT_TIMESTAMP

Have a range of 1970-01-01 00:00:01 UTC to 2038-01-19 03:14:07 UTC

Whereas MySQL datetime:

What you store is what you get ™.

Have a range of 1000-01-01 00:00:00 to 9999-12-31 23:59:59

Values outside the range may work - but only values within the range are guaranteed to work.

You can store dates where day or month is zero.

This is the MySQL way of storing birthdays! You can't do that with a TIMESTAMP, with the only exception being the zero value of 0000-00-00.

You can store invalid dates, if you need them, in ALLOW_INVALID_DATES mode.

You can set default value to NOW() in some instances, but the preferable and more natural way of automatically initialised and updated dates is TIMESTAMP.

And of course there are also DATE and TIME, which work just like DATETIME, but of course DATE doesn't care for time and TIME doesn't care for date. All four data types work perfectly with the wide array of date and time functions, but when you are mixing data types you should be aware of conversion effects.

Now, to your question: You should use DATETIME everywhere. Not for technical reasons, but since you are still unclear on how MySQL works, DATETIME is the simpler choice. This will mean that you will have to calculate the current timestamp in PHP before storing, that's as easy as:

```<code>$mysqldate = date("Y-m-d H:i:s");
</code>```

PHP's date function works like:

```<code>string date ( string $format [, int $timestamp = time() ] )
</code>```

The "Y-m-d H:i:s" format is the one compatible with MySQL and by leaving the second parameter empty, date() calls time() to get the current UNIX timestamp.

Using a TIMESTAMP instead of a DATETIME has the added value of MySQL taking over the responsibility of deciding on the current timestamp, and you can skip the field when you are inserting / updating. But since you are already sending a query, and the code to get the current timestamp in PHP is minimal, you can safely go with DATETIME for everything.

As for the actual code to store the PHP timestamp into the database, you should look at PHP Data Objects, and if you are still unclear, ask on StackOverflow instead. But there are almost 1.5k related questions already, make sure you go through them before asking. Just a hint, prepared statements is how the cool kids do it.

Body:
MySQL timestamps:

Are stored in UTC

They are converted to UTC on storage and converted back to your time zone on retrieval. If you change time zone settings, the retrieved values also change.

Can be automatically initialised and updated

You can set their default value and / or auto update value to CURRENT_TIMESTAMP

Have a range of 1970-01-01 00:00:01 UTC to 2038-01-19 03:14:07 UTC

Whereas MySQL datetime:

What you store is what you get ™.

Have a range of 1000-01-01 00:00:00 to 9999-12-31 23:59:59

Values outside the range may work - but only values within the range are guaranteed to work.

You can store dates where day or month is zero.

This is the MySQL way of storing birthdays! You can't do that with a TIMESTAMP, with the only exception being the zero value of 0000-00-00.

You can store invalid dates, if you need them, in ALLOW_INVALID_DATES mode.

You can set default value to NOW() in some instances, but the preferable and more natural way of automatically initialised and updated dates is TIMESTAMP.

And of course there are also DATE and TIME, which work just like DATETIME, but of course DATE doesn't care for time and TIME doesn't care for date. All four data types work perfectly with the wide array of date and time functions, but when you are mixing data types you should be aware of conversion effects.

Now, to your question: You should use DATETIME everywhere. Not for technical reasons, but since you are still unclear on how MySQL works, DATETIME is the simpler choice. This will mean that you will have to calculate the current timestamp in PHP before storing, that's as easy as:

$mysqldate = date("Y-m-d H:i:s");

PHP's date function works like:

string date ( string $format [, int $timestamp = time() ] )

The "Y-m-d H:i:s" format is the one compatible with MySQL and by leaving the second parameter empty, date() calls time() to get the current UNIX timestamp.

Using a TIMESTAMP instead of a DATETIME has the added value of MySQL taking over the responsibility of deciding on the current timestamp, and you can skip the field when you are inserting / updating. But since you are already sending a query, and the code to get the current timestamp in PHP is minimal, you can safely go with DATETIME for everything.

As for the actual code to store the PHP timestamp into the database, you should look at PHP Data Objects, and if you are still unclear, ask on StackOverflow instead. But there are almost 1.5k related questions already, make sure you go through them before asking. Just a hint, prepared statements is how the cool kids do it.


问:
Do speakers get paid for tech talks?
I'm curious if speakers (bloggers, google employees like Matt Cutts) get paid for speaking at conferences. If they do, how much? If they don't, or they get paid so little that it's as though they don't, why do it? What are the attractions beyond money that lead a developer into public speaking?</p>

答:
It sounds like you're wondering if you can make any kind of decent money speaking at conferences.  The answer is "No, not just from that."

Typically the people who are able to make a living in writing/speaking/blogging are using the writing/speaking/blogging to attract attention and give credence to what they are making money at, such as consulting or teaching.

OwnerDisplayName: FluffyCoder

Title: Do speakers get paid for tech talks?


问:
Software Development - Project, 1 Programmer - What if hit by bus?
The company I am currently working for has me developing a bunch of internal mission critical software. I have one other person that works for me but he's more of a testing guy and not really a developer. The company is concerned about some of these projects and what happens if I am hit by a bus. How does the company pick back up after something like that when there is only one person that knows the code base. One person that knows the current status of the project.

I explained that with my documentation and with the documentation with in the code that they would really only need to hire another programmer that understands the languages that were used and that they could be up to speed pretty quickly.

They suggested an outside firm that might be "kept up to date" on a monthly basis that could "take over" in the event something happened. I just don't see how this could be helpful beyond paying someone for the sake of paying them. Worse I envision a day a month being wasted discussing the project with this consulting firm. I see how this could be helpful I just don't see it as anymore helpful than hiring a programmer after my untimely demise.

Thoughts? Similar situation and how its currently being handled where you work?

答:
I like the quote that goes something like "The cemeteries are full of people previously considered indispensable". That said, your company has a duty to minimize risks, currently you are perceived as one. I have been there on occasion, its best to not only not resist, but to go the extra mile. Dont just train up an external company, recommend the best company in town ie the ones you would have most confidence in.
Also consider, if you are doing a job better than anyone else, you are irreplaceable by definition.</p>


问:
Strategy to use version control on a modular system
Let's suppose (for simplicity) that we have an application featuring client and server; is there a better idea to use one repository for both or a pair of separate repositories?

Mixing them will probably make easier to track correlated changes and maintain correlated branches (i.e. protocol evolution), but on the other hand will make the individual development more cluttered...

答: This is a configuration management problem, not a revision control problem. As always, a programmer using a screwdriver to hammer in a nail. Work out how you will manage you configurations, the the revision control will take care of itself. </p>


问:
Why disallow int-to-short assignment but allow multiplication and other math?
In Java, the following code does not compile:

```<code>int val = 1;
short shortVal = val;  // Incompatible types
</code>```

Anyone know why Java chooses to complain about this assignment, instead of simply truncating, when an integer × integer is also likely to overflow?

To illustrate:

```<code>int val = 46340;
int result = val * val;                    // 2147395600
System.out.println(result);
int overflowVal = 46341;
int result2 = overflowVal * overflowVal;   // -2147479015
System.out.println("Quietly overflowed: " + result2);
</code>```

答:
The int to short assignment is a type error in the "computer sciency" definition of the term.  The intent is to prevent programmers from accidentally doing something bad (like assigning something into a short that can't be represented in a short).  Multiplying an int and a short is also technically a type error in the "computer sciency" definition of the term, but there is less of a chance for mischief here since the type system gets to decide what type to make the result of an int x short operation.  Most people wouldn't like to cast their shorts to ints every time math is done with a short and and int, so compilers will do this for you.

In a nutshell: With assignment, the types are constrained, there's no room to budge.  With arithmetic, the type system gets to decide what the resulting type should be, and chooses a compatible type in this case (int) and inserts any required casts for you.


答:
Maybe you can get a freelancer.

Via such sites as freelancer.com & odesk.com , along with lots of others!

They're often very cheap, and even if you're paying them reasonably at least it is only with a few one off jobs.

But with time, after trying a few people out with various bite sized jobs, you'll find somebody you like and perhaps you can work out a full time arrangement.

Title: Hiring programmers for small companies?


答:
If you don't have enough money you can look at other things that are important to people.
Here is a nice list. Money is a big motivator, but till some point.</p>

Title: Hiring programmers for small companies?


问:
Is it a good practice by commenting with owner name?

Possible Duplicate:

  How do you keep track of the authors of code?

Here's several scenarios which may comment with owner name:

bug fixing, i.e. // fixed bug 123 by xxx, solution is ... ...

fixme/todo tags, i.e. // TODO: ....  by xxx.

hacks, i.e. // HACK! ... by xxx

For case #2, please refer to Comment Tags

The obvious advantage is that we can ease tracking by names. The downside is the risk of abuse. Actually my previous company allowed this way of commenting style, but current employer completely disallows names appearing in code.

In my opinion, I would vote for discreetly commenting with author names. I'm open to hear from you if this commenting style is good or bad. Thanks.

答:
First, you should never have comments like this in your code. Neither with author's name, nor without. A name helps, since it indicates who must be blamed to ignore the most elementary rules of commenting code.

For example your first example is a comment which talks about a bug being fixed. Why would a person reading the code bother about what you solved and when? There was a bug. It is solved now. So don't bother the readers about the fact that the code was buggy in the past.

A comment in a code must help to understand what this code is doing. Not what the code failed to do in the past.

Your second example is not a good one neither. There are bug tracking tools for that.

Second, there are plenty of reasons to avoid people names in comments.

Comments get quickly obsolete. Let's say I'm proud of a method I wrote, and I really want to put my name in a comment, so everyone will know I'm this smart author who got this genius idea. A month later, my colleague refactors the method. A month later, some other person modifies it. A month later I'm fired from the company because I didn't know how to use comments. I month later, another developer makes substantial changes to the code. Here we are, there is no line left from what I've written, and still the comment says that I'm the one who typed the actual code.

Comments don't follow the changes in a team. What if the code was written by Joe, Joe left a company ten years ago, and now there are two new Joe's in the company? Does it make sense to read in a comment that a piece of code was written by Joe?

Don't duplicate what is already provided by version control logs. Those logs are not here "just because they do". They allow, at any moment, to know precisely who did what and when.

Comments lie. And may contain mistakes, in general. What if I put my name on someone's else code, just by mistake? At least a version control log don't lie, and don't have mistakes.

Put names... to do what? Blame people for bugs? Be proud of your code? In both cases, there are more serious problems in the company and the relations between coworkers to consider before asking if names must be put in comments or not. As a part of a team, you contribute to a common codebase. If there is no shared code and everyone is working on a separate part of a code, then what's the point in having a team of developers?

Last but not least, like I said before, the sole purpose of a comment is to help to understand code. Knowing the name of a person who did something with the code hardly tells you what the code is actually doing.


问:
Need help with naming (marshaling interface calls)
This question was reopened on "English Language & Usage":
https://english.stackexchange.com/questions/53683/synonyms-for-multiplexing-and-demultiplexing/

This question is related to something written in C#, but it can be answered by programmers familiar with any language, as the question pertains not to the code itself, but to naming of what the code does.

I posted a question on StackOverflow titled Multiplexing interface method calls into a single delegate and demultiplexing asking if anyone knows of any mechanism that will marshal interface method calls into invocations of a universal delegate (or single method interface) of the form object AnyCall( int method_selector, object[] arguments ) and marshal back from such invocations into the original interface method calls.

Since nothing suitable came up, I went ahead and I created such a mechanism. (If it is not clear to you what this mechanism does, please read the original question.) Then, I wrote a paper about this mechanism, which is almost ready, and I am about to publish it on CodeProject, but before I do that I need some help with my naming choices.

Naming is quite important to me, and I consider dictionary.com and thesaurus.com as programming tools, but sometimes help from native speakers is indispensable, especially when an attempt is being made to introduce a new concept, or to take an existing technique which had no special name assigned to it thus far, and give it a special name, thus promoting it to a concept.

答:
fusion and fission?

fusion: the process of combining multiple elements into one. i.e. nuclear fusion.

fission: the process of breaking a single element into more basic parts. i.e. nuclear fission.

I like it because programmers are usually sci-fi nerds who already know what it means, it both connotes and denotes what you seem to be doing, and because there will be little doubt between cultures what you mean.

```<code>                name of action   name of performer   verb
marshaling:     fusion           fusor               fuse
unmarshaling:   fission          fissional/reactor?  fission
</code>```

Another option may be coupling and decoupling.

OwnerDisplayName: MikeNakis

Body:
fusion and fission?

fusion: the process of combining multiple elements into one. i.e. nuclear fusion.

fission: the process of breaking a single element into more basic parts. i.e. nuclear fission.

I like it because programmers are usually sci-fi nerds who already know what it means, it both connotes and denotes what you seem to be doing, and because there will be little doubt between cultures what you mean.

                name of action   name of performer   verb
marshaling:     fusion           fusor               fuse
unmarshaling:   fission          fissional/reactor?  fission

Another option may be coupling and decoupling.


问:
Determining whether two binary search trees have the same set of values
This is an interview question:

Given two Binary Search Trees, write a program to determine whether they contain the same set of values. Assume there are no duplicates.

My idea is to perform an in-order traversal for both trees and compare each element one by one. It takes O(n) time and O(n) space.

How could I do it in O(lg(n)) time and O(1) space?

答: Could you not just generate a md5 hash for each binary tree object and compare them. If the binary trees are the same the md5 hash should also be the same.</p>

OwnerDisplayName: Jamie Hutton


答: You can't have an algorithm with lower complexity than O(n) because you may need to look at all elements. Regarding space, you can lazily produce the list of elements, so you don't need O(n) space, only O(log n) (recursion depth), provided the trees are sufficiently balanced. It's doable in O(1) space if nodes contain parent pointers.</p>

Title: Determining whether two binary search trees have the same set of values

Body:
This is an interview question:

Given two Binary Search Trees, write a program to determine whether they contain the same set of values. Assume there are no duplicates.

My idea is to perform an in-order traversal for both trees and compare each element one by one. It takes O(n) time and O(n) space.

How could I do it in O(lg(n)) time and O(1) space?

OwnerDisplayName: Daniel Fischer


答:
I think the pattern that could trigger is a mini-discussion in the source code file.

```<code>// LRF- We should refactor this code
// John Q Public aka JQP- No, lets defer this until after version 4.
//                        Don't stir up any mud.
// LRF- Several branches of the if-then logic aren't covered by unit tests
// JQP- Not interesting, they are edge cases not expected in production
</code>```

Discussions in code comments evolve too slowly to be effective-- it could be years before another developer reads the comments you just wrote. In a beautiful world there would an IDE and source control integrated code review and discussion system with notifications to interested parties for each new comment.

In the meanwhile, where there are still shops that don't even have source control yet, from time to time you will see these mini discussions (or the start of them) in source code.

Title: Is it a good practice by commenting with owner name?

Body:
Possible Duplicate:

  How do you keep track of the authors of code?

Here's several scenarios which may comment with owner name:

bug fixing, i.e. // fixed bug 123 by xxx, solution is ... ...

fixme/todo tags, i.e. // TODO: ....  by xxx.

hacks, i.e. // HACK! ... by xxx

For case #2, please refer to Comment Tags

The obvious advantage is that we can ease tracking by names. The downside is the risk of abuse. Actually my previous company allowed this way of commenting style, but current employer completely disallows names appearing in code.

In my opinion, I would vote for discreetly commenting with author names. I'm open to hear from you if this commenting style is good or bad. Thanks.

Body:
I think the pattern that could trigger is a mini-discussion in the source code file.

// LRF- We should refactor this code
// John Q Public aka JQP- No, lets defer this until after version 4.
//                        Don't stir up any mud.
// LRF- Several branches of the if-then logic aren't covered by unit tests
// JQP- Not interesting, they are edge cases not expected in production

Discussions in code comments evolve too slowly to be effective-- it could be years before another developer reads the comments you just wrote. In a beautiful world there would an IDE and source control integrated code review and discussion system with notifications to interested parties for each new comment.

In the meanwhile, where there are still shops that don't even have source control yet, from time to time you will see these mini discussions (or the start of them) in source code.


答:
Like others here, I always ask questions like this when I'm interviewing.

The three things I try to glean from an interview are:

1- Passion (love solving problems and getting results)

2- Ability to understand and explain problems and solutions at different levels to different audiences

3- Personality (Ability to fit in with the rest of the team)

I also try and approach these topics in way to make the tone relaxed and conversational.  I want to know what the person will really be like after they've settled in on the team and at the company.


答:
Visual SlickEdit - commercial, like any good tool, "just works". Handles every language under the sun, out of the box, highly configurable and if if needed, fully programmable, puts a gui around GDB for debugging. Handles very large projects (I use it for a code base of 5million+ SOLC, of which I play with about 1million of them.) - Won numerous awards way back and has got better since then. Try it

Eclipse - Tool of choice when programming in Java, OK for any supported single language. Written in Java for Java developers developing Java programs. But needs plugins for every tiny little feature and major feature. Does not "just work" for more than one language at a time.


答:
The answer is "It Depends."

Every company and every team and every product is different, so you're probably not going to get the magic bullet of an answer here.

I recommend that you start simply and act as a facilitator rather than a full-scale project manager.  Let the more experienced devs determine the dependencies on the tasks and the appropriate resources to deliver on them.  Make it a collaborative, team process where your role becomes one of documentation, coordination and following up.

For example, let's say that the Big Boss comes to you and says "I want a new project that adds feature X to the product."  Your job, in such a small company, is going to be to first ask for clarifying information to better understand the scope of the project.  Secondly, you're going to ask Big Boss about the priority of this project against the rest of the team's workload.

Once those items are resolved, you're going to organize a meeting with the team and convey the details and relative priority of the project.  Ask the team "what are the major tasks that need to get done to deliver this?"  You're not looking for the nitty gritty details about column changes and method tweaks, rather, you want something like:

We need to update the Login page to use this new logic.

We need to write an ACL component.

We need to update the database to store new data.

We need to update the Business Layer to pull back the data so the front end can access it.

Have the team put them in order and then volunteer or cooperatively assign.  Your job is to capture it all, schedule the meetings and then followup periodically with status updates to make sure that no one is facing any impediments.  It's a small team and they are likely expected to move very quickly.  This basic amount of coordination, if done right, should help everyone continue working smoothly.

Also, as OmarQa said, read up on Agile.  You should also check out SCRUM.

Title: Web Developer: Ask to play more of a Project Manager role

Body:
I am a Web Developer (working with PHP/WordPress/Symfony2) in a small company (still hiring but at the moment 5 staff), has ~8 months experience (currently a Computer Science student) and asked to fulfill more of a Project Manager role. I am not really even good at personal time management nor would I say my programming is that outstanding yet (still learning, frequently stuck on errors, sometimes server fault eg. setting up a development server and SVN). In reality, it appears compared to my peers, its actually good, but thinking about Google, Microsoft or even err ... Oracle maybe, my skills are probably quite lacking still

I thought either way, its a good learning opportunity. How do I start?

I think I need to have a proper way of collaboration or communicating each others progress and documentation. Theres SVN but being relatively new, it slows things down sometimes. How do I assign work such that people dont mess up other's code? I actually caused a colleague quite a headache when I edited some configuration, meant for personal development use.

I found myself waiting for another colleagues work (user management/login/registration) to be able to complete mine (ACL part for my "module", similar to blog posts). I actually wanted to "fake" a logged in user, but that didnt work out (entirely)


问:
How can I bootstrap a software development community at my school?
I'm a student at the University of South Florida who's frustrated with the educational environment in the Computer Science program. Right now, I'm taking "Program Design." I should be learning how to organize my source code into functions and modules in order to make my programs readable and maintainable; instead, I'm learning about arrays and recursion in C. Next semester, I have to take "Object-Oriented Design," which is taught through C++ (shudder.)

Two years ago, I fell in love with programming, and I've been learning as much as I could since then. The prospect of taking another C++ class bores me almost to tears. For that reason, I thought I would start a programming club in order to meet similarly ambitious students, learn new languages, discuss software development topics, and work with other students developers.

However, I'm beginning to realize that there may not be any other students who share my software development experience. It's not because of a lack of motivation but a lack of opportunity: I know of only one other programming class ("Programming Languages") and no classes on real-world software development. Everybody else only has experience writing trivial scripts in C and C++.

I've realized that if I want to work with other student software developers, I'm going to have to train them myself. Now, I'm planning to make the club a software development bootcamp, teaching members how to develop software with modern tools and languages. Obviously, starting an unofficial software development course is a monumental task with many possible approaches. My question to you, dear reader, is

What's my plan of attack?

Should I

lecture the club myself, trying to balance club work with homework?

ask the CS faculty to teach on topics within their expertise which may be less than relevant to members?

try to find a sympathetic, experienced developer inside or outside the school who can share my workload?

show video lectures (from MIT OpenCourseWare, Google Tech Talks, etc)?

hold hands-on programming workshops?

assign homework?

do something else?

答:
What about programming competitions?  Even something like Perl Golf (or PHP Golf), where you have people (or teams) work to solve a problem using the least amount of code possible?  Its a great way to learn more about languages and competitions always make things interesting.

Of course you should offer more than just competitions, but they are pretty easy to set up and I've always enjoyed them.


问:
Hiring programmers for small companies?
I've been running a company for nearly 10 years, and all this time it's been just myself, another programmer (who's a great friend and cofounder), and a salesman (who's also a friend). Together, we've managed to do decent business and we've all managed to make a living, but we've been trying to expand for a long time now.

Unfortunately, there are a few problems:

The technology we use is not obsolete, but it's also not as popular
compared to other web development options like PHP

We work in a competitive market, competing against multi-million
dollar companies

We can't afford to pay new programmers or salesmen very well. We make
enough money for ourselves, but unless we got a significant number of
new customers we wouldn't be able to pay much.

Because of the fact we can't pay much, we use a slightly more rare
technology, and we compete against large companies, we find it
difficult to find new programmers or salesman.

We desperately need to expand, but when we try to get more customers, we can't support them with so few people (or their demands grow outside of our range of expertise) and when we try to hire new programmers and salesman, we usually don't get a high quality and they usually don't provide a major benefit for our company.

Does anyone have some suggestions or tips on how we could expand?

答: Hire programmers from developing countries like India.I'm sure you can find that kind of undervalued person with high potential here.  (I'm not saying this coz I'm from India! :P )

Title: Hiring programmers for small companies?


答:
At one previous employer, the commenting style consists of:

// 20DEC11. ABC. Bug 126230, Iterator is off by one when reading from networked drives.

Where ABC is the developer's initials. This company has been shipping "shrinkwrap" software for over 17 years, and has migrated through about 5 different version control programs. The version history for some files are in the hundreds of revisions, so forcing some sucker to try to sift through 300+ revisions is cruel punishment. The corporate parent would occasionally compel offshoring of some parts, so the date had to be set in the (old) Army way (with 2 digit years), so that one didn't get all sorts of strange numbers for December 20, 2011, like 12/20/2011 or 20/12/2011.

Alternatively, some look like:

// 20DEC11. VBS. ABC. Task 126230, Check annual IRS limits for Roth IRA detectability.

Where VBS stands for "verify before shipping" and represents magic numbers set by statute or regulations that must be checked annually. Nothing else may have those 3 letters in them, and you must never delete one of those comments.


问:
Do you sign each of your source files with your name?

Possible Duplicate:

  How do you keep track of the authors of code?

One of my colleagues is in the habit of putting his name and email address in the head of each source file he works on, as author metadata.  I am not; I prefer to rely on source control to tell me who I should be speaking to about a given set of functionality.

Should I also be signing files I work on for any other reasons?  Do you?  If so, why?

To be clear, this is in addition to whatever metadata for copyright and licensing information is included, and applies to both open sourced and proprietary code.

答: The only reason to ever put your name at the top of a file is when it is a homework assignment and your professor requires it to keep straight which student wrote the code he is looking at on a printout.</p>


答:
I'm sure I will get negative points here.

I place my name in files I have created. I also include the company name and address, a copyright statement, a description of the purpose of the file, the original NAME of the file (in the file), and a brief history of major revisions.

Why do I do this:

Company name, address and copyright statement makes it very easy to produce in court, should that ever be needed, and show date / time of creation, ownership, etc for the purpose of copyright. Without that information IN THE FILE you are relying on smoke and mirrors to convince a judge who knows nothing about software or VCS.

Putting the original author name in at the time of creation is about accountability. If your VCS gives the same info, thats nice but it is not in your face. If the thing is changed later and someone adds bugs, the VCS tells the story. If you are proud of your work, don't hide. [A number of commercial companies require this kind of thing for plain accountability reasons as well.]

I put the name of the file in the file because these things change. It is a pain to update this when the name changes, and I'm no longer sure of the value. However, it helps put the whole picture together when looking at source.

Every file has a summary in a para or 2 of its purpose. If a file of source has no purpose, don't create it. If it has a purpose, tell me what that is - DO NOT MAKE ME GUESS. About 95% of all the open source code I comes across does not have a purpose stated in the source files and this drives me nuts. I don't want to guess the purpose from the file name or content, for crying out aloud - tell me. Not putting in a purpose is simply LAZINESS. (And not updating the purpose is also laziness.)

Pre VCS I used to put a full history in the comments at the start. Post VCS I did this for a while too. It shows history in the file w/o having to go digging anywhere else. It is however a pain so do this, and low value. Use your VCS history for this. But in the headers if you make a major change (huge refactoring, re-purposing, etc) - then make a note for the benefit of others. (And like the original author, put in your name.) It is of course a judgement call as to what is major and what is not. But this is a courtesy to those who come after you.

I also have extensive comments in the file which set out what things do - comments for example on interfaces, APIs, headers, are essential for a user of your API or function or method to know what is going on, and especially any special notes or side effects.

Inside code, major blocks get a comment describing what that block does. This allows a reading of the code for intent, quickly, without having to dig into the gory detail of some variable declared 15 pages earlier. (Tell me what it does, and why. Don't tell me how. I can figure out the how from the code.)

Based on what I see from others leaving comments here, it would seem many of those would delete about 90% of the comments I write. Shame... adds to the entropy of the universe.

Title: Do you sign each of your source files with your name?

Body:
Possible Duplicate:

  How do you keep track of the authors of code?

One of my colleagues is in the habit of putting his name and email address in the head of each source file he works on, as author metadata.  I am not; I prefer to rely on source control to tell me who I should be speaking to about a given set of functionality.

Should I also be signing files I work on for any other reasons?  Do you?  If so, why?

To be clear, this is in addition to whatever metadata for copyright and licensing information is included, and applies to both open sourced and proprietary code.


答:
You are not charging enough to hire decent staff locally. If your business model does not permit this then you must question the work you produce. If you are not willing to change your pricing model then you must bear the harsh reality of hiring offshore resources.

I'm quite experienced with this and I can tell you that you must put in hard time to interview without exception. Its literally a 1/200 chance you will find someone worth hiring on eLance or oDesk so that tells you the number of interviews you must wade through. You also have to be an attractive employer as well so WHAT CAN YOU OFFER THEM LONG TERM? Here is what I've learned and what I do.

A good offshore programmer does these things.

Is very honest

Communicates on a regular predictable schedule

Is working on a regular and predictable schedule

Has a good grasp of your language and communicates well

Is friendly and courteous and a general joy to talk to

Is passionate and helpful and cares

Is available for the amount of hours you need and dedicated to you in that time

Completes things on time

Is an INDIVIDUAL freelance programmer, not some team or slick talking project manager. This does not work out hiring someone else to do your job of being the boss, EVER.

If any of these things are not the norm for the contractor, do not hire them long term. Best to drop them quickly. You CANNOT know about these things unless you put them through tests that involve real world problems, time commitments and about 1 month of trying them out. However, you can reduce your failure rate by doing a lot of upfront filtering before trying them out. Remember, there is a sea of people waiting to fulfill your needs.

You must also talk about yourself or your company. Post about your company showing its highlights and what it can do for the potential employee / contractor to attract the worthy.

List history of your company and successes

List your technology and its relevance in today's market (yes they read this)

List benefits, hourly rates, bonuses etc.

Focus on presenting stability and reliability and long term employment

Here is what you don't do.

Hire a company or team or organization to "handle" your work

Trust they will work out

Pay higher than market value expecting that to make someone work harder

Here is my process of interview to filter out candidates...

Create a job posting for the perfect qualities you desire and set the bar as high as you can because people will post that have none of these qualities so it helps weed them out a bit and better to ask the most up front.

Place a small blurb at the bottom of the posting to indicate they have actually read the interview such as "please write about your most impressive work at the beginning of your response that relates to this posting". This will tell you if they are a human, if they can follow directions, if they are passionate about what they do and if they have some skills that will help you.

Create initial small fixed priced PAID tasks that will be paid upon successful completion. You can either make real tasks or just test tasks but I found its more productive to do real ones if you can as it really shows ability.

Have a grace period of 2 weeks by the hour. Do not pick your favorite yet. You should have everyone going that has passed #3 because you don't know how they are until you know how they are.

Now be selective to the ones who communicate the best and who are the most reliable and you just plain like the most.

You should be OK after going through this exhausting process because your hard work will produce the desired result. If it seems to come too easy then you are doing it wrong. It requires due diligence, persistence and hard knocks. Keep trying till you get it and its very much worth it. Your company will start to grow as your free time opens up for getting more clients.

Title: Hiring programmers for small companies?


问:
Are there any reasons not to cache an entire site permanently?
I am writing an uber simple blogging platform.  The application reads a set of static files that are the articles in the blog, and serves them up.

The only time any content on the site will change is when a new article is added, or an existing article is changed.

I intend to load 100% of the content into the applications memory, and only update it if the static files are changed.  I.e. a permanent cache.  For a simple blog, the static files are never going to amount to more than a few MB, so application memory wont be a problem.

Are there any reasons not to do this?  And why do blogging (/other) platforms with content that only changes at set intervals not use this method?

答:
Off the top of my head, I could think of a few reasons not to keep an entire site in memory:

The site might be too large to fit entirely in memory.

Even if you could technically fit it in memory, it might not be economical to do so, if only a small set of pages is accessed regularly while the rest is never looked at.

Having a large number of objects in memory might also slow down garbage collection (if you are programing a garbage-collected language such as Java or C#) because there are all these extra objects to check.


答:
"Are there any reasons not to do this?"

Scalability. Sure, when you're using it now, the data is under a few MB. Will that always be the case? I don't think so. Especially if you expect other people to use this system.

You're re-inventing the wheel. If the content is stored in files, you should just let Apache (or whatever other web server you're using) serve them up, and deal with the caching. It'll probably do a better job than whatever you come up with.

It's not necessary. If the data set is small, then you should be able to get acceptable performance using MySQL, or static files served up by Apache, or any of the other ways that people normally do this. If the data set is large, then your caching scheme won't work (see #1).

Title: Are there any reasons not to cache an entire site permanently?

Body:
I am writing an uber simple blogging platform.  The application reads a set of static files that are the articles in the blog, and serves them up.

The only time any content on the site will change is when a new article is added, or an existing article is changed.

I intend to load 100% of the content into the applications memory, and only update it if the static files are changed.  I.e. a permanent cache.  For a simple blog, the static files are never going to amount to more than a few MB, so application memory wont be a problem.

Are there any reasons not to do this?  And why do blogging (/other) platforms with content that only changes at set intervals not use this method?


问:
The 10 minutes technical interview
I must do a quick assessment of dozens of fresh students very quickly. I have 30 minutes meeting with each of them (in two or three days). I want to use most of the time to discuss non technical aspects. So I plan to use 10 minutes for technical questions. The same questions for all of them.

They are all hired already (they are students), what I need to know is the average level in order to prepare a training.

Ideally, the difficulty must be progressive in order to set a level for each. Level I will average, and I'll do an average on each question too.

If you had only 10 minutes and 10 questions to ask to a candidate, what would be your top 10 ?

答:
Since they are already hired,for quick assessment i think one should (along with programming questions), one should ask them about

What is the system configuration you have worked on (PC hardware configuration).

Did you try testing your code(project if worked on during college) on different OS.

Do you prefer coding in windows or Linux (if they have worked on OS's other then windows)

coding is faster/slower/better depends on systems? (higher systems=feel good factor for coding as slow systems take ling to compile and all)

Also if ask if they know at least to format a drive or install the OS in case it crash/cannot boot insteasd of relying on the IT guy for help(this is to know if they can handle some OS situation properly)

These questions are just to find out their awareness about the system they use while programming,

Title: The 10 minutes technical interview


问:
Why was I asked general, non-technical questions during an interview?
I got through the first phone interview at Amazon last week and they asked some basic technical questions during that interview.

Today, I had my second phone-interview and I prepared myself well expecting for another technical interview, but it was not technical at all.

After we introduced ourselves, he asked questions like:

Why do you like to do programming?

What do you Not like about programming?

What do you expect from a new job?

In the last project you worked on, how did you make sure the project was implemented to the client's requirements?

Was there was any project, that during the development, you felt like the design was bad, and if so, what did you do to fix the issue?

As an engineer how would you keep up with the new technologies?

Additionally, when I explained to him about a recent project I worked on, he asked me about why we decided to make a specific design decision and whether it was my decision.

I was wondering why he asked me these kind of questions; since English is not my native language, I assume that one of the reasons was to test my knowledge of the language.

And most of the answers I gave him were very short and since I felt like he's expecting more, I tried to come up with things to say and ended up just blabbering. Overall I think the interview went really bad because I couldn't clearly convey my points to him.

Why was I asked these types of questions, and what kind of answers do interviewers expect?

答:
I am a fan of examples, so let's have some. Which person would you prefer to hire?

Why do you like to do programming?

I like programming because I enjoy problem solving and I like computers.

I program because it's my job.

What do you Not like about programming?

I dislike programming alone, I much prefer to work in a team.

I dislike writing comments, unit testing and having to use VCS.

What do you expect from a new job?

I expect to be challenged, to learn and to achieve success in my new job.

I expect a pay increase.

The other answers here have covered why these questions are often asked in an interview. Hopefully this can give you a more concrete idea of the spectrum of responses.


问:
Should I change author name in class file if I make more than 80% changes?
I am refactoring existing set of java test classes for automated UI tests.
At times I end up in making massive changes in class file or completely revamping it. This makes me think that when I am rewriting entire class then should I change author name in comment section to mine?

Am I being greedy? or is it going to be useful for one to see my name and ask me in case of doubts?

答:
I just came across another post where OP was asking if author's name should even be in the file header and seems that at least 2/3rd of people who responded said that the name shouldn't even be listed and that you should use version control to simply keep track of who changed the file.  Don't know what happened to that post, but now I can't find it. <-- (hence anonymous "OP")

Personally, I find author listed in the file header to be useful but for a slightly different reason (and this may not relate to others in their environments).  Even though we try to practice community ownership and often work on various parts of the project, we tend to have few team members who know certain areas of the code much more intimately than others.  So when someone (especially numerous contractors that come and go) open a file that they've never seen before, author becomes the go-to person.  He may not be the only contributor, or even majority contributor, but having his name at the top, he acknowledges to have certain responsibility in distributing knowledge/information about the code to the rest of the team.  We can list more than one person in the header is multiple people have indeed contributed and feel responsible.

I do find it frustrating when I have a question about a file and have to resort to version control to identify primary, or most knowledgeable person.  Then end up going from one guy to the next as they all deny really knowing what the code does... they just had to go in and fix a bug or two.

This practice works in our team because we don't have hand-offs.  Unless a person quits, or moves to a different team, that code/project will stay with the person and with our team.  Obviously if people who maintain the code are not the same as those that write it, then nobody would care who was listed in the header.

So in light of my view on file headers, I'd say if you changed 80% of the file and you feel like now you are the go-to guy for any questions (and you probably should feel that way), yes, go ahead and update the file header to have your name on it.  If you feel bad about removing previous person, you could leave their name there as well, at least for the time being.  You can always ask original author and I'm sure they won't mind one bit that you changed the name, since I'm assuming there's no hard feeling about you changing 80% of the file itself.

UPDATE: Found that post. Have no idea how I managed to pull something back from August. I just finished reading The Pragmatic Programmer and in the last chapter authors talk about signing work and accountability (the other post mentioned it, that's why I looked it up).  The book makes perfect sense and now that I think about it, maybe we should introduce team policy that whoever is listed as the author, should be included in all code reviews of the file in question. Doesn't matter who changed the file last or most in SVN, the author is the owner and is the keeper.


问:
Does the syntax of programming languages depend upon their implementation?
Although, my question may be entirely irrelevant, but I have sensed a pattern between most programming languages and their official implementations.

Interpreted (byte-interpreted?) languages like Python , Lua etc. usually have an extremely lenient and easy syntax and are generally type-less or do not require the developer to explicitly write variable types in source code;

Compiled languages like C , C++ , Pascal etc. usually have a strict syntax, generally have types and mostly require more code / development time

Languages whose official implementations are JIT-Compiled like Java / C# usually are a unique compromise between the above two with some of the best features of both.

Some of the more modern compiled programming languages like D and Vala (and the GNU GJC implementation of Java) are perhaps an exception to this rule and resemble the Syntax and features of JIT-Compiled languages like Java and C#.

My first question is, is this really relevant? Or is this just a coincidence that most interpreted languages have easy syntax , JIT-Compiled ones have a moderate syntax and features etc.

Secondly, if this is not a coincidence, then why is it so? Like, for example, can some features only be implemented in a programming language if you are, say, JIT-Compiling it?

答:
Mostly this is a coincidence.

Programming languages have evolved over time, and the technology of compilers and interpreters has improved. The efficiency of the underlying processing (ie the compilation time, the interpreting overhead, the execution time etc) is also less important as mainstream computing platforms have grown in power.

The language syntax does have an impact - for example, Pascal was very carefully designed so it could use a single pass compiler - ie one pass over the source and you have excutable machine code. Ada on the other hand paid  no attention to this, and Ada compilers are notoriously difficult to write - most require more than one pass. (One very good Ada compiler I used many years ago was an 8 pass compiler. As you might imagine, it was very slow.)

If you look at old languages like Fortran (compiled) and BASIC (interpreted or compiled) they have / had very strict syntax and semantic rules. [In the case of BASIC, thats not Bills old BASIC, you need to go back before that to the original.]

On the other hand, looking at other older things like APL (a bunch of fun) this had dynamic typing, of sorts. It was also generally interpreted but could be compiled too.

Lenient syntax is a difficult one - if that means you have things that are optional or can be inferred then it means the language has sufficient richness that it could be culled. Then again, BASIC had that many years ago when the "LET" statement became optional!

Many of the ideas you now see (for example, typeless or dynamic typing) are actually very old - first appearing in the 1970's or early 1980's. The way they are used, and the languages these ideas are used in has changed and grown. But fundamentally, much of whats new is actually old stuff dressed up in new clothes.

Here are some examples off the top of my head:

APL: dynamic typing. Generally interpreted. Came from the 1960's / 1970's.

BASIC: strong or dynamic typing. Interpreted or compiled. 1970's and many beyond.

Fortran: strong typing. Compiled. 1960's or earlier.

Algol68: strong typing. Compiled. 1960's.

PL/1: strong typing. Compiled. 1960's.

Pascal: strong typing. Compiled. 1970's.  (But in the 1980s there were P-System compilers very similar to JIT compilers!)

Some implementations of Fortran and others by DEC in the early days were partially compiled and partially interpreted.

Smalltalk: dynamic typing. Compiled to bytecode which is interpreted. 1980's.

Prolog: more strangeness. Functional. Compiled (Turbo Prolog, anybody?). 1980's.

C: strong (ha ha) typing. Compiled. 1960's..today.

Ada: uber-strong typing. Compiled. 1980's.

Perl: dynamic typing. (Strong syntax). Interpreted. 1990's (?).

I could go on.

Nitpickers corner: Many interpreted languages are tokenised or "byte compiled" at the time they the source is loaded / read-in. This makes the subsequent operation of the interpreter a lot simpler. Sometimes you can save the byte-compiled version of the code. Sometimes you can't. Its still interpreted.

Update: Because I was not clear enough.

Typing can vary widely.

Compile-time fixed static typing is common (eg, C, Ada, C++, Fortan, etc etc). This is where you declare a THING of a TYPE and it is that way forever.

It is also possible to have dynamic typing, where the thing picks up the type that is assigned to it. For example, PHP and some early BASIC, and APL, where you would assign an integer to a variable and from then on it was an integer type. If you later assigned a string to it, then it was a string type. And so on.

And then there is loose typing, for example PHP where you can do truly bizarre things like assign a numeric integer (quoted, so its a string) to a variable and then add a number to it. (eg '5' + 5 would result in 10). This is the land of the bizarre, but also at times the very very useful.

HOWEVER these are features designed into a language. The implementation just makes that happen.


答:
The creator of the source file should/must always (IMHO) be mentioned in the source file. This, with good header commenting, should show why the author developed the source and what his/her thinking was for writing the code.
As for the maintainer of the code, adding the name of the maintainer is crucial for source control tracking.

The naming of author, IMHO again, should include source version of the code, outside of the version control system, the first date of when the change occurred, as well as the change request number. The reason is, if the decision to change VCS arises, there's history of the version of the code, who the author was as well as the change request number that developers can refer to (if they need to know why the maintainer did what he/she did).
Thus, in our organisation, our format is as follows:

```<code>/**
 * $comment
 * <p />
 * $cr_number, $date, $author, $description
 **/
</code>```

Title: Should I change author name in class file if I make more than 80% changes?

Body:
I am refactoring existing set of java test classes for automated UI tests.
At times I end up in making massive changes in class file or completely revamping it. This makes me think that when I am rewriting entire class then should I change author name in comment section to mine?

Am I being greedy? or is it going to be useful for one to see my name and ask me in case of doubts?

Body:
The creator of the source file should/must always (IMHO) be mentioned in the source file. This, with good header commenting, should show why the author developed the source and what his/her thinking was for writing the code.
As for the maintainer of the code, adding the name of the maintainer is crucial for source control tracking.

The naming of author, IMHO again, should include source version of the code, outside of the version control system, the first date of when the change occurred, as well as the change request number. The reason is, if the decision to change VCS arises, there's history of the version of the code, who the author was as well as the change request number that developers can refer to (if they need to know why the maintainer did what he/she did).
Thus, in our organisation, our format is as follows:

/**
 * $comment
 * <p />
 * $cr_number, $date, $author, $description
 **/


答:
It really depends ...

If you think there is a slight chance that someone else might be interested later in asking the original author, let his name in the code.  If you think someone might be interested in asking you in person, let your name in it. And if you think, both might be possible, let both names in (or a comment like "based on the work of ...).

Of course, when the use of source control is mandatory in your workplace, and that is the only way of getting access to the sources, then save the hussle and strip every author comment out of the source. In my workplace, for example, we have lots of source files in source control where we don't bother to write any names into the sources. If I want to know who is responsible for the file, or was in the past, or for a specific change, TortoiseSVN will easily produce me a log for that.

On the other hand, we have a lot of VBA macros, written by some guys, passed around to other guys (some of them left the company over the years) and were modified a lot, all without using source control. Luckily, comments of those files contain often author names and some kind of history log.


问:
Advice/Approach for distilling homogenous code and building common code for a team
I work for the State of California. Our programming team in my opinion is not really a 'team' in that we usually work solo on projects throughout the application/systems complete life-cycle.

The end result is a lot of developers are 'reinventing the wheel'... writing their own data layers, even though the vast majority of us work on the same Oracle DB... writing their own security stuff... the list goes on.

I can't change the mentality of my employees, and don't have any realistic ambitions in regards to changing our team process... but my goal is to get our team to work together a little more, at least to build common building block pieces that we can all use for boilerplate functionality.

The obvious benefits are, testing and support are much more maintainable when all our users are familiar with a common piece, time to production is less when you aren't writing the same repository someone else already did, and we can focus on providing better solutions to the unique problems our apps must solve... etc.

I'm preaching to the choir, I'm sure.

The trick is, the State does not like change, neither do its employees. Managers often disregard new ideas simply because they like to avoid friction and would rather continue on as is.

There are similar questions out there, but what I am looking for is advice on how any of you may have faced a similar situation, and any direction toward getting a 'grass roots' kind of effort going to have an easier time approaching management.

EDIT:
Just to clarify a few things:

the scope I'm looking for is within the IT shop of my State Agency. I'm not trying to coordinate across several departments. Got get people off the training wheels before asking them to ride motorcycles.

Security is not much of a concern, most of our applications are internal and written in Windows Forms distributed on Citrix (ugh.) and nearly all use the same enterprise tables in Oracle... very few if any apps are "classified" so to speak. it shouldn't hinder collaboration.

I have gone so far as to setup a NuGet feed, with a couple of boilerplate pieces of code packaged, and written a few repos for Oracle, sent out some emails, but received little feedback. I've got about 1/3 of our team using ReSharper, and send emails from time to time with tips... again, not a whole lot of feedback.

答:
I'll start by saying that I'm a huge supporter and crusader for reusable code and defining cool, nifty and powerful building blocks that multiple developers have to use. However, I would also point out that rolling your own reusable code/libraries/frameworks sometimes can be a very sharp double-edged sword. And something that you'd think should save time, sometimes might do just the opposite.

This has been the pattern I observed in the past: As a developer keeps working on a product/features/releases, some of them (maybe 10-25%) will identify some reusable components or some classes that would be plain silly to keep writing over and over. The rest of the people, continue copy/pasting and reinventing the wheel. Let's forget those, you are not one of them.

So when you identify reusable code, you begin to create your own personal library of cool things that over time make your life easier and easier.  You might have utility classes to help you work with XMLs, threads, registry... you name it.  I've done this and showed it to anyone who would be willing to listen and some people gladly accepted the fact that they can parse out what they need from an XML document with 6 lines of code.  Other people are set in their ways and they love coding 100's of lines of straight MSXML.

My findings:

over time as your library improves, others will gradually start using it.

as others start using it, now you became the support person for any time they have a problem and they suspect its your code.  Sometimes they find a bug in your code because they use the API slightly differently than how you used it, sometimes the bug is in their code because they didn't understand how to use the API and sometimes the bug is unrelated but the burden is on you because they are convinced that before they added your library everything worked.

(this was actually from a different post/blog but can't find the link): if you wrote some "reusable code" and it took you 3 week to do it.  You need generally need to spend another 3 weeks cleaning it up so other people can consume it and providing clear documentation and another 3 weeks on writing extensive unit tests and also covering general use scenarios, not just your use scenarios.  Other people found the same thing, frameworks/libraries take 3 times the amount of effort than original development alone.

Hopefully you won't have to face this. Some of my code became so reusable that people actually started using it in a more wide setting.  Then about 9 months ago, management decided to split our product into 2 different ones, each one having its own release cycle.  What do you think happened to that framework/utility library?  Both products depend on it but now you have to be careful how the library is modified if you are actively developing product A while product B is about to be launched.  Our solution was to make the framework itself product C that would have its own independent release cycle.  So here I am 9 months later and I'm still feeling the aftershocks from all the build/continuous integration/packaging issues that this has caused.

You might be extremely careful how you wrote your utility classes and you understand all implications of making this change and that.  But once other people start using your code, at some point they will want to modify it.  If there are 20 other components that depend on your library, when somebody modifies the library, they can potentially break 19 other components (I'm assuming they made the change to get their code working).  As code becomes more widely used, it becomes much more expensive to modify it.

Although I'm all for reusability, there are days when by lunch-time I start wishing to myself that my personal utility library remained my personal utility library.

So based on my experience, some advice that I can think off:

Look for external 3rd party libraries that do what you need and build your applications on top of those as much as possible. Every one of those libraries already has a team of people supporting it. Introduce them to a global place in your environment where anyone can get to them.

Instead of asking everyone to use your stuff, approach your teammates and other engineers one-on-one and see who has same mindset as you.  I'm sure you will find few others who share your values and you might start an unofficial core team that would work towards a common good.

Don't know if this one will work and/or is a good idea, but I want to try this in my own company: Instead of creating frameworks/libraries which are global and owned/used by multiple people/teams.  Treat all of your code as "internal open-source".  Setup a repository similar to github where different people/teams can submit library/utility/helper code. Make repository visible to everyone so that if you write something good, anyone would be free to take your code and use it.  If they decide to make a change in your code, just like open-source, then can create their own branch, which they will maintain, or give you back the change to roll back into the main trunk.  If you don't trust their work or don't agree with the change, since the project is still yours, you have the final say if you want to accept it.  If some team starts a project and then abandons it but a different team finds it useful, they can branch into their own team repository and continue the work.  I've been looking into using Redmine to do something like this, but haven't had a chance to set it up yet.


答:
I don't find the name of the author terribly useful. As this question shows, often there is no single author, so naming "the author" is not possible.

You could of course include a list of all people who made major contributions, but you can already get that from the revision control log - so what's the point?

On my project, there is no author info in most files. If you have a question, you just look into the logs, and usually it's obvious that one or two people did most of the work, so you ask them.

Edit

The answer assumes a project using version control. If you do not (consistenly) use VC, then putting an author (list), and maybe some change history into a file might be a viable workaround. Still, you should probably start using VC as quickly as possible, in which case see above :-).


答: If the file's been modified significantly, it should be acceptable to add your name in the file as someone who knows something about it.</p>