Script Style Guide
A script style guide is a comprehensive document that outlines the standards and conventions for writing scripts, whether for film, television, theater, or other media. It covers elements such as formatting, punctuation, character naming, dialogue style, and overall tone. A well-defined style guide is essential for ensuring consistency across scripts, making it easier for writers, directors, and production teams to collaborate effectively. By providing clear guidelines, a style guide helps maintain a cohesive voice and enhances the professionalism of the work, ultimately contributing to a smoother production process and a stronger final product.
Documentation Comments:
All classes should begin with Documentation Comments before the class namespace.
The Documentation Comments should follow the following format:
/*******************************************************************
* COPYRIGHT : Year
* PROJECT : Name of Project or Assignment script is used for.
* FILE NAME : ScriptName.cs
* DESCRIPTION : Short Description of script.
*
* REVISION HISTORY:
* Date [YYYY/MM/DD] | Author | Comments
* ---------------------------------------------------------------------------
* 2000/01/01 | Developer's Name | Created <short comment of changes>
*
*
/******************************************************************/
Class Variables
Class variables are attributes that are shared across all instances of a class in object-oriented programming. They are defined within the class itself and typically hold values that are relevant to the class as a whole, rather than to individual objects. By using class variables, developers can manage shared state and behavior efficiently, ensuring that any changes made to the variable affect all instances uniformly. This promotes cleaner code and facilitates easier maintenance, making class variables a crucial aspect of organized programming.
Public Class Variables:
- Written in PascalCase (capitalizing the first letter of each word).
- Should be clearly descriptive.
- Example:
public int PlayerScore;
Private Variables:
- Written in camelCase with an underscore prefix.
- Should be clearly descriptive.
- Example:
private int _playerHealth;
Protected Variables:
- Protected variables are essentially private variables that are accessible by subclasses.
- Written the same as private variables
- Example:
protected float _speed;
Constants:
- Constants are fixed values that cannot be changed at runtime.
- Constants are declared using the const keyword and must be initialized with a value when they are declared.
- Constants are typically used for values that are known at compile-time and are not expected to change during run-time
- Example:
public const float PI = 3.14;
Static Variables:
- Static variables are variables that belong to the class and are shared by the instance. If a static variable is modified by one instance of the class, it will also be reflected in all other instances.
- Static variables are declared using the static keyword and can be accessed using the class name without needing to create an instance of the class. This is because a static variable can only have one value.
- Written in ParcaleCase with a
s_
prefix. - Example:
public static int s_PlayerCount;
Data Types
Data types are fundamental concepts in programming that define the nature of data being handled by a program. They specify the kind of values a variable can hold, such as integers, strings, or booleans, and dictate how operations can be performed on those values. Understanding data types is essential for effective coding, as it influences memory allocation, performance, and the overall logic of a program. By clearly identifying and utilizing appropriate data types, developers can write more efficient and error-free code.
Booleans:
- Should always ask a question, which leans towards a true statement.
- Should be named as descriptive questions.
- Example:
public bool IsPlayerAlive;
Methods
Methods are functions defined within a class that outline specific behaviors or actions that an object can perform. They allow for the encapsulation of functionality, promoting code reuse and modular design. By using methods, developers can create clear interfaces for interacting with objects, making it easier to manage complex systems. Understanding how to define and utilize methods is key to writing effective object-oriented code, as it enhances readability and simplifies the process of debugging and maintaining software applications.
Method Names:
- Written as verbs to indicate actions.
- Should be clearly descriptive of the action performed.
- Protected methods are private methods accessible to subclasses
- Example:
public void AttackEnemy() { }
- Method using the
virtual
keyword in the base class can be overridden in subclasses using the override keyword.
Method Parameters and Local Variables:
- Written in camelCase with no prefix.
- Should be clearly descriptive.
- Example:
public void MovePlayer(int distance) { int playerSpeed = 10; }