![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() ![]() |
Books to get my code more mainstream/generic?
I heard from SaturN, that Python Cookbook is pretty good. I want an online book I can buy, that will teach me how to program in the more mainstream style, because as you've noticed I kind of program in my own world.
(Or do you think it would be better to program as I already am?)
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 5
![]() |
I have no idea. Let's see some of your code? If it's better than the mainstream because you're an expert programmer and better than most of your peers, don't change! If it sucks, read a general programming book like "Code Complete" which I heard is excellent.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() |
I wouldn't say it sucks. It's just generally lazy, instead of learning necessary code for executing a certain command, I'll just create the code for that command/function. I guess that's good though because it's probably faster since the unecessary bits are drawn out, and I'm left with only the pieces I need.
My code can be found scattered around these forums, but my most modern code, and my most matured code (that is currently documented) can be found here: http://1v7.com/drsane/py/ I'm certainly though no professional...yet. I want to be. That's why I need a good book to help me learn things that may pick up my speed as a programmer, even though I'm already pretty fast. The lag is usually debugging... a lot of debugging (half the times I won't realise what I did incorrectly). Remember, I'm only just starting my second month of Python, so I'm still in the learning stage. P.S. I know age doesn't matter so that's why I decided to start young, and I hope I can be as productive as a professional programmer at the age of 14, which will lead me to a high position when I'm older, or hopefully even sooner then that.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 335
Rep Power: 4
![]() |
Don't reinvent the wheel! Although occasionally you may find that your minimal implementation of something is quicker, smaller or otherwise more elegant than the existing implementation, usually that's not the story. For example, if you're programming in an interpreted language and it's a mathematical function, the 'real thing' might well be faster than even a well written, stripped down version.
Anyway, saving the machine's time is not always the number 1 priority; sometimes it's much more important to save human time. Code that calls the 'usual way of doing things' - even if it runs a bit slower - will be easier for other programmers to read and maintain, which is often a real concern if you're working with other programmers on a major project, or if you're tired of a project and someone else wants to take it over without rewriting old, working code they just don't understand! Quite a lot of good programming style is quite logical; choose good (brief but descriptive) variable and subroutine names, and add comments to your code whenever what it's doing isn't obvious (and maybe even when it is). In a compiled language, comments don't impact on performance - they don't even slow compilation down very much - so unless you're really just stating the obvious, put the comment in. Do a google search for "programming style" - maybe throw in a specific language name if you're after a style guide for a particular language - and you should find lots of useful information. Of course, styles vary from place to place, so it's always good to be ready to adapt, but there's generally a lot of overlap between the styles used in different places anyway. Hope this helps! P.S.: Good on you for starting early. Keep at it, and the best of luck. Last edited by mackenga; Jul 6th, 2005 at 2:10 AM. Reason: Added a PS |
|
|
|
|
|
#5 | ||
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Quote:
Quote:
Here's an example: I have an IRC bot.. When the bot sees commands in the channel (any word that begins with a % character, and possibly followed by arguments, e.g '%google some search'), it will see if there is a matching function in the class and run it if so, passing the arguments. If it sees '%google some search' it will look for a function called 'self.doGoogle' and call it if it is found. Now I want to document what each command does, so other people can use the bot. I already have the functions documented, so all I need to do is access the function, and then get it's docstring! In C++ you'd have to use doxygen or some other source file parser.. with Python it's easy peasy pie. |
||
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
Thanks that does help. Ya I didn't even bother learning the commands like 'in' or many module customs either, so I think that's what effects my style too. I end up with crazy unecessary lists, when I could have done it with a command I don't know. But still yet, there hasn't been one thing I couldn't do.
![]()
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges! Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download. |
|
|
|
|
|
#7 |
|
Programmer
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4
![]() |
Sane, What about you crazy little function you got me making for you??
lol, I like your style, it shows that you understand what you are doing!!! I have nothing more to say.. lolI've started programming late, and as a side-effect i have less time to learn, (work, family, etc).. It's good to start young, my two year old sisters making me a google search prog tommorrow just kidding, but one day soon lol
__________________
while me is alive: make(life,simple) |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Jul 2005
Posts: 1
Rep Power: 0
![]() |
I want just to thank you all for this good discussion
Mackenga you have some good way of programming that's verry good I will follow your steps |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|