NEED OPINIONS ON MY CODING (TEXT BASED RPG IN PYTHON)

Posts

Pages: 1
http://pastebin.com/k3ArH64G

I've been playing around with Python 2.7 for the past year. Kiiiinda dropped it recently to muck around with RPG Maker but now making an effort to commit to it more frequently. Basically, I'm looking for someone to point out anything I'm doing wrong/inefficiently within this project (and I'm certain there's a lot of messy stuff going on) and give advice on what and what not to do in regards to clean, efficient coding to help this aspiring programmer become less garbage.

Thanks for your time.

EDIT: Wasn't sure where to put so if this is the wrong place, my bad.
Yellow Magic
Could I BE any more Chandler Bing from Friends (TM)?
3229
Ive had a brief look and there are a couple of things that pop right out:

-> Is there any reason your class definitions aren't in separate .py files?
-> I see a lot of magic numbers,
-> I would look into parsing text files instead of including all text elements (dialogue etc.) within the Python code.

I'll try and get in a more in-depth look after work!
Thanks man, looks like I've got some research/study to do. just a quick question. Should classes ALWAYS be in separate .py files? Any exceptions/rules I should be aware of?
CashmereCat
Self-proclaimed Puzzle Snob
11638
To my knowledge, they should be in different files just so that it's not one huge .py file like you got right there. It makes it way easier to do separation of concerns I think it's called. So, I mean, it's OK to have it all in one file but that's one huge ass file and for a bigger game it's gonna be one MEGA file so it'd be logical and good programming practice to split it up.
Awesome, makes perfect sense. This might be another dumb question (considering the site) but is there anyone here who does programming for a living? It's something I've been considering for a while and I'm not sure whether to do tertiary study immediately or maybe learn as much as I can on my own before thinking about studying full/semi full time. Would like words of wise-dom.
CashmereCat
Self-proclaimed Puzzle Snob
11638
I'm in my final year of programming, and sadly I don't really know how to do it that well, or maybe I'm just being modest. But really though, I knew nothing before joining, and I turned out kinda fine I think.

You can always practice programming while you study.

Oh! You live in Auckland. Even better. I can be more specific. I'm 4th year studying Software Engineering at Uni. That's BE(Hons). It's pretty legit and cool, but you can always do a BSc majoring in Computer Science and it'd be just as good. My friend did a BSc and he's better than me at programming (I think).

I didn't even know how to do any programming before starting. You're way ahead of me on that front.
Yellow Magic
Could I BE any more Chandler Bing from Friends (TM)?
3229
author=CashmereCat
To my knowledge, they should be in different files just so that it's not one huge .py file like you got right there. It makes it way easier to do separation of concerns I think it's called. So, I mean, it's OK to have it all in one file but that's one huge ass file and for a bigger game it's gonna be one MEGA file so it'd be logical and good programming practice to split it up.
Yeah, pretty much. I mean, Python is not a strictly OO language, so it's not an absolute requirement to put one (outer) class in one file (in-fact, a file is also called a module in Python, and works similiar to packages in Java, but with all the classes in one file). Ultimately the number of classes in a module is a judgement call - but as Cash said it's best to group similiar behaviours in each module in order to separate concerns.

By the way, ten_blue_egyptians, I'd recommend reading PEP8 to any budding Python developer.

author=ten_blue_egyptians
Awesome, makes perfect sense. This might be another dumb question (considering the site) but is there anyone here who does programming for a living? It's something I've been considering for a while and I'm not sure whether to do tertiary study immediately or maybe learn as much as I can on my own before thinking about studying full/semi full time. Would like words of wise-dom.
I've programmed for a living in the past (as an Android developer for a start-up), but I'm currently in a system administration/project management role. Trying to get back in the game, though.

In this industry, experience is much more important than qualifications...I'd recommend writing as much code as you can. Thankfully, with projects like this you're off to a good start!
slash
APATHY IS FOR COWARDS
4158
author=ten_blue_egyptians
Awesome, makes perfect sense. This might be another dumb question (considering the site) but is there anyone here who does programming for a living? It's something I've been considering for a while and I'm not sure whether to do tertiary study immediately or maybe learn as much as I can on my own before thinking about studying full/semi full time. Would like words of wise-dom.


Ooh, pick me! I work full-time as a programmer now, and previously I did contract work and part-time work during and after college.

Yellow Magic is right, experience is definitely more important than official credentials when looking for a job. If you don't have experience at a full-time job, it's good to get some part-time or contract work experience if possible, or to have a portfolio of completed projects - to show your ability to fully complete projects, your level of skill and knowledge, and your enthusiasm. A lot of the people I work with don't have degrees or don't have relevant degrees, anyway (like me!). All you need is some way of proving you know your stuff, like a good portfolio.

If you can afford school, that's great, but don't consider it a requirement. Some classes focus a lot on theory, which is helpful, but hands-on experience writing programs that accomplish a task, and experience with things like "working within a deadline" and "cooperating with a team of designers, artists, producers, etc." is probably more relevant.

So to answer your question - yea! Start practicing now on your own time, either writing from scratch, or scripting or modding things (VX Ace, etc.), or whatever! If you really like it, dive in further, and then decide about school. Other than that, I guess my only specific advice is: there's a lot of people looking for good web developers in particular, I think? So maybe learn some of that too. HTML, CSS, JS, PHP; never bad stuff to practice.
Phew! It's nice to know that a qualification isn't a be-all, end-all requirement. Being super poor coupled with the fact that housing costs in my country are stupidly high for average/below average housing (Cash may be able to vouch for this unless he/she/(it? loljk) is baller) don't really mix well with expensive education costs so it's a huge relief that I don't have to dig myself into a financial pit of hell.

I've decided to take the following week off of work (thankfully, I'm able to) to get some serious study in and hopefully get that much closer to having a decent grasp of programming. Thanks again guys for the words of wisdom/encouragement and thanks Yellow Magic for the link, will give it a thorough read!

Another quick question, at what point should I consider to start learning Django ie what should I know/have a thorough understanding of in regards to Python? As slash has pointed out, web developers seem to be in great demand and that seems like a good starting point to aim for.

Edit: @slash or anyone else, what would you consider a solid portfolio to consist of?
Yellow Magic
Could I BE any more Chandler Bing from Friends (TM)?
3229
author=ten_blue_egyptians
Edit: @slash or anyone else, what would you consider a solid portfolio to consist of?
Code.

I'm actually serious: Haven't seen or heard many examples of BAD programmer portfolios...although I'm guessing you should try to adhere to coding standards (such as PEP 8) as much as you can. Also important is understanding what might be the best data structures or design patterns to use in specific scenarios...however, unless you're doing something silly like bubble-sort or using a linked list to store 100000000 entries with frequent look-up, that kind of thing is usually not 100% objective. Sometimes you just gotta follow your heart...
Pages: 1