![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2007
Posts: 5
Rep Power: 0
![]() |
Need your comments on a PyGTK PlayStation CD backup tool
Hi all,
This is my first post and I hope I get something useful out of it. I am new to programming and currently learning python, working on a GUI app to backup PSX games using "cdrdao" as a backend. The program in its current state works just fine, but I can see lots of drawbacks: 1-The program is bloated and the code looks ugly. 2-No object-oriented programming was used. ( I know it's not necessary) 3-Many noobish habits and techniques were used to solve some problems. 4-The use of some shell commands instead of doing things in a pythonic way. I want you to help me polish it and teach me how to do it the right way (and help me toss those bad techniques away) I would also appreciate it if someone could tell me why I would want to do it in OOB, what's the benefits? what's object-oriented programming?(still struggling with this question) Here's the code: http://dpaste.com/hold/28221/ Note the use of the global variable avail, I am sure there is a better way, but can't come up with it. Thanks in advance, verb3k |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
OOP is only beneficial from a coding perspective. You can group together alike functions, and manage variables that become global to those specific functions. So for instance, that would solve your global avail problem.
But your code doesn't really look bad. Nothing in dire need of change stands out to me... at least. I'd only recommend OOP if you want to get away from those global references. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Dec 2007
Posts: 5
Rep Power: 0
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
That's a testimonial that I am really proud of indeed
![]() But do you think it is ready for large scale use? As I am learning python, I always ask experienced programmers to tell me things that they think will make my program better, I know my program runs fine but I also know that a wizard like you can add some magic to it ![]() So if you have some free time and want to play with python, take my script and show me things you like to do with your scripts. I am not asking you to add new functionality or anything , just show me better ways of doing things. Thanks for your time, verb3k |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
At this point, it all depends on how the code performs. Can you break the code with messing around in the GUI? Can you give the program bad input? Try to handle all of these cases.
Also, it looks like your code's specific to Linux because of some of the system commands you're using. Is cdrdao Linux only? |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Dec 2007
Posts: 5
Rep Power: 0
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
No, it is available for win32:
http://cdrdao.sourceforge.net/ Making code portable is really interesting, but knowing that windows has many similar tools, I plan to do it only if I want to learn about portable code. Edit: cdrdao comes with most distros by default , shouldn't be a problem for linux users. |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
I don't believe any of the Linux system commands you're using are in the os module, which would handle the cross-compatilibty for you, so you'll have to do it yourself. It'll be compilable on either Windows or Linux if you set a flag that represents the OS, and reference it for each system command that's Linux only, and supply the Windows equivilent of that system command if the OS is Windows.
|
|
|
|
|
|
#7 | |
|
Newbie
Join Date: Dec 2007
Posts: 5
Rep Power: 0
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
I see...
You said: Quote:
I would really appreciate it |
|
|
|
|
|
|
#8 | |
|
Programmer
|
Re: Need your comments on a PyGTK PlayStation CD backup tool
Quote:
As I see it, the idea is to "hide" your code in these boxes (i.e. classes). You can give similar classes methods (functions) with the same name to simplify obtaining information. I think the example from the link above is probably best. If we take two classes called Square and Circle, we can give them both a method called area(). Then, it doesn't matter to me if x is a square, circle, or something else. As long as it has an area method, I can just run x.area() to get that bit of info. I feel like I'm doing a poor job explaining this, as I'm just starting to understand a lot of it myself, so maybe the link can help you more. |
|
|
|
|
|
|
#9 |
|
Newbie
Join Date: Dec 2007
Posts: 5
Rep Power: 0
![]() |
Re: Need your comments on a PyGTK PlayStation CD backup tool
Thanks somehollis for the link... seems interesting!
I also am like you, I can understand the idea but can't make use of it(can't see why I would use it in my program to solve problems) Anyway, thanks for the interesting read, much appreciated ![]() |
|
|
|
|
|
#10 |
|
Programmer
|
Re: Need your comments on a PyGTK PlayStation CD backup tool
I suspect that as we grow to writing larger applications (as opposed to the little 1-trick tools that I have written and suspect that you have as well), we will find more use for OOP as an organizational tool. Of course, I could be wrong...
I wanted to play with some GUI programming, so I'm using python and Tkinter to write a little metric conversion tool. I ended up having one class for the gui and one for the actual math involved in the conversion, so I could definitely see the benefit there. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Backup Search | grimpirate | C | 3 | Jul 3rd, 2006 7:49 PM |
| Comments on comments stripper | nnxion | C | 6 | Apr 27th, 2006 9:53 AM |
| Backup Script :-) | Pizentios | Perl | 18 | Jan 12th, 2006 10:50 AM |
| interesting tool -- for webmasters? is it? | H_two_O | Coder's Corner Lounge | 0 | Oct 25th, 2005 7:26 PM |
| hey there.. need some comments! | H_two_O | Coder's Corner Lounge | 1 | Aug 27th, 2005 6:12 PM |