Hutmacher Common Library
Current Release: 0.1


What is the Hutmacher Common Library (HCL)?
The HCL is a library made of functions and classes written in both Javascript and PHP. The HCL is designed to function the same in both Javascript and PHP. This elimates the need to remember how to do the same thing in two different languages. The function prototypes are also designed to help self-document without using cryptic function names.

For example:

Determine if variable $i is a positive integer
Language If Statement
 JAVASCRIPT  if( typeof $i == 'Number' && $i % 2 == 0 && $i >= 0 ) { ... }
 PHP  if( gettype($i) == 'integer' && $i >= 0 ) { ... }
 HCL ( JAVASCRIPT & PHP )
 if( is_positive_integer_($i) ) { ... }

What the HCL isn't!
  • The most comprehensive and advanced algorithms available. It is designed to be lightweight, not the end all and be all of computer libraries.
  • The most efficient library on Earth. Some of the source code designs are not the most efficient way to do things for various reasons. Whenever possible the HCL is made as efficent as possible, but some functions are slightly more inefficent than they could be in order to prevent code redundency and to ensure the functions work the same on both Javascript and PHP.
  • The fastest way to do things. The HCL is designed to be used in basic web and server situations. It was not designed to scale to anything that has to run millions of times per second.
  • Designed to be compatible with Windows in any way. While most of the code should be compatible, the HCL was written in Linux for standard Javascript and generic php. It isn't tested against windows browsers or php running on Microsoft servers.

HCL Sublibraries
The HCL is broken down into several "sublibraries". These are "core", "classes" and "dependent".
  • Core: The basis for all HCL functionality. The "Core" capabilities MUST be included for anything in the HCL to work.
  • Classes: These are a series of classes designed to work with the HCL. In most cases they are convience classes that allow you to perform several HCL Core functions easier.
  • Dependent: These are classes and / or functions that only work for either Javascript or PHP. They are not part of the Core or Classes capabilities as those two are and always will be identical between the two languages.

HCL Prototypes
The function prototypes are one of the reasons that spurred the development of the HCL. The prototypes has been designed to remove confusion and to"self document" by making it crystal clear what each function does.
  • All core functions and classes have identical prototypes between Javascript and PHP, so there is never a need to look up a prototype for one language or another.
  • All hcl functions end in a "_" to avoid conflicts between other functions.
  • Whenever possible, full words are used to describe function names and arguments.
  • Often there are 2 versions of a function that is usually a single function in the default language. For example the HCL has 2 substring functions: substring_by_length_ and substring_by_position_. This makes it easier than calling substr and also calling strpos.
  • Functions dealing with strings have an argument to determine if it should be case_insensitive which makes it clear in the source code.

How To Use It?
Javascript
Upload one of the js files from the /src/javasript folder from the release zip file.
  • hcl.base.min.js
    This file contains ONLY the core sublibrary and data files. This is the smallest file and should be used if you ONLY need the core functions and none of the data files.
  • hcl.production.min.js
    This file contains the core, classes and dependant sublibraries and data files. Only use this file if you need the classes.
  • hcl.full.min.js
    This file contains all code and data files, include the large data files left out of the base and production files. Only use this file if you want EVERYTHING available.

PHP
  • Upload the /src/php folder from the release zip file.
  • Include "hcl.php" in your project.
  • That's it. Easy, wasn't it.