Do you typically write your functions first, then code them, or write your major code first, then implement it into functions?
I always find it easier to write all my code first, then place them in functions...
Functions first!
Code first!
Do you typically write your functions first, then code them, or write your major code first, then implement it into functions?
I always find it easier to write all my code first, then place them in functions...
Last edited by funkydude9; 07-17-2003 at 11:53 PM.
Well, there are a few things wrong with your code:
1) It does not work.
2) It does not work.
3) It does not work.
Hope this helps.
Always top down. Map out the classes I need, map out the public interfaces for each class, then implement.
Working the other way (writing the interface as the code progresses) is a terrible habit to be in.
Moved to GD
>>> always find it easier to write all my code first, then place them in functions...
Wait until you start to write 500,000 line programs, I think maybe you'll have learnt by then!
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
Classes & Interfaces first, code later. In larger programs, there is no way to write code first. Not if you want to succeed.
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
If you are developing a large program, it will be easier to write classes first!
I never wrote a VERY large program, but whenever I have a large assignment I write classes first( or functions ) first.
Last edited by ammar; 07-20-2003 at 02:58 AM.
none...
I get a basic idea of the classes and functions I need and start coding them, and then if I find that I need something else, I add it. Ya know, sometimes there are things that you just don't think of in advance.
Away.
I take care of all classes and functions and such before i write any code. It helps to write algorithms.
> I always find it easier to write all my code first, then place them in functions...
Are you insane?
-Govtcheez
[email protected]
>> Wait until you start to write 500,000 line programs, I think maybe you'll have learnt by then!
You put it too delicately Adrian.
Anyone who would write "code first" for something that large should be dragged out into the street and shot (which is precisely what their compiler will do to them).
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
you'd be surprised how many dinosaurs of the industry actually code that way. Zero structure, zero thought behind the architecture. It's like pulling teeth to get them to put thought into OO design. It's even worse to try to convince managers that it's to their benefit to take time to restructure spaghetti code.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Hmm. It's hard (for me, at least) to write functions & classes if I don't know how I'm going to use them or write them. I make them as I go along, that way I have a better understanding of how I'm going to use them. Not sure why that would be a problem even when writing lot's of code.
>> Zero structure, zero thought behind the architecture.
Code like that should seriously be deleted and started over.
funkydude, the thing about OO design is that its extensible, and easy to maintain. No single piece (at least in theory) is too hard to digest, and has clearly defined dependencies. In a major piece of software, deisgn must be put in to determine exactly what abstractions are needed, how they will be used, and how they are expeced to behave. Granted, you'll run into unforseen requirements or conditions, but if you minimize those, your coding is a lot more efficient. Also, programmers brought in to maintain or extend the system can easily do so by only touching a small portion of code. They only need to know how things behave, not how they are implemented. Failure to design beforehand will lead to a much poorer overall structure.
And that concluded my OOD rant for now.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
I think that people who said that writting code first is easier were talking about small and simple programs, maybe because they haven't written large programs, or complicated ones, where it's impossible to write the whole program at once!
none...
I just write empty functions first, just to make sure that my framework is valid. Then I begin filling them with code in the order that they will be executed.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie