![]() |
Re: Recursion?
Now wait... programs with hundreds of thousands of lines of code... thats quite different. You HAVE to have some organization otherwise that would be completely unmanageable. I'm deinfitely not talking about something like that... if the linux kernel had no structure to it then linux users would be in trouble...
However, for your own project that needs to get done, as long as it works that IS what matters. After it works, then you make it look pretty. As for software engineering... obviously when you make code for your employer, your job depends on it being consistant with the companies coding standards and has to work with other peoples projects... but for small personal projects it isn't as necessary (unless you're perfectionist). Theres a reason why programming traditionally has been called "hacking"... And I still say programming is about laziness. Writing the least amount of code to get a task completed... |
Re: Recursion?
Quote:
Please don't come on the boards and proclaim truth when it's merely your opinion, and worse yet, when it's absolutely wrong. Try turning in a bunch of 'working' crap for your next programming assignment and see what your professor and TA say. Then try your argument that the only thing that matters is if it works and see how far it gets you. Better yet, try it in a job interview and see if they call you back. You'll quickly discover how wrong you are. Final note back on topic: I'm not anti-goto or anti-recursion, I think you should use whatever tool makes the most sense for the job. That being said I've never used goto since basic on my IBM PC Jr and never used recursion since my freshman year in college when we used scheme. Mike |
Re: Recursion?
a) read above :)
b) Actually, the way I do my assignments, and the way I program for the (admittedly small) projects at my work is first make the program work, then format it according to the assignment/project guidelines. And if you're giving the code to someone else, then it won't do them any good if they can't understand it. But I repeat myself. Stupid 56k... [edit] Also, if a program is too slow or eats up too much memory, doesn't that fall under "not working properly?"... [/edit] |
Re: Recursion?
Quote:
|
Re: Recursion?
Quote:
Quote:
Quote:
Quote:
|
Re: Recursion?
Ok.. this has definitely gotten way off topic.. I think I'll just start a thread about it...
|
Re: Recursion?
Wow. Some of these comments truly baffle me. Computer Science/Software Engineering is NOT about laziness, it is NOT about writing as little code as possible, and it is definately NOT about being sloppy and fixing it later.
In the course of writing RoboEmu, RoboGUI, etc, I took a lot of shortcuts in order to crank out code at a seemingly blinding pace. That worked just fine while RoboEmu was about 5,000 lines and didn't support loops, multiple program slots, pbasic 2.5, project files, or any of those extra features that made RoboEmu so popular. As it turned out, somewhere around version 1.05, I had to go back and more-or-less gut the entire UI because I had done it in the least amount of code possible. Then, when I started the Linux port, I had to go through the same thing all over again because I didn't properly separate my UI code from my core code; I had originally started with them separate, but in order to crank out code, I took shortcuts, broke my encapsulation, and caused more headaches than I care to remember. Similarly, I recently tried to go back and fix up RoboGUI, but I couldn't even read my own code. At this point, RoboGUI is all but dead because of my laziness earlier. Fortunately, I've learned from these mistakes, and RE2 is being fully planned out on paper as we speak. I haven't written a single line of code for it yet, but I already have a better grasp on the "big picture" of it than I ever did on RoboEmu, despite hours and hours of coding it. Go ahead and think that laziness is the way to go. Go ahead and think you'll just fix it up later. Go ahead and think that less code is better. Someday it will come back to bite you. |
Re: Recursion?
My opinion on this whole subject is that there is a place and time for using gotos and recursion. They probably aren't things you should use on a daily basis if you can avoid them, but they can be a tremendous help.
An example of the need for recursion is this. I was writing a Perl/Tk script and needed a way to be able to change the color scheme of all my widgets (GUI elements). The heirarchy of widgets in Perl/Tk is similar to that of Java, where widgets are packed into other widgets to get the desired layout. I needed to be sure that all subwidgets of the main widgets were affected by the color change. The problem was those subwidgets could have subwidgets, and those could have subwidgets, and so on. I decided to use a recursion technique to allow processing of an infinite tree of widgets and subwidgets. This allowed this function to be placed in a library as something that could be called whenever and wherever it was needed. This is an excerpt from that code. To do this iteravely would be nearly impossible. Code:
sub globalColorChange |
Re: Recursion?
Quote:
I am working on a small feature right now, and have over 30 pages of requirements for it. That then translates into 40-60 pages of design before into thousands of lines of code. Software engineering is more focused on the design of the system rather than the code itself. If a system is well designed, the code is simply an extension of the design. |
Re: Recursion?
Laziness? Well, seing as perl was, at least in passing, mentioned earlier, I can't let this escape me ... while programming in general might not be about laziness, laziness, impatience and hubris are at least somewhat what Perl is about (well, they call them the three virtues of a perl programmer).
That said, certainly "laziness" here isn't to imply that you are sloppy, or merely "hack" something together. Trust me: from all too agonizing of experience, I've learned again and again what I should have already known ... before you ever write a line of code, you should have not only thought it out extensively, but have written out with pencil and paper the data structure, the program flow, and any other pertinent things. Systems need to be organized, big or small -- and you need to allow for extensibility/code reuse. Writing code quickly is one thing ... being able to quickly fix an error at competition, however, is -- in my most humble opinion -- slightly more important! (and the two are typically in conflict). |
Re: Recursion?
Quote:
In Practical C++ Programming for O'Reilly, Steve Oualline wrote Quote:
~Aaron |
| All times are GMT -5. The time now is 20:00. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi