I have a friend who is starting graduate studies in a psychology. Part of what he is learning is building testing apps for trials. He purchased a book that was supposed to be vb for psychologists after reading though it I found that it was not a very good programming book and espoused what I think of as bad practices. I instructed him to buy a standard learning vb.net book from a known publisher.

So the question is there any good reason why standard methodologies of programming shouldn't be applied to certain disciplines.

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.
If this question can be reworded to fit the rules in the help center, please edit the question.

2

Your friend was a fool to purchase a such a book. The only benefit the book has is the examples are based on psychology instead of say typical engineering models.
–
RamhoundMay 2 '11 at 14:40

1

Good question! I'm curious about specific examples the book taught that would be considered a bad practice...
–
FrustratedWithFormsDesignerMay 2 '11 at 14:40

1

Odd spacing no coverage of OO principles that a saw. Data collection with out touching on databases, sql or xml. Many other things.
–
rerunMay 2 '11 at 15:05

3

@rerun: I guess it comes down to getting the reader of the book up and running ASAP, rather than spend lots of time learning the "correct" way to do it. And really, if psychologist needs some serious programming work done, they might consider hiring a programmer! Many senior students would love to make a few extra $$ by building a simple yet useful tool in Access or something, and it may well be better than what the psychologist could build...
–
FrustratedWithFormsDesignerMay 2 '11 at 15:11

3

I'd say the idea is fine -- but in this case, the execution not so fine. Realistically, the small number of experts in both domains will probably keep such books from being executed well in most cases.
–
Jerry CoffinMay 2 '11 at 15:45

8 Answers
8

Non-programmers don't need heavyweight methods, but they should at least follow the basics. Break down the code into cleanly-separated pieces, understand what all the pieces do, and understand how they combine. Save copies of the versions that work so you can go back to them later. Comment the code so that you understand what you did later. Figure out why a bug happens instead of just randomly changing the code until it passes a trivial test.

I don't think most software people understand just how badly non-software people code. Research today mostly requires computer analysis. The quality of the results of the analysis is heavily dependent on the quality of the code that did the analysis, so bad code to do this work is worse than none at all.

The book was most likely written by a Psychologist who knew a little about programming rather then by a programmer who knew a little about Psychology.

Learning about the subject of your programs is one of the challenges of programming that is often overlooked. Too often programmers write very elegant solutions to the wrong problems.

Also keep in mind that the purpose of the book was to teach programming to a non programmer. The examples must be very simple and clear to understand. That certainly does not prevent you from using proper techniques and methods, but these often have to be introduced slowly once the basic principle of programming have been explained. Too often the author will want to show a "working" example as soon as possible without going through the extra steps to properly code the project.

I think that the comments and some of the answers have a biased point of view (coming from those whose full profession software engineering). My background is in Economics and I can say that those whose study is something other than software engineering don't necessarily have the time to learn all the odds and ends that go into professional Software Engineering. Somebody who wants to study Psychology wants to do just that, study psychology, not dedicate a month or two (given that they could pick up relatively quickly, although I would assume most people in the Social Sciences who need to pick up on programming have little to no programming background) to learning best practices of programming/software engineering.

Personally, I can see the worth of specialty books like the one that your friend has as it helps those need to learn programming to help them with their academic focus and it lets them know what they need to know and quickly. If they want to get into more indepth material, that's fine but they can do it on their own time. Not everybody enjoys programming as we all do and I think that is something that comes into play here.

They want to write programs to complete a task and not complete a task so they can learn to write programs.
–
JeffOMay 2 '11 at 15:40

3

@Jetti: If they don't have the time to learn something fully, perhaps they should leave it to those that do.
–
OrblingMay 2 '11 at 15:43

2

I guess the best thing would be to have such as book as the author described written by a psychologist AND a programmer. Honestly, I might be a little concerned if software written by a psychologist is used in a professional setting if it hasn't gone through some sort of review or QA testing, and worse still if the psychologist has no concept of QA testing... I'd hate for people to be misdiagnosed because the coder-psychologist made some very simple/basic errors with globals, off-by-ones, etc...
–
FrustratedWithFormsDesignerMay 2 '11 at 15:46

1

@Jetti: Your assumption is, unfortunately, wrong. Researchers would most likely send the code if asked, but they don't typically publish it as part of the paper, because it takes up space that isn't actually a research result.
–
jpreteMay 2 '11 at 15:59

3

Think of it the other way around: Would you read "psychology for programmers" if you had to develop a psych app? I imagine you'd get domain material, learn it, and/or grab a domain expert and get to work with them. Half-baked books are a recipe for poor results.
–
Steve EversMay 2 '11 at 17:06

If a practitioner in another domain can use a programming language and get their work done without utilizing all the best practices then why not? This does not mean the book should publish errors.

What are the problems we try to avoid with best practices and do they apply? Most of these people will only write programs that they are going to use for their own projects. I know, there are cases when they call one of us to clean up their mess, blah, blah, blah, be thankful you have a job. You can get away with a lot in small projects.

There is actually a good reason to not talk about good practices in those books.

The book is intended to be read by psychologists. Try to talk to a psychologist (or any other person who doesn't care at all about software development) about OOP, about how to indent code properly and about version control, this person will stop listening to you in a few minutes.

It's like in The Big Bang Theory, Series 3 Episode 5, when Howard asks Bernadette if she likes computers, and she answers: "I use them. I don't like them".

People who use computers want their work to be done, with some help from a computer, but they don't want spending their time learning how computers work, how real, professional software development is done, etc. They are not geeks. They are users.

That's why books oriented to specific non-geek audience are better when they tell little or nothing about best practices. It can feel strange for us, who have years of professional experience and who think that it is impossible to work for a company where there are no source control. But that's why those books are not for us, nor must they be read by us.

There are lots of publications about the low quality of source code written by scientists. The problem they found is that published code must be easily verifiable by other scientists in order to be able to verify what is said in the publication.

Finally, I think best practices must be enforced for people who are not geeks, but who write software daily. This is a case of most scientists. But this is only the case of some psychologists; most of them will never write programs, or, at least, not very often, and would never care about source control or other stuff like that. For those who will actually dedicate their career to the development of applications related to psychology, I hope they may be a bit more interested in professional software development, and will read general development books which promote best practices.

IMO, when you pass over to the realm of using a computer, to programming one, you cease to become a user.
–
Steve EversMay 2 '11 at 17:09

@SnOrfus: The difference is that some people do programming because they like it, while others are doing it because they are forced to do it by a specific need which can be accomplished only by programming.
–
MainMaMay 2 '11 at 19:36

So the question is there any good
reason why standard methodologies of
programming shouldn't be applied to
certain disciplines.

Books are one thing. Classes in college are another. In school, minds are open. Students have to do what they are told. After graduation, they don't.

I work with some very capable people in the areas of biostatistics, and as programmers they are very strong. They also have none of the instincts of a software developer.

I have had some luck (not much) educating some of them on the importance of

readability

maintainability

source code control

modularity

What they are doing is what they were taught.
Some of them were taught Fortran,
with built-in line length limits and short variable names, causing them to pack code together like raisins in a can.
I worked with a well-educated scientist who treated parentheses like they were gold-plated.
They view declaration of variables and static type checking as a major misinvention of young whipper-snappers,
and are surprised when bugs appear because after all "Why would I put bugs in the code?"

The point is, no matter who you are, your code does not just tell the computer what to do, it tells other people (and yourself) what you did.
It should allow them (and you) to know if what you did was correct.
(Argument-by-prestige is entirely too prevalent.)
When software gets over a couple hundred lines of code, it's going to suffer changes, and that's going to put in bugs, and you have to know how to manage that, no matter what your stated profession is.

Books may or may not be fine, but what we really need to do is teach teachers,
at a pragmatic level, the basics of software engineering.
After all, programming is a craft.
Non-plumbers can do plumbing, but they need to know the basics of the craft.

I've seen code written by physicists. There's a certain feel to it that you just don't get in code written by programmers. I don't have enough experience to know if that feel is physicist-specific or would come from intelligent people from other technical disciplines writing code.
–
David ThornleyMay 2 '11 at 17:25

@David: That's what I mean. It's along the lines of what I wrote in '62.
–
Mike DunlaveyMay 2 '11 at 17:31

you make good points, especially about the code telling others what it is doing. To use your analogy, speaking as a non-plumber myself, I don't go to the library and read stacks of books on best practices of plumbing to fix a leak in my sink. I either tinker around 'til it is fixed or I google a fix and that's where my learning stops. I think it is the same for non-programmers with programming
–
JettiMay 2 '11 at 18:40

@Jetti: Yeah. I know just enough plumbing to get myself in a lot of hot water. (Sorry!) ItsamazingthestuffIvehadtowadethroughthatlookedlikethisonagooddayandnaryacomment‌​.
–
Mike DunlaveyMay 2 '11 at 18:57

The big problem here is not that the book uses bad practices (it may be better to learn fast and dive in than to learn good software design principles). The big problem is that it's probably not a good introductory text.

It's difficult for a non-programmer, somebody who lacks the specific talent to be a good programmer, to learn to program. It would be a good idea to pick up an excellent teaching book. As it happens, teaching technical things to non-technical people is hard, and most people aren't all that good at it. Therefore, a specific introductory book like VB for Psychologists or Python for Physicians or Electronics for Dogs is likely to simply be a worse book to learn from than a more general one.