7

Is it kind of tacky or poor practice when programmers use an unusual amount of libraries/frameworks to accomplish certain tasks? I'm working with someone on a relatively simple programming project involving geolocation queries. The guy seems like an amateur to me. For the server software, this guy used Python, Django, and a bunch of other crazy libraries ("PostGIS + gdal, geoip, and a few other spatial libraries" he writes) to create it. He wrote the entire program in one method (in views.py, nonetheless facepalm), and it's almost unreadable.

Is this bad? Is this really tacky and amateurish? Am I the only minimalist out there these days?

4
  • 5
    Check the FAQ for the types of questions to ask and not ask here. "This is what I feel, am I the only one?" isn't a real question: there's no problem someone else can help you solve. Do you have a specific, practical problem you're trying to solve?
    – user8
    Commented Mar 9, 2011 at 6:03
  • 5
    @Mark Trapp - to be fair, replacing "Does anyone else think it's kind of tacky or" with "Is it" seems to yield a legitimate question. This seems like one in need of rewording.
    – Inaimathi
    Commented Mar 9, 2011 at 15:27
  • Using standard wheels is a good practice, though it can be taken to extremes. But usually it is good. For instance in this case, do you think that this amateur would have produced something nearly as good if he didn't use some of the other things to do the heavy lifting?
    – btilly
    Commented Mar 9, 2011 at 18:40
  • @Mark Trapp I'm asking about an approach to a problem, not a "does anyone else" question. Sorry if it was worded that way. I'll save "practical problems to solve" for SO (that's why I'm using Programmers instead). Commented Mar 9, 2011 at 21:41

10 Answers 10

11

Writing an entire program in one method is probably bad. That being said, utilizing tools that already exist can definitely help speed up development times. I hope I misinterpreted your wording as it seems to imply that Python or Django should be looked down upon as outside help. Both are extremely useful tools for developers. I think we can agree that for most cases, a developer who implements a linked list to use instead of using a provided standard is a bad idea. This can apply to more complex things as well, like TCP sockets, and maybe even GeoIP.

Agreed, sometimes when people incorporate external modules/libraries in a product things can get messy, especially when there are multiple modules and you start getting into dependency nightmares. These need to be managed appropriately, and yes, sometimes it is better to code things yourself. I wouldn't judge a developer on if they use "outside help", as much as how they use outside help and integrate it with the rest of the system.

5
  • 6
    I write all my programs inside of Main ;)
    – WuHoUnited
    Commented Mar 9, 2011 at 12:46
  • 1
    "Writing an entire program in one method is definitely bad." Depends on how big that method is! Haskell is all about getting programs down to one (very concise, recursive, curried, point-free, refactored) method. Commented Mar 9, 2011 at 16:11
  • @CodexArcanum very true. I'll admit to writing one method programs myself. Ah, the dangers of generalizations.
    – Jeff
    Commented Mar 9, 2011 at 17:55
  • 1
    Good answer. You are right, I didn't mean that using Python/Django should be looked down upon. What I meant is that sometimes when you have a simple web application, it is overkill and likely extra load on the server to run an entire web framework underneath it. It's also just tacky in my opinion. I think we're in agreement in that the amount of outside help in relation to the project size is what is at question here. Thanks again. Commented Mar 9, 2011 at 21:32
  • @Zanneth I agree, that does sound like overkill :)
    – Jeff
    Commented Mar 9, 2011 at 21:53
5

In general that is considered good if the programmer has exposure to a multitude of libraries . if you can do the task using an efficiently written algorithm already available in the library does it not save time and effort?. But it would depend on the situation if the libraries and dependencies are to obscure and do not fit the design requirements or if the task can be done with a simple routine. Time saving is definitely a factor.

2
  • 1
    Agrees, the important thing is does it do the needed job? And is it done in an efficient, scalable and secure manner?
    – crosenblum
    Commented Mar 9, 2011 at 15:35
  • I agree that time saving is important, but I think project scale needs to be taken into consideration. Is it really necessary to include a huge web framework into your project when most of what it is doing is something like HTTP requests? Commented Mar 9, 2011 at 21:39
5

I'd rather people used existing, tried and tested, tooling to create things than going out and write everything from scratch, with the inherent risks of doing so, the extra time needed to test things we can know are tested by our suppliers if we buy it, etc. etc.

2
  • Ya Honestly, I dont trust myself to redevelop a better library/framework. Not to mention the time it takes to do so...
    – user6791
    Commented Mar 9, 2011 at 15:28
  • 1
    Agreed. Even if the guy is a horrible programmer, I feel better that most of his code is not written by him. Thanks for your answer! Commented Mar 9, 2011 at 21:35
4

Using existing tools is good and recommended (actually, not using external tools is often a problem with junior programmers)

However, using to many such tools for a relatively small project may indicate that each tool is an overkill for what it is used for, and may lead to high integration overhead

4

Writing a program in one method: definitely bad (unless it's a trivial program, but I don't think that's what you mean).

Using lots of libraries: it depends.

There's a balance to be struck between re-inventing the wheel and doing zero work. If the attitude is "unless there's a library for [x], I'm not implementing it", that's certainly bad. Just keep in mind that the other extreme is (for example) "I know jQuery can do this in three lines, but I'm going to roll my own [y] functions".

Basically:

  • Use frameworks and other abstractions where they significantly reduce effort and errors
  • Don't use frameworks as a way to avoid learning about the thing they implement
  • Don't use the lack of a framework as an excuse to avoid tackling a task

Otherwise you're (IMO) doing it wrong.

3

I absolutely agree. While I definatley lean towards 'reinventing the wheel' too often, there is a point where you've got to be able to think for yourself.

Most projects need a handful, at most, of well written and fitting libraries. If your project turns out to be little more than a collection of widgets and other people's code, it usually isn't very good.

There are... a few exceptions, but I'd rather not accept that.

Being aware of libraries and frameworks is good, but relying on them almost entirely, not a good sign in my experience.

2
  • As the world gets more complicated, and the body of existing code continues to expand, most projects can make good use of more than a handful of libraries. Commented Mar 9, 2011 at 21:34
  • 1
    In my own words at least, handful is somewhat relative to project size. Sorta like hands relate to body I suppose o_O? Commented Mar 10, 2011 at 7:49
3

I highly endorse the use of libraries and frameworks. However, there is a limit where they are used because they exist, rather than because they are needed. Use of several geo-spatial libraries leads me to believe they are being overused.

Of more concern to me is the unreadable nature of the code. A few features I look for in good code:

  • Clear easy to read code. (A manager with minimal understanding of the language should be able to understand the code.)
  • Small modules which are have one clear purpose and limited dependencies. (high cohesion and low coupling).
  • Well formatted code which is easy to scan.
  • Comments explaining what is being done where necessary.
  • Limited duplication of code, no duplication of functionality.
  • Consistent use of the languages standard libraries.
  • Appropriate use of frameworks and libraries. (These should be project/organization standards.)

Unfortunately, there are a lot of developers who haven't leaned to value of the above factors. No matter how complex the problem, it should be broken down into simpler components that are assembled into a solution. Any components which remain complex should have a documented reason why it is done the way it is. (There should be a valid reason.)

EDIT: If the entire solution is less than 60 lines long, then it may be appropriate to do it in one method. The source file should have several methods all of which are of a reasonable size. If there are longer methods, it likely they need re-factoring. I am concerned with the number of geo-spatial libraries being used for a simple problem. (However, I have seen some simple problems for which the solution is very complex.)

0

One more thing to consider: is your colleague using the tool as a crutch to compensate for the fact that they don't understand the problem domain as well as they should? This could be a good opportunity to sit down with him/her to go over what tools they use, why, and get an idea of how they're looking to tackle the problem. Either they really don't know what they're doing and just throwing tools at the problem. Or if they do then that toolbox might be something you'd be interested in adding to your own set of tools.

0

What design guidelines were given to this programmer before he/she started?

If you didn't lay any down, you are just as guilty as the programmer of creating more junk.

0

How long was the single method? If it was ten lines, that's a whole lot better than what this guy must have been writing:

At my previous job, we were porting a UNIX system to Windows NT using Microsoft VC++. A colleague of mine, that was in the process of porting his portion of the code, came to me, looking really upset.

Colleague: "Hey! I hate these Microsoft guys! What a rotten compiler! It only accepts 16,384 local variables in a function!"

(See http://www.rinkworks.com/stupid/cs_programming.shtml)

Not the answer you're looking for? Browse other questions tagged or ask your own question.