Vote Up 0 Vote Down

advantages of using functions in programming

Do you find that using Functions help you manage complexity of Python programs you write? And I am also interested in knowing if you have never written a python function, and why? I already have my answer, I am curious about your thoughts. Thank you.
flag

Answers


Vote Up 0 Vote Down
It's impossible to write anything significant without functions. Well, maybe not impossible, but the code would be so confusing as to be a waste of time for anybody following behind. ..
flag | link |
Vote Up 0 Vote Down
Yeah, I don't see how that would even work either. I'm a noob, so maybe I'm missing some important Python Magic here, but for me without using functions (and helper functions to make small, repetitive tasks easier) the code would be a hopeless mess and I probably would not be able to do it without unnecessarily repeating some fragments of code over and over again.

And speaking of functions, I think that function definition recipe presented in LTP1 (Uni of Toronto course on Coursera) was one of the most useful things I've learned since I started learning programming. ..
flag | link |
Vote Up 0 Vote Down
Writing function is actually a part of good programming and it also makes the program compact...if we use a loop and in certain condition we want to repeat some long steps its always better to just call a function and let it return the required value..it also helps in avoiding the repitition of fragments. ..
flag | link |
Vote Up 0 Vote Down
Functions encapsulate ideas and processes, and give them useful names. No single stretch of code should ever be more than a page. If it is, you're probably putting too much into the routine and need to break it down into more manageable steps. If you've done it right and used meaningful names, then the mainline of your program should read like a story about what your program does. ..
flag | link |
Vote Up 0 Vote Down
Functions not only help in reducing repetitive code. But if later you wanted to make some changes in your code. You will make changes in only one place. Unlike imperative programming in which you have to make changes in a alot of places. Which makes code buggy.
One another nice feature of functions is that: it takes arguments. Which means we can get different result, every time we call our function.
It also makes code much more readable and maintainable.
# We can get the flexability/power with the mix of imperative programming, functional and object-oriented.
flag | link |

Your Answer

Login before answering

Login with facebook