Sunday, May 24, 2015

Has the Time Come for Software Cooperative CUs?

As we were departing php[Tek] 2015 last week, I asked my fellow attendees where they were heading. "London," replied Derick Rethans cheerfully, to which I replied with mock seriousness "Ah... that's a long drive." The look of confusion on his face told me that a crucial element was missing from the conversation - he didn't know me well enough to tell that I was joking. Open source is a lot like that. It can be difficult for small businesses in particular, to distinguish between technologies - and technologists - that presented a lasting opportunity, and those that had the potential to fall flat and kill a business model in the process. At php[Tek], as with most of the grass-roots conferences I've attended over the past decade, I recognized an emerging phenomena. It may not be so much a trend as a series of pieces falling into place in the economy and the community at large. Similar to what must have preceded the establishment of Credit Unions in the 1850's, there is an increasingly undercapitalized population relying ever more on applied software technologies. Open Source was a major component falling into place, not merely because it made certain software technologies cheap, but because it democratized access and learning about managing the technologies. Much in the same way, Credit Unions made it possible for individuals and small businesses in impoverished communities not just to self-finance but to learn to oversee and manage their own growth. Regardless of how accountants see software, creating and curating it is a primary factor in the success or failure of modern business operations. Yet even for those that are technologically skilled, the tangible and intangible capital costs can overwhelm the ability of any one business to maintain. Again, Open Source helps by lowering costs and making acquisition of skill levels feasible. Yet even Open Source can present too high a cost of adaptation and configuration management over time. What Open Source does not yet do, and seems to be about to do, is provide a way for neighbors in the technology community - providers and consumers - to secure the future of a software technology together. That is, I think formal cooperatives, or "Software Credit Unions," are about to emerge from the economic primordial soup we call the Market. Many if not most of the core technologies already have found homes in foundations, consortiums, non-profit charities, and public corporations. That's not what I'm pointing out. The applications of these technologies, which provide real value to business process stakeholders, are assets that are frequently constructed with non-trivial personal or business funding. A cooperative form of business would provide pooling of the capital investments, sharing of risks, and amortizing of maintenance costs and risks for members, as well as avoidance of "razing" of small intellectual properties when such small businesses close. If such organizations were formed under the same kinds of fiduciary ethics and practices as a credit union, it would be a boon to the future of technological small business clients and open source contributors alike. It would help define financial and legal standing for popular projects, help quantify the value of contributions, and support necessary but otherwise marginal projects for their members. A cooperative form can also help ensure that peer-review processes (already a part of open source culture) are enforced to members' quality standards and not to requirements of some ill-conceived third party. Software has already irreversibly infiltrated our lives. I don't think it is even possible that cooperatives akin to software credit unions can be avoided. It is happening now. The question is not "if" organizations that hold our software assets will exist. They do now. The question is whether any such organizations will hold a fiduciary role for consumers and producers alike as a membership organization in a credit union model, or leverage us all at a disadvantage like a bank.

Monday, May 4, 2015

Dangerous Domain Vocabularies

A very smart young colleague at work has been introducing us to concepts of CQRS, Event Sourcing, and Domain Driven Design (DDD). One of the more prominent values held by DDD is the pervasive vocabulary used by Domain Experts - ubiquitous language is considered to trump any other technical constructions.

As well it should, at least in established disciplines and where the business actually has resident expertise available. Even where inexperience is greater than the expertise, one still wants the professionals who are tasked with the responsibilities for the business outcomes to have a sense of ownership of the language.

But there are fallacies of belief that can be assumed as well:

  • Belief that a comprehensive domain language exists when it is not even a well formed vocabulary.
  • Belief that the semantics behind nascent language idioms are grounded, when they are cliches or abstractions derived from historical accidents (that is, legacy systems and environmental conditions that no longer exist). 
  • Belief that concepts of a domain model are part of some sort of mathematical reality that objectively exists above our own, unchanging and merely in need of discovery.
  • Belief that the ephemeral quality of language is not a significant factor when individuals move in and out of the domain.
  • Belief that the terrain of the problem space is substantially stable over the expected useful lifetime of the model.
  • Belief that domain experts' language never involves idiosyncratic forms that are self-inconsistent within a single bounded context.
It is the last bullet item that got me to thinking on this topic. A laboratory technician was describing to me a small dispute over a protocol in her lab one day. Two technicians were following two different procedures for diluting liquid samples. The terminology they had adopted was, for instance, to say that they were preparing a "one to three dilution".

It is more commonly expressed as a "dilution ratio of 1:3", and therein lies the problem. One tech said that means mixing one part of a solute to three parts of a solvent, and the other claimed (apparently consistent with the procedures used in the profession) that it means mixing one part solute to two parts solving and giving three parts of an admixture. The vocabulary, having been neglected and forgotten by many of the practitioners, is no longer clear.

Mathematically, the ratio "1:3" is like a fraction 1/3 and most people would think of "one part of something to three parts of something else" at the same moment in time. The lab professionals, meanwhile, have adopted an idiosyncratic interpretation, assigning "1" to the "something" and "3" to "one something plus two something elses" - that is, they compare a variable in a one step to a dependant value resulting from a subsequent step. 

Consider this:
Step 1: take 1 part salt
Step 2: take 2 parts pepper
Step 3: mix salt and pepper

The result of Step 3 is a salt-pepper admixture of roughly three volumes, or a 1:3 dilution of salt in pepper. But mathematically the 1 and the 3 are different units, 1 being a unit of salt and 3 being a unit of (1 salt + 3 pepper). The reality of the process is, further, that the entity described by the 3 doesn't exist until the entity described by the 1 and a derived value for an entity which is not made explicit are combined. That's like telling a cook how to bake a pie with an ingredients list that omits the filling and includes the whole finished pie itself. 

And don't think this is a trivial thing. People have no doubt died over the misunderstanding and confusion brought on by this one shitty little idiosyncrasy. 

Wednesday, November 12, 2014

Version Control and Codependent Relationships

In the midst of others' conversations at a dinner meetup recently, I asked one quiet young designer/developer sitting across from me where she was from.   She mentioned her home state, and that she worked for a certain marketing agency in that area. Furthermore, she offered with a hint of wistfulness, an ironic observation that they were a leading agency with a huge backlog, they were not up to speed with modern software development practices such as version control.

I also heard an undertone of fatalism, and frustration about how to communicate, and I'd heard that many times before. Particularly in Web Design as an art, modern software engineering practices have only begun to really take root and infiltrate as a professional practice. This is because only recently have Web Designers begun to recognize themselves as serious software professionals. 

That is not to say, that they weren't serious before. Or that they weren't software developers. It is just that in their daily practice, their brains had yet (and to some extent have yet) to converge on a common cultural recognition that they are professionals with a professional discipline.  

There are many reasons for this:
  • personal immaturity - a person is "just not there" yet, and may not see the value in reinvesting effort in skill building
  • "fire fighter" mentality - fire fighters don't have to be concerned about building structures, they just try to keep the flames at bay
  • stress - people who feel under the gun have much less presence of mind for reflection, self-improvement, or process improvement
  • management reactivity - this contributes to stress too and IMHO is the most important root cause in a small business environment

Management Reactivity

The young developer mentioned that the idea of version control prevalent in their office was to yell over a cubical wall and say "Hey, I'm going to edit FuBar.html, is anyone else editing it?".  Yet this isn't even a rudimentary version control such as copying to snapshot folders or renaming .bak files - it is just a verbal form of a semaphore. 

The reason for this immaturity of practice? Ostensibly, it is that they do not have the time to pick up a new practice and put it in place, while also getting the backlog worked on.  

The root cause is reactivity in management. I do not mean "knee jerk" reactions, although that is a visible sign of reactivity.  It may alternatively be that management is poorly trained and possibly even incompetent. By reactivity I mean any practice that undermines a continuous improvement process by constantly misaligning the goals and the actual values expressed to the team. 

Lumped together, you might just simply say it is bad management. Other signs:
  • the company does not allocate a sufficient amount of resources for continued professional skill building
  • calculated risk taking is discouraged; the level of proof required to bring in new techniques or technologies is set higher than the level of proof required to keep the existing known poor practices and technologies with persistent defects
  • supervisors are not actively contributing to work output, but are all mere overseers
  • heavy emphasis on documentation in planning, with little reference or use of those documents by the team performing the work
  • frequent use of the word "just," "only," or other hedging language that diminishes the cost/effort/time/importance/complexity/thinking required to move forward in a sensible direction
  • "Continuous improvement" is a cliche used often, but with no practical path of allowing developers to start moving down any path that changes the toolchain or tactics.  


Now, here's the thing: that developer is young and that developer is smart,  so that developer has the power to effect change. Period. And that should be the End of Discussion.

But it isn't the end of the discussion. That developer is also inexperienced and is fearful or at least risk averse, and it is the employer who has the money. There is a real power imbalance when the developer sees herself as the one who needs the money more than anyone else needs her skills. 

By postponing skill building, the developer puts herself in a position to be used reactively. 

By foregoing process and technology improvement - and suppressing the adoption of modern software practices - the employer keeps the developer in a co-dependent posture. 

The tactics the developer learns to deal with problems reactively are employer-specific, and thus much less non-transferrable. At best, they fail to make the developer more attractive to another potential employer.   The employer can pay a co-dependent developer less, because the developer lacks confidence and lacks opportunities. Modern practices, on the other hand, make the developer more attractive to competitors and helps equalize the balance of power. 

You get the idea. The sad thing is, co-dependence hurts all parties in a relationship. The employer will fall behind competitors, and so will the employee. 

Sunday, August 3, 2014

Namespaces in Ruby

Ruby is a very plastic language. By plastic, I don't mean "fake" but easily manipulated.   I was considering namespaces, as they are in PHP and a number of languages derived syntactically from C:

namespace \MyOrg\MyDomain\MyApp\MyPackage\Foo;

I was thinking of Ruby. In Ruby, there is no single namespace declaration; instead, the language provides a Module construct to more-or-less accomplish the same goals. The difficulty being that Module is rather more syntax than less.
Poking around Google, I came across this little gist in which Justin Herrick describes how he made a short DSL to have a nice brief Clojure-like syntax:

ns 'MyOrg.MyDomain.MyApp.MyPackage.Foo' do
   def fluggelduffel

Herrick's solution takes advantage of Ruby's seemingly limitless ability to modify the module environment. And it works, with one limitation: constants referenced in a method like fluggelduffel, or anywhere in the do block for that matter, throw a NameError unless const_set is used:

ns 'MyOrg.MyDomain.MyApp.MyPackage.Foo' do
   def fluggelduffel
      puts A

I played around with the code a bit to add an options hash:

ns 'MyOrg.MyDomain.MyApp.MyPackage.Foo', {  :constants=>{ :A=>"FUBAR" } } do
   def fluggelduffel
      puts A

The code simply calls const_set in a different place. The constant A is there in module Foo, but it isn't visible in the lexical scope in which puts is referencing A. We can address A explicitly via MyOrg::MyDomain::MyApp::MyPackage::Foo::A, but how ugly is that? We can also use const_get('A') but that is pretty ugly too.

The problem is that bare references to constants are resolved in the lexical scope in which the block was created. It has nothing to do with the scope the constant is defined in. What to do?

There isn't a lot that can be done. If you're using unqualified constants, that's pretty ugly in itself... polluting your code with global references and all. If you really need that (dis)ability, const_get('A') follows the nesting chain all the way up. I've found that self::A works fine for the globals I've defined locally using const_set, though I'm uncertain if there are any side-effects or weird interactions. In this way, constants can be defined dynamically, and attached to the initial namespace definition.

Saturday, August 2, 2014

HTML is BAD, and YOU SHOULD FEEL BAD for using it

No, I don't really think this, but that's a catchy headline, isn't it?

On the other hand, there is a part of me that thinks that HTML represents a sort of dishonesty, a kind of technological plagiarism. 

The Not Invented Here (NIH) reinventing of wheels often the standard of practice across the business world - reinforced with Intellectual Property portfolios and litigation. Technologists thrive on NIH. The behavior may be simply in part because technology oriented humans just enjoy tinkering with something we perceive as being new. 

It is further promoted by broad based illiteracy among practitioners. The Internet helps people self-educate, but as masses of people learn rudimentary basics of programming they are apt to stop when they learn just enough to be dangerous, that is, just enough to earn some money from a skill. Those with any real interest in the science will be doomed to wander through parts of the discipline that were already-well-explored decades ago. 

Yet the most corrosive aspect of NIH on platforms-substituted-as-standards such as HTML is intellectual dishonesty. The same kind of intellectual dishonesty that pervades business advertising, the posturing of vendors towards clients in fixed bid contracts, and that lawyers and politicians seem to consider acceptable in love and war.  Even if they were self-aware of their own agendas, they would not admit to it; and it corrupts both the culture and the outcomes at once. 

Don't get me wrong. Society as a whole benefitted greatly from the worse-is-better approach embodied in HTML. The world's peoples gained experience in a domain previously occupied by a few brave geeky souls. We got cool toys and new ways of doing medicine - and innumerable other unspeakable benefits from exploring the space with just enough technology, even if it was a bit broken. 

The problem space will eventually press in on the field. We see pseudo-standards such as micro-formats and Web Components competing to represent multiple parallel domains of information in HTML encoded resources. Technologically, they are neat, and I have little doubt that they serve to further the interests of Google and various social media manipulators. But they also work at cross-purposes to the original intent of markup, which is to represent information with integrity and to make it accessible and open over the long term for all stakeholders.   

As people move forward with Web Components, I'm reminded that XML offered us the ability to use our own tag names to represent information content. A Web Component can be designed in such a way as to be a Graphical User Interface widget, but the higher usage is to use it to isolate or entirely occlude for-the-Browser behaviors with elements that express only the problem domain's semantics. Otherwise, we're just back to writing 4GL applications again, and we did that back in the '80s. 

Tuesday, July 29, 2014

URL Bending

URL means "Universal Resource Location", and thus named the construct finds much use as a substitute for a lot of structures, many if not most of which have nothing to do with resource locations.

When any term such as a URL gets assigned multiple meanings, whether these are different people's interpretations of the same purpose or the usages originate as means for different ends, that term becomes a homonym. 

In the context of Web applications, we're told that a URL does just one thing: locate a resource. But the "universal" constructs that URLs attempt to address via a one dimensional string, are multidimensional and contain subspaces that link pervasively between one another.  We are faced with many purposes, many decompositions of the data, many formats, many relationships, and so on... and somehow all those facets are supposed to be encoded as a single human readable identifier. 

Even on something as conceptually straightforward as a topological map, we use discrete coordinates to differentiate the dimensional components of an address. More generally, an address is an N-tuple. That N-tuple can (or must) be represented as a string, but the representation does not usually utilize nesting or containment - the primary dimensions are orthogonal and vary independently of one another.  Yet in a URL most often the string is read left-to-right, and path segments form an implicit hierarchy. Or they don't. There is no single interpretation that is actually canonical in the sense that everyone actually follows it.

Here is, syntactically, where URLs break down: we cannot both, at once, infer hierarchy where it was intended to be implied and not infer hierarchy where it was not, without overloading the URL with a one-off domain specific syntax.

So we see a proliferation of syntactical forms appearing, starting with "?query+parameters".  We argue over meaningless forms - should it be /new/user or /user/new or /users (PUT) or /user (PUT) or whatnot - and the amount of argument is inversely proportional to the triviality of the distinctions to be made. A sound, common grammar is a necessity.

A URL isn't really an address in a sense analogous to a cartesian coordinate. It is a parameter binding. In trying to represent multiple twists and turns by way of a single mangled string, in effect we are tying a knot. Or a bend or hitch, if you will, depending upon the object and subject being tied. The moves in tying this knot form a sort of grammar, which for lack of a better term and because it sounds like binding, I'll call "URL Bending".  For reference, a bend is a knot used to join two or more lengths of rope. 

A grammar for bending could be formalized, I suppose. We would need to grok the distinct dimensions along which resources are addressed in various bounded contexts represented in the solution space. (Determining open addressing models is a heavy focus of ISO/IEC 10744:1997, aka "HyTime".) We would need to grasp whether those bits should be included in the knot tying, or should more opaquely be mapped to components of the transaction concomitant with the use of the URL, like the HTTP method or POST or PUT content payloads or HTTP headers. 

Monday, July 21, 2014

Separation of Concerns

If you are a developer and you work long enough on business applications, you start to sense the corrosive effects when divergent interests and viewpoints are forced into a single representation.

It may be a vague suspicion - a code smell. You don't necessarily know precisely what those conflicting concerns may be, or why they were conflated in the first place, or the possible consequences of trying to separate them. But you know that a valid stakeholder concern can be addressed only if is identified. Separating concerns is a necessary, but not sufficient, step in the right direction.

The volatility of your codebase - the rate at which changes tend to grow - depends on how well matched the codebase is to the concerns it seeks to address. If the code tends to cover a mere fraction of one concern with each coding unit, its volume will blow out and thus also the difficulty of managing all the moving pieces.  If the code tends to cover many concerns in a few monolithic coding units, it may be too terse for a human to sensibly and reliably decode and have so few points o articulation that the simplest of local changes gives rise to a cascade of far reaching fissures.

Cohesion is the term often used to describe the continuum between these extremes, but the success of biological systems calls this dogma into question. Cohesion is neither necessary nor sufficient for a dynamically stable, long-running, self-maintaining system; so I think it is not really necessary or sufficient even for our crude software approximations of real world processes.  A better metaphor is the optic system, principally the concept of focal length.

In optical systems, the focal length is a measure of how strongly a lens bends light, determining among other things the magnification and angular field of view. It also influences the degree to which an image blurs when cast upon a surface parallel to the principle plane of the lens. When the distance is just right, the projected image is sharp and all detail is to scale. When the distance is too close and/or too far away, the projected image is blurred and/or skewed.

Being cohesive isn't enough. A coding unit that does not represent an optimal fraction of concerns is either out of focus, skewed, or both blurred and skewed.