• Print

Author Topic: A peek into my method of coding a medium-scale project  (Read 7327 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
A peek into my method of coding a medium-scale project
« on: August 29, 2009, 05:24:30 pm »
If you haven't gotten the memo by now, there's some pretty big changes heading toward ULib and ULX, and a lot has already been changed. Today, I'm going to give you a brief look into the method behind my madness. You'll find out what processes go on behind the scene when I make a large code change.

Idea Generation:

Ideally, get someone who has some clue as to what you're doing and bounce ideas around with them. You want quantity over quality here, just throw out as many ideas as you can think of, no matter how outlandish. You can write these down if you want, I tend to just remember anything that I particularly like. In my experience, the best ideas come when there's food nearby. It's good to have some energy while doing this, but don't let yourself get too distracted or go down too many rabbit trails.

Breaking it down:

Any ideas that you think are worthwhile go into a bin at this point. Now you need to dig through this bin, consider each idea on its own merit (freestanding of all other ideas you may think are cool). You generally want to think about the following while looking at each task:
  • What are the dependencies behind this idea? Anything else I'd have to code to make this? Can I reuse any of my previous work for dependencies here?
  • If the dependency requirement is large, is there any value in making the code powering this idea reusable? (A lot of people push that you should always make code reusable, but I think it's more of a balance between what you think you'll need this for down the road and the amount of time you have)
  • How can I prototype this code to test it as quickly as possible? Should I code a throwaway prototype, or something I'll build off of later? (I can't say enough how valuable it is to get your idea into code form as quickly as possible. You can't always foresee everything involved with building something, and the sooner you know, the less time you pursue perfecting something that won't work anyways.)
  • How can I modularize this idea? What modules will be the most difficult? (you often want to code these first) How can I minimally implement each module so I can get testable code as soon as possible?
  • Depending on your resources available or your design goals, you want to consider drain on CPU, memory, storage, your time, maintenance of this code, and pollution of code space, etc. In general, I try to stick with the philosophy that the best code is no code at all. Is the code you will write for this really going to be worth the use of resources?

How much weight you put on each of these points will vary between projects and the importance of an idea. You'll want to either remember or write down how you're going to break up an idea into modules. You should now have a pretty good idea of what ideas you're going to pursue and how you're going to do it.

Make a task list and live by it:

I have trouble keeping all the bits and pieces I need to do in my head, so I grab some paper and write away at this point. Here's two pages from my current notes for the changes coming to ULX and ULib:





It's not neat, but it's there. That's the important thing. When you finish a task, cross it off. There's something oddly satisfying with being able to cross a task off, and being able to look at your task list and see what you've completed versus what you have left to do. Having these papers handy means you can also get quick notes written down, which is also something that should be done while coding.

Keep yourself interested in the code you're writing and care about it:

In order to make good code, you must care about it. You must treat it as if it were your child: you want the very best for it. It's not something that's haphazardly done and forgotten the next day.

The 'how' in caring for code varies person to person. If I find my interest in something dropping, I tend to work on something else for a while so I can generate new ideas for the original project. Call it an attention stamina, if you will; it works best for me if I don't keep forcing myself to do something I don't want to do. You can also introduce an extra level of 'fun' in code while you work on it. Write some amusing code that you'll remove before it hits production. For example, in my current working code for an upcoming ULib feature, I have the following...

Code: Lua
  1. if self.restrictedTargets and not table.HasValue( self.restrictedTargets, target ) then
  2.         return false, "you must have super cow powers to target this person"
  3. end

There's some history behind why I wrote this, but the bottom line is that I get a little laugh every time I look at this code. It makes me happier, which makes my programming better. It's something I'll change once I feel I'm ready to push the code to the public, so no one has to know about my odd habits. ;)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: A peek into my method of coding a medium-scale project
« Reply #1 on: August 29, 2009, 06:41:08 pm »
Mooooo!
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: A peek into my method of coding a medium-scale project
« Reply #2 on: August 30, 2009, 09:01:18 pm »
lol, my bad, It was me who mentioned the apt-get while he was writing that bit of code  ;D
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Brandon

  • Newbie
  • *
  • Posts: 15
  • Karma: 1
  • Minge tested, Brandon approved.
    • Steam
Re: A peek into my method of coding a medium-scale project
« Reply #3 on: October 31, 2009, 01:46:14 pm »
your handwriting and my handwriting should have a chicken scratch fight. Hahaha

(just kidding)
Professionals have standards:
-Be polite.
-Be efficient.
-Have a plan to kill everyone you meet.
(yeah its off tf2 so what)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: A peek into my method of coding a medium-scale project
« Reply #4 on: November 01, 2009, 09:54:36 pm »
your handwriting and my handwriting should have a chicken scratch fight. Hahaha

(just kidding)

Heh, as long as you can read it, it's fine. :)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: A peek into my method of coding a medium-scale project
« Reply #5 on: November 02, 2009, 08:10:31 pm »
You must both be aiming for Doctorates I tell ya, Doctorates!
I swear... anyone with Dr in front of thier name goes through 8+ years of scratch lessons.
Doesn't matter what kind.. MD, DDS, PhD... any Doctorate.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: A peek into my method of coding a medium-scale project
« Reply #6 on: November 04, 2009, 08:09:16 pm »
You must both be aiming for Doctorates I tell ya, Doctorates!
I swear... anyone with Dr in front of thier name goes through 8+ years of scratch lessons.
Doesn't matter what kind.. MD, DDS, PhD... any Doctorate.

Planning on it :D
Experiencing God's grace one day at a time.

Offline Buggzie

  • Newbie
  • *
  • Posts: 48
  • Karma: 2
Re: A peek into my method of coding a medium-scale project
« Reply #7 on: January 17, 2010, 09:59:22 pm »
I've been using the same method as you paper and pen next to me all the time. Write and fix problems...
This is a very smart way and i havent forgotten anything with this method :)

  • Print