How Do You Write Appealing Code?

  • What casing convention do you use? camelCase, LOUD_SNAKE_CASE, PascalCase, or something else – and when?
    I use camelCase for all Variables, functions, classnames, etc. For settings I use LOUD_SNAKE_CASE and dedicated settings file. So a setting in my workflow is the following

    settings[“SETTING_NAME”]

  • Do you have code you write one day and end up disliking? How do you deal with it? Do you continue writing off of it?
    You grow as a programmer, so it is more than naturally that your code becomes outdated with your current knowledge. I often come back to a script to add support for new features, if I see code that is outdated or doesn’t make a lot of sense anymore with my current know how I will change it around / rewrite it partly. Please do not rewrite scripts for the sake of rewriting it, you also need to have the time to work on features and game design in general.

  • How do you set up your scripts? Do you use a lot of modules? How do you assemble them all together (if a LocalScript, what do you put in your central script? User input?)
    So I always have two networks running, one of the server and one on the client. Client is responsible for all User interactions (like input), but also the Interface. Both networks runs on ModuleScripts and sometimes they are tied together with BindableEvents

  • How lengthy are your server and client scripts?
    Depends on the features that it need to support. Honestly they are quite long because I also write documenation for each single function, so what does the function do, what does it return, etc.

  • Do you use an organizational technique with your functions? Do you put all of your functions into a table and use the “self” argument? Do you create a table and then write your functions outside of it?
    I use the OOP approach with a self made class system that I used for years. I really love this approach and it allows me to stay clean with my coding practice.

3 Likes

I usually use camelCase but I also ue PascalCase from time to time.

If my functions are lenghty and are used by many local and server scripts (such as a function to get data from replicatedstorage, I would use a modulescript.

For variables I like to keep the names as simple as possible whilst still being linked to what they store.