Tuesday, February 12, 2019

My Java Project Structure

I do all of my Java coding 'by hand'. I don't use an IDE and I don't use build/packaging/deployment tools. I like to get my hands dirty and I like to know everything that is in my project, I don't want any black boxes. Of course if a project were to become so complex, or powerful, or huge as to require additional tools I will use them. But I would be sad that I had to.

I use little shell scripts I wrote to do the compiling of code and packing of .jars. I use VIM to write all the Java code. I have a common structure that I use for all of my projects and I will share that with you here.

ROOT
Each project is a self contained unit. It lives within the project root directory. In this article I will use WorldWeaver (My IntFiction engine) as our example. All of the client code, classes, and output, and anything else for the project lives in:

~/worldweaver/

At this root level I have any shell scripts I use for compiling and running etc.

CODE
The code directory contains all of my source code (.java). I follow title case for all of my classes. - However, I'm bad, I use title case for my methods as well. And I use title case for my public variable methods, camel case for my private variables etc. I think this is a habit from my .NET days.

COMPILED
The compiled directory is where I have my .class files built. This directory also contains my manifest file.

RELEASE
The release directory is where my jar file is compiled. It contains any files that are to be distributed with the app, including data files, config files, and databases etc.

The full structure is:

ROOT
  |__ CODE
  |__ COMPILED
  |__ RELEASE

I use javac with parameters for all of my building, copying and calls to java -jar in my shell scripts for launching, although I could also chmod the jar as executable and double click it like in Windows or Mac OS.

Monday, February 11, 2019

Regex, TDD Style

I've not done a ton of Test Driven Development (TDD) but from my understanding of it I like the idea. It's like checking your work in math, only backward. It forces you to check your work. You can't say: I would have checked my work but I ran out of time. At least that is my layman's perspective.

But I think the benefits of TDD may actually stretch into the core problem solving of programming. We know you have to think differently when taking a TDD approach, but I think that it could actually make the problem solving easier, and actually make learning new languages or syntax easier too.

What am I talking about? I just watched a video that walks the viewer through building regex expressions and the host did so by taking a TDD approach. He started with a valid value, and wrote a simple regex that would pass anything. Then he began to harden up the expression until it properly found only the desired values. I went away from the video with a far greater understanding of regex than I had before (I typically hamfist my way through regex use, scouring regexlib and using their tester tool to make sure what I find will work for me. Now I actually understand the syntax and rules of basic regex expressions - AND I saw a great way to actually author my own instead of copying/pasting existing expressions.

All through the use of TDD style regex expression writing.

Friday, February 8, 2019

Utopia Flip

My Tomorrowland-inspired IntFiction game is going well. I've tested the logic that randomly flips the player from a retrofuturistic wonderland to a deadly, dark dystopia. Now I'm working through some puzzles and clues in the utopian commercial district.
As I go I'm making some minor - and not so minor tweaks to the game engine. I've updated the logic block elements so that Eval blocks can be defined within the Logicset blocks, instead of requiring Logic elements to house the Evals. So it is possible to do:

{logicset
  [@eval
    ...
  ]
}

As well as:

{logicset
  {logic
    [@eval
      ...
    ]
  }
}

This will save some work when defining more basic logic checks. I may do some other time-saving updates as well. We'll see.

Monday, February 4, 2019

API


I'm looking to build an API-based application. It's been a while since I've done any serious web work.

As I look into beginner API development it is becoming obvious how little I know. Apparently I've been spending too much time in the back end. It's going to take me a bit to get up to speed. Postgres was frustrating, couldn't even get a DB created. So that will be the first thing I tackle.

Ultimately my goal is a complete system of just APIs that could be used to build whatever UI a developer wants. The 'social end result could be a console app or a complex, full blown website or mobile app. Features could be included / excluded as desired. In an age where software is constantly taking away our ability to tweak and customize it, I want to go the opposite direction.

5 VST Effects I Use in Every Song

VSTs are so great. I have a massive collection of free instruments and FX that I've tracked down. There are SOO many to choose from... B...