I've posted this a couple times, but I'm not getting much input. Please help me out! I just need to know what little things you keep in mind so you can add or change something easily to keep up with the user's changing needs.
2006-09-06
05:37:23
·
7 answers
·
asked by
GirlsRGamers2
7
in
Computers & Internet
➔ Programming & Design
Great answers so far! I need a few examples, so programmers, answer away! Please?
2006-09-06
05:49:45 ·
update #1
I'm enjoying all the responses! Give me more!
2006-09-06
06:40:27 ·
update #2
basically 2 things:
1) keep your code organized & easy to read.
- use whitespace liberally.
- divide all tasks into appropriate functions.
- name your functions/variables easy-to-remember names.
(bad variable names: "blah", "foo", "x".
good: "character_name", "final_sum","channel_color")
(bad function names: "do_it()","func3()".
good: "get_moviestats()","compute_runtime()")
2) maybe most importantly - comment, comment, comment.
- other than the very basic of expressions/loops, comment everything. a few lines of comments should go before each separate function, at a variable declaration comment on what that variable is used for.
- as you initially write the code, *anticipate* where changes/additions are most likely, and place a comment/bookmark in those areas.
2006-09-06 05:47:02
·
answer #1
·
answered by Moxie1313 5
·
1⤊
0⤋
It's a bit difficult to summarize an answer into a neat little 75 word response.
However.
Try to generalize your configuration data. That means, don't hard code paths and values in your high level logic. Create a configuration class that can supply all the values you need.
Try to code with generalized input and output. Create a class to parse input into a container class. Make your code work operate on the container class, not the raw input. That way, you can change your input without having to change your core logic.
Organize code into logical units. You might have a producer/consumer model. Separate your producer code from your consumer code. You'd probably have 4 classes: Producer (abstract), MyFileProducer which extends Producer, Consumer (abstract), MyFileConsumer which extends Consumer. Later, if you change your data source, you can always implement a new child class, such as MyDatabaseProducer.
Learn the programming patterns. Producer/Consumer is one of them.
Use object oriented programming. Organizing classes by object type is a natural way to achieve flexibility, since you're modeling the real world more closely. Using inheritence makes specializing funcationality easy. Using polymorphism is useful for writing algorithms that can operate on multiple types of object. In C++, use generic templates so you write an algorithm once that will work on any object meeting minimum requirements (i.e. use STL).
2006-09-06 12:54:23
·
answer #2
·
answered by stubber_nubber 2
·
0⤊
0⤋
I developed a coding philosophy many years ago and I stick with it today. I do not try to impress anyone with my coding techniques.
I have developed thousands of programs and I keep the logic as straight forward as possible and as simple as possible. I figure that at some point someone, maybe me, will get a call in the middle of the night to fix something and I want the solution to be simple.
By using a modular technique, you leave your program easy to change or modify as business requirements change.
I am not afraid of "not using" all the new bells and whistles that become available. I am a firm believer in the KISS principle.
2006-09-06 12:44:04
·
answer #3
·
answered by j H 6
·
2⤊
0⤋
This is a very good question and I have enjoyed the answers thus far.
I am a web applications developer and I use the Model, view, controller (MVC) method to organize my files and code. I also use the fusebox development framework.
MVC
http://en.wikipedia.org/wiki/Model-view-controller
fusebox
http://en.wikipedia.org/wiki/Fusebox_%28programming%29
Using these methods I am able to keep the code separated into different types of functions and displays that are easily reusable.
I can easily change one "fuse" (or block of code) with out affecting other sections of the site.
2006-09-06 13:32:17
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋
Try not to create redundancy and use functions. This way, you would only have to change one function when changes are made.
Another thing is to keep values that you think will be changed as variables. This way, you don't have to hardcode everything. And when you need to make a change, you just have to change the value of the variable.
2006-09-06 12:50:55
·
answer #5
·
answered by tedhyu 5
·
1⤊
0⤋
Understand the problem and split it into simple short modules. Each module should be independent and must do only one activity. This way if you make the algorithm for solving the problem, it will be flexible since each module in it clearly does one thing only and it will be easier to read and understand and flexible to any modification.
2006-09-06 12:50:45
·
answer #6
·
answered by Sree 3
·
0⤊
0⤋
Only one important thing:
GOOGLE it..
Copy and Paste :)
This is the Real Truth. Realize it, feel it, find it and never Forget it.
2006-09-06 13:52:45
·
answer #7
·
answered by Manish Jain 2
·
0⤊
3⤋