Would it be ethical for a computer science PhD student to hire an assistant (programmer)?
I don't think it is inherently unethical to do this. If all relevant parties know about it and you scrupulously acknowledge this other person's work, then I see no specific problem.
Whether it is advisable is a different question...and one you should certainly ask your advisor. I have to say that it does not sound like such a good idea to me. Your thesis work is for you to do...almost by definition. It is perfectly fine to get help from others on your thesis, and some people are better programmers than others (even in CS, I imagine), so getting some pointers from a friend is actually a good idea. But paying someone to do a part of your thesis work just doesn't sound good to me. Either the programming is an important part of your thesis or it isn't. If it is, you should do it yourself. If it isn't, maybe you don't need to do it at all, or don't need to do it to the degree that an outside professional would.
There is also the issue of the impression this subcontracting would make on others. Perhaps the cultural norms in your field are very different from mine (again: ask your advisor), but I would have a rather negative impression of a PhD student who did this: they don't seem to be very committed to their own work.
Added: To be clear, I am interpreting the question as meaning that the doctoral student himself is doing the hiring: i.e., that this is his idea and he is using his own funds. (If his university is giving him funding and simply asking him to pick someone to work with, then even asking the question "Is it ethical?" becomes less plausible.)
In terms of suspecting that this is not a good idea, I hope I was clear that this is my personal opinion, with experience from a field (mathematics) which is rather closely related to CS but is not necessarily identical. As I said, the OP should consult their advisor about this. However, for what it's worth I find it hard to believe that the reaction will be "Sure, spend your money." While not unethical on the OP's part, it seems, shall we say, suboptimal if both advisor and student feel that this is the best way to proceed.
Sure, but I doubt you can afford it.
Let's see what the options are:
You can hire an undergrad part-time to write some of your code, but chances are that you'll spend more time digging up their bugs and teaching them it would take to write the code yourself. Probably not worth it.1
Or you could get a real programmer, but a good professional programmer is going to cost much more than a Ph.D. student makes, and probably even more than they cost (In the US the university takes a huge cut for each grad student in a grant, roughly equal to the student's stipend). Probably not worth it unless you are independently rich.
Making matters worse, even a professional software engineer isn't able to read your mind. Their job is to take extremely large systems with many moving parts and make them managable. As a computer science Ph.D. you're probably focusing more heavily on one particular componnet, which you're going to have to understand well enough to write the code yourself.
In either case it doesn't sound like a very good deal for you.
1Note that this only apply if your end goal is simply to avoid coding yourself. On the other hand, advising and supervising are extremely valuable skills and as an academic your job isn't just to do your work but to support the field as a whole. By taking on undergraduates you're potentially doing more for the field than you could ever do by hiring a professional, and future employers will take note. Furthermore, if you treat them as researchers in their own right they might have some valuable insights, but your question was specific to hiring them just to write code.
I am going to outline why I think it is ethical and contrast this with the case described in the question Is it ethically questionable for me (an undergraduate) to hire “research assistants”?. Also, I am answering with a perspective from Germany.
tl;dr: Yes, it is ethical and it is routinely done.
The question linked above explicitly asks a similar question from the point of view of an undergrad. At that stage of education, as is also pointed out in RoboKaren's answer there, certain restrictions (might usually) apply (and in many cases, keep applying up to a Master's degree):
- It is expected that the student works on their own.
- The tasks are reasonably "low-level" in a way that it is realistic and expected that everything is done by one person.
- The tasks are likely to aim at demonstrating skills with a lesser emphasis on producing a real product. (That doesn't mean that, e.g., Bachelor theses cannot yield an impressive small software. But in general, what is created is a prototype rather than a marketable full-fledged product.)
Once entering doctoral candidacy, however, some changes occur:
- There is not necessarily a requirement that the doctoral candidate does everything on their own. (Please check the rules specific to your university to see whether this applies to you.) The doctoral candidate is supposed to choose the direction and make decisions on higher and lower levels, but that does not mean that they have to write every line of code themselves after the conceptual idea has been documented, or that they have to personally accompany all 50+ participants of a user study.
- Related to that, the tasks are sufficiently large that they can be distributed to several people. If the research is funded by a third party, it is often the case that more than one person is funded by that project, so quite some work is done in collaboration.
- While the software produced during doctoral candidacy is often still in a very ... say ... unfinished state, it is indeed expected that real research results are being produced. That means (related to the aforementioned user study example) that it is not sufficient that the doctoral candidate demonstrates once that they can conduct a user study by observing five participants, but actual user studies with several dozens of participants, and more than one such study, have to be done. There is no point in "torturing" any single person by having them ask the same questions 50 times, when the same can be achieved by distributing the workload to several persons.
Therefore, as long as the doctoral candidate is "in charge" of the conceptual development of the research and its results, it is completely acceptable to outsource some subtasks. One more point is that the doctoral candidate is supposed to acquire some first practical experience at hiring and leading a team of people.
With that said, I get back to my above statement that it is routinely done, in order to provide some exemplary real-world scenarios. I can think of both paid and unpaid variants of this:
- In some places, doctoral candidates can often employ one or more student research assistants (usually Bachelor/Master students), for example, for support in coding. Note that these students are not paid personally by the doctoral candidates, but that their funding is provided by the same sources as the funding of the doctoral candidates themselves. Hence, they are not only allowed, but explicitly meant to work on the same projects as the doctoral candidates. (Still, these student research assistants are "hired" by the doctoral candidate. The doctoral candidate will have the idea that some tasks could be delegated, they devise and publish the job offer, they check applicants in interviews and pick the most suitable one, and they decide about what those student research assistants get to do. The only time the student research assistants normally get in touch with anyone beside the doctoral candidate who hired them is for signing their contract, which happens at some HR department of the university.)
- Moreover, when doctoral candidates supervise a Bachelor's or a Master's thesis, they often define the topic and requirements in a way so the results from that thesis provide some input to their own doctoral thesis. Like this, it is also a form of outsourcing some of the work that eventually contributes to the doctoral research.
EDIT: Lastly, I would like to add a more concrete hypothetical example to illustrate what kinds of tasks might be performed by such a "supporting programmer":
Imagine a doctoral candidate who does research in the area of HCI to develop some new GUI elements. The creative research part of the work consists in learning about related work, developing a new concept for a GUI control, and drawing some sketches of it on a sheet of paper, as well as designing/choosing some test tasks to validate the hypotheses underlying the design.
Before this can be converted into a publication, much more work has to be done, though. An interactive prototype has to be programmed, based on the sketched design. It will have to be made to look somewhat fancy (3D/glossy look, animations, etc., whatever fanciness contemporary software GUIs usually feature), as otherwise, study participants tend to be extremely distracted by a directly visible lack of fanciness and unable to see through to the actual novelties of the GUI concept being tested, thus totally distorting results in the qualitative part of any study. Then, to ensure tasks cannot be criticized as unrealistic, some real, or at least real-looking, data has to be integrated into the prototype. That usually means adding code to load (and possibly import/convert) one or more existing datasets. If user behaviour is to be recorded and/or timed, the prototype needs to be prepared for that, as well, by writing certain interactions into a database etc.
The whole last paragraph does not contain a single "scientifically creative" piece of research, this is just straightforward work that has to be done, and it typically takes a few weeks to get right. Toward the end of the paragraph, we're even way out of the actual research domain of HCI and deep in low-level things such as I/O and database access. All of that latter paragraph is perfectly suitable for outsourcing, and a doctoral candidate will not automatically be expected to have done all of this by their own hands.
EDIT2: Another note, as various of the other answers refer to code quality: It is true that in the case of hiring students as described above, the quality of the produced code might be less than what would be provided by a professional programmer (typically not available in the settings I have described in this answer). However
- capable students learn quickly (in particular when they are given actual tasks, not practice tasks)
- even though the produced software is supposed to be somewhat stable, it will usually still be a "prototype" for a limited amount of uses and thus does not have the same expectations for maintainability or security as production-level code
- doctoral candidates are free to choose and reject suitable and unsuitable applicants to their student research assistant job, respectively (and it's totally fine to hire someone for only a month first to check out how they perform)
- as university staff, the doctoral candidate also has a partial responsibility to give less skilled students a chance to improve, and thus should expect that not every student supervised or hired is the greatest genius around; this comes back to gathering experience in leading a team, as that will often mean a combination of diverging skill levels during the later work life of the doctoral candidate, as well.