Programming Tips & Tricks: Code

Forums Resources Programming Programming Tips & Tricks: Code

This topic contains 0 replies, has 1 voice, and was last updated by Animation Pagoda Staff Animation Pagoda Staff 2 years, 3 months ago. This post has been viewed 237 times

  • Author
    Posts
  • #4110
    Animation Pagoda Staff
    Animation Pagoda Staff
    Moderator
    • Topic Count 63
    • Replies 0
    • Offline

    Programming Languages

    Even though computers can only read binary, there are many different programming languages and software engines. These languages use different variations of syntax and are sometimes only compatible with certain types of machines or software.

    A compiler is a special type of program used to decipher a programming language into fundamental machine code binary. A decompiler switches the machine code back into an output. There’s a bunch of other complex processes, translations, and reformatting that occurs in-between these steps, but all you really need to know is that modern compilers are a lot more flexible at interpreting different code types than computers made over 30 years ago. This means that programmers can start out learning just about any language and build up knowledge from there.

    Code.org: What Most Schools Don’t Teach

    Codementor: What Programming Language Should a Beginner Learn?

    The Wall Street Journal: Why I’m Not Looking to Hire Computer-Science Majors (competition in the real world)


    Terminology

    Programmers have developed an extremely complex lexicon of software terms that they can use to communicate with other programmers across the world despite using different code platforms. This is due to the established standards and similarities between code languages. To regular people though, programming terms sound like complete jibberish.

    Trying to wrap your head around what modules, subroutines, instances, shell scripting, and various acronyms mean is initially quite tough, especially for visual learners. It just takes practice. The nice thing about learning to code is that you’ll be able to exchange hilarious inside jokes in conversation with your programmer friends while everybody else just looks confused.

    Glossary of Computer Programming Terms


    Logic and Syntax

    Computer logic functions on the principle of binary absolutes. If code is not phrased in the proper syntax, the computer won’t be able to translate the information, and an error will occur. You will be reminded of this simple fact quite frequently when your code doesn’t do what you wanted it to. It’s just a hard lesson all programmers must go through.


    Debugging Code

    When improper syntax doesn’t crash the system, freaky things can sometimes happen instead. This is usually attributed to a missing or deleted closing div, or else a slightly misspelled word. Even capitalization can cause problems. Sometimes one line of code is overridden by another block of code with conflicting influence. When code misbehaves, the only thing to do is just go back through the thousand lines of code for the fortieth time and try not to break down in tears. Methodically deleting swathes of code and refreshing is an unorthodox but generally effective way to try and isolate the source of errors.

    Medium.com: Ken Mazaika- 29 behaviors that will make you an unstoppable programmer


    Standard Code Annotation

    It is a good practice to make a habit of always naming files and annotating code using standard conventions. The reason for this is that when something stops working properly or needs to be changed, it makes it much easier for anyone to go in and pick out the correct block of code. You don’t want to waste hours going through someone else’s 30,000 lines of Java jibberish trying to figure out what controls what.

    Free Code Camp: Coding Explained in 25 Profound Comics


    Efficiency

    In programming, you generally want to be as efficient as possible with code. If something can be done with one line of code instead of twenty, it is preferable to use the one line of code. The further you delve into programming, the more advanced ways you will find to rearrange bundles of code into neater systems that take up less memory and run far more efficiently.

    Your first coding project isn’t going to be pretty or compact. However, a good programmer always seeks to learn new techniques and tries to improve the underlying infrastructure of their code.

    Garry Houser

    Yosefk: Redundancy vs. Dependencies: which is worse?


    Setup

    Processing has three main steps: declaration, initialization, and draw. Integer and char values are assigned by declaring values, usually placed before the initialization part. Void setup() {} is a default class used to initialize values and instructions. Any code that appears between the curly brackets will act as instructions. Void draw() {} represents the active elements that will be displayed in the view window when the code is running.

    Processing.org: Objects


    Declaration Statements and Assigned Values

    This involves some basic algebra, assigning values to integers. The programmer has to put the declaration statement in the correct syntax within the code. Once a variable is declared once, it can be used multiple times or be assigned to functions and other variables.


    Functions

    Functions are math formulas. For Loops, While Loops, and Else Statements are the type you’ll probably be dealing the most with. For loops cycle through a set number of values and applies a formula each time until the parameters of the statement are met. Else statements will switch to another formula if the parameters of another formula are untrue.


    Boolean Operators

    If, And, and Not are logic statements used to join functions. Multiple functions can be strung together using these operators.


    String

    A string is a set of characters. It can be broken down into substrings. length() will return the number of characters in the string. print can be invoked to display characters on screen.


    Arrays

    Arrays are used to store a large number of values of similar type. They can be used in conjunction with For loops to apply a function to multiple objects at the same time.

    Jose Sanchez: Processing Arrays


    Probability

    A seed value is used to initiate a randomization generator that will return a value from a range of values. This process is tecnically pseudorandom and based on probability rather than randomness, but that’s a subject for lengthy discussion with your statistics professor. The random function can be used with any kind of defined value, including integers, colors, coordinate points, shapes, etc. The seed will determine how many things are returned for each function.

    IFA.tv: Probability Machine/Galton Board, Randomness and Fair Price Simulator


    Calling a Function

    Object-Oriented programs allow the programmer to reuse predefined code by referring it. This saves writing a bunch of lines of code over and over. If you ever look at a video game’s source code and there seems to be far less lines of code than expected, it is because all the data is being called in from other source folders.


    Classes

    A Class is a grouping of functions that can be set up as an object instance. A class is set up using this format: class Nameofclass{function/s go here}. Every time the class is invoked, it will generate whatever the functions are set up to create. This can be used to create different types of sprites.

    Coding For Art: Objects and Classes


    Parsing

    Parsing is a logic process used to take unorganized characters and convert them into a syntax tree. Basically when a person inputs a sentence into a computer, the computer wouldn’t know how to display those words in order to make any sense without parsing sorting out where letters and punctuation should go. Top-down and Bottom-up are the two alternate parsing methods.

    Parsing posed a big headache for the first programmers, but these days parsing is already built into most compilers, so programmers don’t have to worry about it too much unless you plan on building your own engine or program.

You must be logged in to reply to this topic.