Off Topic > Off Topic
Programming Megathread
<< < (102/241) > >>
Pecon:

--- Quote from: Foxscotch on March 01, 2016, 03:00:39 PM ---I don't even know HOW to plan something. like in my head I generally know how I'm gonna do x or y but I don't know how to write that down right?
and I'm okay at documenting something after it's written but how t f do you do it beforehand

--- End quote ---
Yeah, I always just do all the logic in my head and then just write it and it's done. I have a very hard time planning out large projects because of this.
Kingdaro:
I probably should, but I pretty much never plan out my programming. If there's something I need to wrap my head around, like an algorithm or something, I just write out a bunch of math on my whiteboard until I understand what I need to do.

Whiteboards are an awesome thing to have for software dev, by the way. Paint + a drawing tablet is pretty great too.
McJob:

--- Quote from: Foxscotch on March 01, 2016, 03:00:39 PM ---but how t f do you do it beforehand

--- End quote ---
When I do systems design, if I go straight-ahead, I tend to throw in a lot of dirty code without comments that becomes extremely hard to manage. It's therefore best if I know what I want to achieve and design the rules for the system first (with proper documentation!) so that future system updates are easier to manage.

I start by thinking about everything in the game as part of a class hierarchy (not worrying about implementation, just about who is a parent and who is a child via their similarities/differences); I'll also make notes about things that can be instanced rather than requiring a whole new class.

Once I'm happy with the layout, I'll then write down implementation notes for each class that include stuff like data they need to track (variables), things they need to do (methods), things they need to react to (events) and so on. My goal is to try and get a clean network that's modular.

I'll then take the notes and build a full documentation for the system. It will definitely change after implementation, but it helps me stay focused when writing code; it's almost like a programming homework exercise you get in university, since I've written down what I need to achieve, some rules about how it works, and what the end result should be. It's also great since I have more energy at the beginning of projects, and writing documentation can be a slow and painful process at times.

Once I'm happy with the plan, I'll start laying out the roads. Things will absolutely get switched around, break or require solutions I didn't have access to before, but it's always handy to have something to stick back to.
Foxscotch:
ok so I WANT to use requirejs but why tf does it make me do this

define(function () {
  return {
    junk() {},
    moreJunk() {}
  }
});

WHY
commonjs way:

function junk() {}
exports.junk = junk;
function moreJunk() {}
exports.moreJunk = moreJunk;

is like 100x simpler. I can't even think of any advantages to the first one. I mean, I'm sure there's something, or they wouldn't have done it, but wtf is it??
Kingdaro:
Try webpack. It lets you bundle JS files together, and it supports CommonJS and AMD (the format RequireJS uses). At first it might seem a little complex to use, but going through the tutorial once makes it fairly easy to get into using.

Beyond just simply bundling files together, though, I wouldn't know stuff. That's where it gets complex, when you throw in plugins and other overly-engineered trash in the mix. Avoid that and you should do alright. Just try to make sure you don't spend too much time on your build system more than you do actually making a thing.
Navigation
Message Index
Next page
Previous page

Go to full version