Archive for the ‘baseplane’ Category

Big O Notation in Design Theory

Saturday, March 22nd, 2008

Big O Notation is based on complexity theory and is something engineers and architects should know about do determine complexity and orders of magnitude in their data and scalability formal blueprints. Whenever you use any algorithm or port a formal function into code, math and reducing the orders of magnitude is what separates the fast from really fast.

Optimization can be evil, but solid base starting points are desired. Many times formal knowledge can be as needed as logical or physical separation and understanding service and standards format layering in your applications for the best evolution and versioning as well as performance. Formal engineering is what is separating companies like Google from the pack. Do you do formal?

Orders of common functions

Here is a list of classes of functions that are commonly encountered when analyzing algorithms. All of these are as n increases to infinity. The slower-growing functions are listed first. c is an arbitrary constant.

Notation Name Example
\mathcal{O}\left(1\right) constant Determining if a number is even or odd
\mathcal{O}\left(\alpha(n)\right) inverse Ackermann Amortized time per operation when using a disjoint-set (union-find) data structure
\mathcal{O}\left(\log^* n\right) iterated logarithmic The find algorithm of Hopcroft and Ullman on a disjoint set
\mathcal{O}\left(\log n\right) logarithmic Finding an item in a sorted list with the binary search algorithm
\mathcal{O}\left(\left(\log n\right)^c\right) polylogarithmic Deciding if n is prime with the AKS primality test
\mathcal{O}\left({n^c}\right), 0<c<1 fractional power searching in a kd-tree
\mathcal{O}\left(n\right) linear Finding an item in an unsorted list
\mathcal{O}\left(n\log n\right) linearithmic, loglinear, or quasilinear Sorting a list with heapsort, computing a FFT
\mathcal{O}\left({n^2}\right) quadratic Sorting a list with insertion sort, computing a DFT
\mathcal{O}\left({n^c}\right), c>1 polynomial, sometimes called algebraic Finding the shortest path on a weighted digraph with the Floyd-Warshall algorithm
\mathcal{O}\left({c^n}\right) exponential, sometimes called geometric Finding the (exact) solution to the traveling salesman problem (under the assumption that P ≠ NP)
\mathcal{O}\left(n!\right) factorial, sometimes called combinatorial Determining if two logical statements are equivalent[1], traveling salesman problem, or any other NP-complete problem via brute-force search, finding the determinant of a matrix with expansion by minors
\mathcal{O}\left({n^n}\right) n to the n  
\mathcal{O}\left(c_1^{c_2^n}\right) double exponential Finding a complete set of associative-commutative unifiers[2]

Not as common, but even larger growth is possible, such as the single-valued version of the Ackermann function, A(n,n). Conversely, extremely slowly-growing functions such as the inverse of this function, often denoted α(n), are possible. Although unbounded, these functions are often regarded as being constant factors for all practical purposes.

JSON-RPC Implementations

Thursday, March 20th, 2008

JSON-RPC is the answer to the argument that XML RPC is too verbose and bloated and convoluted.  JSON is just about as simple as you can get in data formats and it is becoming a great baseplane standard and is a tool that spans many platforms.

“Does distributed computing have to be any harder than this? I don’t think so.”

Can it be even simpler ?

JSON-RPC is lightweight remote procedure call protocol similar to XML-RPC. It’s designed to be simple!

JavaScript

C

C#

Erlang

Java

Lisp

Lua

Perl

Php

Python

Ruby

Frameworks

MonoDevelop 1.0 Released

Tuesday, March 18th, 2008

mono-logo.pngMono is a great open source .NET implementation that has been looking to being a baseplane dream to .net development. They even have Moonlight which will eventually be caught up with Silverlight development.

However today mono gets a killer IDE in the MonoDevelop name.

[insertname]Develop projects are largely based on the SharpDevelop IDE that is one of my favorites with .net and is open source. If you are looking for a FAST IDE SharpDevelop is that. In the FAQ Miguel mentions that MonoDevelop is a port or branch of SharpDevelop which is great news for quality, speed and usability.

FlashDevelop is also another great kit based on this IDE framework. I am very pleased Mono is using the same standard for IDEs that mimic VS.NET only much more speedy and usable in SharpDevelop and FlashDevelop (both .net apps themselves and two of the only good winforms apps there ever were).

mmI highly recommend mono and MonoDevelop. These are tools that are baseplane languages and platforms that have all the benefits of .net development but for any platform and now for any platform as an IDE. One problem with FlashDevelop is that it is only for Windows machines but maybe MonoDevelop will influence and will allow it for other platforms as well and everyone will be able to use the best IDE there is for flash and flex development.

In the meantime if you are a .net developer and want to develop for multiple platforms not just Windows then Mono is your tool and MonoDevelop is your IDE.

The main features of MonoDevelop are:

  • Customizable workbench, including custom key bindings, custom layouts, and external tools.
  • Support for several languages, with C#, VB.NET and C/C++ support included, and Boo and Java (IKVM) support available as separate add-ins.
  • Support for code completion and type information tooltips.
  • Refactoring operations to simplify changes like renaming types and type members, encapsulating fields, overriding methods, or implementing interfaces.
  • Code navigation operations such as jumping to variable definitions and finding derived classes.
  • Easy to use GUI designer for GTK# applications, also supporting the creation and management of custom GTK# widget libraries.
  • Integrated source code version control, with support for Subversion.
  • Integrated unit testing based on NUnit.
  • Support for ASP.NET projects, allowing web projects can be built and tested on XSP.
  • Integrated database explorer and editor (beta).
  • Integration with Monodoc, to provide documentation about classes.
  • Support for makefiles, both generation and synchronization.
  • Support for Microsoft Visual Studio project formats.
  • Packaging system that allows generating tarballs, source code and binary packages.
  • Command line tools for building and managing projects.
  • Support for localization projects.
  • Extensible add-in architecture.

Baseplane Tools: Regular Expressions

Thursday, March 13th, 2008

Regular Expressions are a great tool for programmers on any platform. We aim to highlight the skills that work well for programmers on any system and this is definitely one of them. Regular Expressions are not black magic, they are very helpful and when it comes to templating, highlighting or any kind of searching textual content they are the best tool for the job.

Some Platforms or Systems that use Regex

One of the best regular expression sites is just http://www.regular-expressions.info/ but there are many. If you are new to regular expressions or finally want to start understanding what makes them work

Some samples of common programming tasks:

Example of White Space Trimming

You can easily trim unnecessary whitespace from the start and the end of a string or the lines in a text file by doing a regex search-and-replace. Search for ^[ \t]+ and replace with nothing to delete leading whitespace (spaces and tabs). Search for [ \t]+$ to trim trailing whitespace. Do both by combining the regular expressions into ^[ \t]+|[ \t]+$ . Instead of [ \t] which matches a space or a tab, you can expand the character class into [ \t\r\n] if you also want to strip line breaks. Or you can use the shorthand \s instead.

Grabbing HTML tags or Markup

<TAG\b[^>]*>(.*?)</TAG> matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do. This regex will not properly match tags nested inside themselves, like in <TAG>one<TAG>two</TAG>one</TAG>.

<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1> will match the opening and closing pair of any HTML tag. Be sure to turn off case sensitivity. The key in this solution is the use of the backreference \1 in the regex. Anything between the tags is captured into the second backreference. This solution will also not match tags nested in themselves.

This is just a few great uses. When you build your regex libraries, they never die, they span all platforms.

Check out ten great reasons to learn and use regular expressions. Also the javascript RegexPal.

Pseudo-code for using regex in a recursive way

When used by themselves, these regular expressions may not have the intended result. If a comment appears inside a string, the comment regex will consider the text inside the string as a comment. The string regex will also match strings inside comments. The solution is to use more than one regular expression, like in this pseudo-code:

GlobalStartPosition := 0;
while GlobalStartPosition < LengthOfText do
  GlobalMatchPosition := LengthOfText;
  MatchedRegEx := NULL;
  foreach RegEx in RegExList do
    RegEx.StartPosition := GlobalStartPosition;
    if RegEx.Match and RegEx.MatchPosition < GlobalMatchPosition then
      MatchedRegEx := RegEx;
      GlobalMatchPosition := RegEx.MatchPosition;
    endif
  endforeach
  if MatchedRegEx <> NULL then
    // At this point, MatchedRegEx indicates which regex matched
    // and you can do whatever processing you want depending on
    // which regex actually matched.
  endif
  GlobalStartPosition := GlobalMatchPosition;
endwhile

Regex makes you a better solution provider, it give the engineer the tools to transcend platforms with ease. They help to create a baseplane solution in technology and a market platform.

Is Python Becoming A Market Baseplane Language?

Thursday, March 13th, 2008

Sun has been on a rampage lately. They recently purchased MySQL (which has some questions with InnoDB) but they also are supporting Python and integrating it into the VM offerings with Jython.

So now we have Google (They employ Guido), Microsoft (IronPython) and Sun (Jython) all turning into Python-istas. Does this mean Python is destined for greatness in the near future? Well I recommend learning it. It is a great language and it has a high productivity rate. Time will tell if it has the ability to be in extremely large code bases. I think it is just a matter of the architecture and organization as with any project.

Jonathan Schwartz at Sun mentioned also taking the “J” out of “JVM” to just make a VM much like a .NET framework. So Microsoft copied Java with C# the JVM and added multiple languages. Then Sun comes back and added multiple byte code compiled languages. And then they both focus on dynamic engines to implement versions of Python, Microsoft doing this within their DLR.

Many times the larger market languages that end up running business or “enterprisey” are heavily influenced by companies, in addition to the other demands from consumers, which here is programmers. So when the big three are all banking on Python as a draw there is a definite market draw there and a tell on the future. But I think it is apparent that Python is becoming a standard market baseplane language.

It is great to be able to use other libraries from .net with IronPython and java libraries with Jython. It has found a way to integrate with the current infrastructure and the language has low bar entry but deep benefits. Python is snaking its way into the market.

Python is so non verbose…

import sys
import clr
from System.IO import Path, Directory, FileInfodir = Path.Combine(sys.prefix, 'DLLs')

if Directory.Exists(dir):
    sys.path.append(dir)
    files = Directory.GetFiles(dir)
    for file in files:
        if file.lower().endswith('.dll'):
            try:
                clr.AddReference(FileInfo(file).Name)
            except:
                pass

This sample is from IronPython showing adding dynamic references to all dlls loaded.

Check out this HTML/XHTML parser in pure Python.

from HTMLParser import HTMLParserclass MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print "Encountered the beginning of a %s tag" % tag
def handle_endtag(self, tag):
print "Encountered the end of a %s tag" % tag

Code Generation != ORM, Code Generation IS for the Code Generation

Friday, February 22nd, 2008

Code generation is not ORM (Object Relational Mapping). ORM is not code generation.

These are two separate ideas. ORM is part-of code generation but code generation is super to ORM.

I get in discussions with people that are strongly against ORM mostly due in part to Jeff Atwood’s post that ORM is vietnam. Yes it can be, and ORM is only for highly tailored teams and projects and creates bulk and uncontrollable code bases. BUT, code generation is valuable and here to stay.

Code generation can be a templating system that outputs code that exactly is the way you would write it and generate unit tests, db field mappings, basic skeletal architecture, maybe a data layer that accesses tables and views or any one of those things from a custom, open source, standard or commercial templating system.

Code generation can also be macros, db migration processes (SSPI or DTS or PL-SQL or n), adding a new file in yoru IDE (VS.NET/Eclipse/FD templates), configuration files, refactoring tools, and many other things. Code generation is a part of life for a programmer or engineer. In fact if you dont’ start getting a handle on the code generation systems that are evolving then you will be that much more without a solution when platforms advance.

Code generation can also be team building because many times people against code generation are hand coders. This is fine and this works great for one programmer. When you add programmer++ to any single team all of a sudden “styles” come into play. Code generation and basic framework or API code structures should be similar in a team environment so that others have a base layer of knowledge they can get up to speed on. Code generation brings the style battles and architecture to the forefront on how code should look in an organization. As you can imagine when you give 50 architects or developers the lead, you will get 50 different was of doing things, some good, some bad. Code generation ensures at least a basic structure of code and apis that can be used. Team integration is hard, code generation usually goes hand in hand with this if it is as small as new file templates in an IDE or a macro all the way to entire api framework generators.

It is important that code within the same project look and act the same. Same styles, same conventions, same architecture. One way of settling this is having code generation that everyone agree upon that can help at least structure projects the same, even if implementation and behind the API layer things are like the wild wild west.

Code Generation > ORM

Code Generation is usually guilty by association. We are hoping to change the perception, but again code generation is really only needed when you get beyond the single programmer mindset, or when you start to make a product family or open source.

Code Generation != ORM, Code Generation IS for the Code Generation

XML Loved to Be Hated, Deserves Some Respect

Thursday, February 21st, 2008

XML is railed against plenty these days for being too verbose and leads to massive config invasions in your codez. But it deserves due respect for what it did.

What did it do you say?

Well, there was a time when data services rarely existed, connecting to trading partners or business partners was almost impossible. Connecting with partners directly to their RDBMS which is poor coupling and is not as message based as services.

Before XML was accepted it was a pipe-delimited, tab delimited, column delimited, ini file, proprietary binary serialization, locked down, non sharing, no service type world. It was the dark ages of data sharing. Hate on XML all you want, XML opened the doors.

Then comes XML, the executives and CTO magazines flooded with the term XML and large budgets signed on the word alone. But was it all hype or did it do something amazing? XML Amazing you say? With XML it was so simple it gave people no excuse not to open up information. A flawless victory on data nazi attitude. Is it the best, no, but it did what was necessary. We would not have the service based systems we have now of even JSON or other more micro formats at all if it weren’t for XML. Both HTML and XHTML and XML are all responsible (javascript as well and MIME) for delivering the simplistic base platform which all programmers can write to to instantly make their apps standard, the web and services that live on them.

After XML… Yes, XML did the amazing… It freed data into services. The web was also instrumental in this effort itself but when systems started working so closely together the exchange and mapping of data quickly became troublesome. Before web services emerged, client/server, remoting, RPC or other more closely coupled communication connections ruled the day. XML with web services helped to push the service model in addition to other technologies such as SOAP bloated but XMLRPC, REST, JSON, have emerged in stronger force or late because they are better iterations and less enterprise-y and simpler and more compact but I still believe that XML was in large part a tool that made data so simple to share that the capabilities and costs came down when people wanted to expose this data.

XML deserves to be a baseplane technology and is used where appropriate in baseplane tools and toolkits.

XML is recently 10 years old, seems like the average for standards to truly take hold and influence. Same with CSS, XHTML, the DHTML that later became AJAX and javascript kits of today. They are all stepping platforms.

What is a baseplane?

Thursday, February 21st, 2008

baseplane: In software development, a set of tools, systems, patterns and designs that allow a system to be easily transferred to many back ends, services or front ends using standards, patterns and ideally non platform specific tools. Typically the baseplane includes both open standards and market standards based on industry usage. A baseplane may also be a way to commonize output to allow better designer and developer production.

A baseplane is a word I termed to describe the current, most technologically advanced set of tools and patterns that are usable across all major programming platforms.

The idea is that a company or programmer is sometimes held hostage by a particular platform or developer mindshare. People loving a good competition boast about platforms over other platforms and how one is better than the other. It is all fun and games but it doesn’t really give you the ‘best’ patterns and solutions. By patterns I mean general patterns not design patterns specifically for OO programming.

The ideal situation is where software is built semantically and from user perspectives with simplified enterprise entities and collections that perform top notch in a data store, no matter the platform or the language used to create it.

That is where true solutions begin, when companies and individuals can use the best platform or framework no matter their legion. A baseplane is a way to create systems that work well in many systems.

For instance JSON is a great example, this allows a layer to make back ends any language and then the front end any presentation from apps, to web to flash to whatever.

There will be more on this but the tools on this site all have this in mind.

Baseplane Tools: OpenSocial Wrappers and Add-on Services

Saturday, February 16th, 2008

Markets of many things have a period of innovation and experimentation opensocial.jpgthrough normal human trial and error, record response, adjust feedback loops. Over time, certain market standards emerge.

For social networks these market standards are profiles, friends, messages, blogs, pictures, and other custom handlers. OpenSocial has emerged late 2007 and is a great example of where after a period of time, a standard baseplane platform emerges and makes it another stepping stone to a further period of innovation and experimentation through normal human trial and error, record response, adjust feedback loops by combining and allowing a protocol to expose and consume data for OpenSocial. This could help many smaller or quickly developed communities get setup quickly, and it will also create social network giants that own the data. OpenSocial from Google was released after Microsoft signed with Facebook. Google came back with OpenSocial that got lots of attention and respec, also a move for Google to own the information and data standard. Then Facebook got forced to open up the apis to provide almost the same functionality, but no OpenSocial. Sometimes you need toolkits that will help to talk to both systems or many more pluggable ROM generation kits that allow you to integrate into these services such as blogging has the metaweblog apis and do most communication in a RESTful or XMLRPC based standard communication. It has allowed many blogging tools to integrate and help proliferate the platform and the companies involved in constructing it such as Wordpress (Automattic), MoveableType (SixApart), etc. There is great value to having open standards and market standards that allow the platform to flourish.

The baseplane code generation BOM (baseplane object mapper) has a ROM (rapid object mapper) both in development that can map your objects or existing applications to share along the OpenSocial standards (roadmaps and tests coming soon). We have many more ROMs that allow layers to be added to your code generation and custom manipulation of that work that have been built after 12+ years of experience in enterprise development. The great thing is the ROMs are custom, meaning that they follow your coding style and how you want things. None of this dictator like ORM systems, this is the reverse to that. They can integrate with existing code and they are not THE platform, they help you shape one though. More on this as the BOM is dropped.

The good news is more platforms are emerging, the bad news is there is much to learn and become an expert on.



baseplane - technology platforms is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

© 2006-2008 Ryan Christensen - template by drawk }}



Unless othewise specified the content in this site is licensed under a Creative Commons License
Your Ad Here Your Ad Here Your Ad Here Your Ad Here