jump to navigation

GPL Thoughts May 11, 2016

Posted by PythonGuy in Licensing, Uncategorized.
Tags: , , , , , ,
add a comment

It’s 2016, and the GPL is once again on my mind. Broadly speaking, there are three types of licenses out there.

  • Free Software, which is software licensed such that it will always remain freely available and open to modification. As a side-effect, it will “infect” other software that uses it such that it becomes free as well.
  • Open-source Software, which is software licensed such that it can be freely shared or modified, but it doesn’t “infect” other software.
  • Proprietary Software, which is software licensed such that it cannot be freely shared or modified.

There is a fourth type, but it barely deserves mentioning. “Public domain” software, which is software that is practically dead.

When Stallman came up with the GPL, his interest was to fundamentally change the way we write, use, modify and share software. In order to accomplish this, he set into motion the following plan:

  1. Write some good software and freely share it, but make sure it cannot be part of any proprietary software.
  2. Write more good software that competes against and replaces proprietary software.
  3. Eventually, it won’t make sense to write proprietary software anymore, because all the good software is free and nobody expects to pay for software.

According to Stallman’s plan, we’re very deep into 2 and well on the way to 3.

The question that inevitably arises, “How do developers get paid?” is forefront on my mind. After all, I write code so that I can get paid. (I would probably write code otherwise, but not nearly so much.)

So how can I get paid for my work?

Truth be told, I make more money from supporting software than anything else. It’s very rare that I get to write entirely new software, even when I’m working on a software project. Most of the time, I am fixing already existing code, or adapting it to some purpose, or more likely, testing it to see if it actually does what we think it does, or just to figure out why it doesn’t do what I want it to do.

The tools that I use are almost all GPL. Or rather, if all of my tools were GPL it wouldn’t hurt me in the slightest. In fact, it would make my life a lot better.

But then how do I make money?

Simply put, people still want software to be written, and it isn’t unheard of to have people pay me to work on open source projects. It isn’t unthinkable that I could be hired to work on free software as well, if there was a great need for that. There are not a few developers who are already being paid by private companies to do that.

The big question then isn’t, “How do individual developers get paid”, but “How do we convince people to pay for software development work?” The answer is when there is a need, people will pay. Sometimes very large sums of money.

The proprietary model doesn’t make any sense anymore. Proprietary software is an agreement that looks like this. “Give me your money, I’ll take it and I’ll give you software that you can’t look at or modify. If you like the software, keep giving me money. If you want to make the software better, beg me to do it for you.” That just doesn’t fly.

I think we’ll see companies that arise that hand out their software for free. In exchange, they will get paid to modify the software or to teach people how to use it. They may also get paid to adapt the software for a particular environment. Thus, the value in a software company will not be the software, but the developers and the ability of the company to apply the software to solve problems.

This, to me, is tremendously encouraging. If this vision comes to pass, I won’t be hired to write software and fired when I finish. I’ll be hired to staff companies so they can say, “Whatever you need done, we can do it, provided you can afford our developers.”

The GPL really is the way forward, and free software is the only good solution out there.

 

 

 

Advertisements

Shared Memory and Python May 10, 2016

Posted by PythonGuy in Advanced Python, GIL.
add a comment

I’m researching shared memory and Python right now, because it seems like the only hope for a particular situation we are seeing.

Basically, we have a very high-performance web server that is designed to handle a large number of requests per second. At the same time, we want to be able to update the code that is used to process these requests, real time.

Our webserver is using microthreads (greenlets) and so it can only really do one thing at a time, even though it looks like it is doing many things. When we go to update the code, everything else must stop until the update is complete.

Obviously, we can use rolling deployments, but there are some particular issues we see with that. Namely, memory and resource management.

If we did “hard” rolling updates, we would have to turn off a node, taking it out of service. Then we’d perform the operation, and then add the node back to the service. This would take a non-trivial amount of time.

If we did “soft” rolling updates, we would spin up a new web server on a node, flip from the old to the new server, and retire the old server. This requires twice as much memory as we typically need.

Another option would involve shared memory. The code would be served from shared memory. When we’d like to do an update, we’d launch another process to create a new chunk of code in shared memory, then we’d flip from the old to the new code. This seems like the ideal option.

The problem is that Python only supports the most basic data structures in shared memory.

Perhaps there is a way to trick Python into treating shared memory as actual Python code, maybe by storing the code as an array. When we go to run the code, we load the code from the array directly into a function and then call it. I don’t know if that would work, or that any method would work, but I’m looking into it.

Suggestions welcome!

The Pastiche Test May 2, 2016

Posted by PythonGuy in Uncategorized.
1 comment so far

I found this article fascinating: The pastiche test

The idea is sound, and I wish I knew what it was called before he named it, if it had a name.

The idea is this: Can you implement core language features in the language itself? That is, can you write something that would do the same thing as “if” using functions or whatnot?

There have been more than one occasion where I would have like to have had access to, or be able to replicated, some of the core features of Python. If Python completely passes the pastiche test (and PyPy is proof that it can), then that would not have been a hurdle.

Lazy Evaluation by Default May 2, 2016

Posted by PythonGuy in Uncategorized.
add a comment

I’ve been thinking a lot about a programming language idea I had where function calls do not execute the parameters before hand. It sounds interesting enough but I think it’s not anything new. It’s a style of programming called “Lazy evaluation”.

It works like this.

Normally, you’d have code that looks like this:

a = 1 + 1

b = a + 1

and you’d expect the following operations to occur:

  1. Add 1 and 1 (2)
  2. Assign 2 to a
  3. Add 2 and 1 (3)
  4. Assign 3 to b

With lazy evaluation, none of the above happens. Instead, this is what happens.

  1. Assign a to “1 + 1”
  2. Assign b to “a + 1”

Note that none of the addition operations are performed. Instead, if you wanted to get the value for b, you’d have to tell it, “Calculate your value.” In which case, the following sequence of events would occur:

  1. Calculate a.
  2. Calculate 1 + 1
  3. Calculate 2 + 1

Note that this demonstrates how you can nest lazy evaluation.

A beautiful aspect of lazy evaluation is that values that are never used are never evaluated. This can be a problem when you consider functions that have side effects. If there is a value that depends on the results of a function with side effects, that function will never get called and those side effects never manifest unless the value that depends on the function is evaluated.

But this can actually be a benefit. Remember how when you do “a or b” on Python it doesn’t evaluate b if a is True? This makes the “or” and “and” operators behave something like “if”. That is, don’t execute an entire branch of code if you’re not supposed to.

Just a thought at this point. I might try writing some pseudo-code to see how it all works out.