How to get a certificate signed by multiple certification authorities
Sort of. Here is a way to do it, but I don’t a practical use for this hack right now. But it is fun anyway
Here we go!
I was thinking about ways to distribute trust, and played a bit with CA generation and OpenSSL, when it occured to me: it depends more on a key pair than on a certificate! If I consider that I trust a key instead of a certificate, I begin to see a way (certificates are only restrictions on the trust between keys).
It is really easy to get multiple certification authorities to sign a certificate for the same key (even for the same subject name in some cases). You send the certificate signing request to two certificate authorities, and you get two certificates, for the same keys and same subject names. But the issuer, dates, serial and signature are different. That’s why a certificate has only one certification chain.
But what will happen if I delegates the certification to another key? Here is the idea:
- create a first key pair
- create a CSR for this key pair, and add the certification authority extension
- ask the certification authorities to sign this CSR
- you now have multiple certificates, for one key pair, all of them with the same subject name, and with certification authority powers
- create a second key pair
- create a CSR for this key pair, with a subject name for your email/domain name/organisation/whatever
- sign this CSR with the first key pair, and any of the CA certificates you obtained before
You are now the proud owner of a valid certificate for your domain name, with multiple certification chains going up to each of the root CAs. Why? The issuer’s subject name and public key is the same for all of the generated CAs, and they’re included in the end certificate. Any generated CA certificate can be used to verify that signature, and all the certification paths will work. Cool, huh?
Okay, but…
- Creating a sub CA is very expensive (if you want it to be recognized by all the browsers)
- good luck with creating multiple sub CA and getting away with it
- Assuming that certification authorities accept it, the sub CA private key could be thrown away after signing the certificate. But who will create and delete the subCA key? you, one of the CAs?
- In the case of TLS, serving all the certification chains will have no impact: the browsers take the first matching sub CA in the list for the verification, they will not retry with another sub CA if they don’t find a root (but if you serve one certification chain at a time, it will work).
See, I said “no practical use”
Jtalk on Rails: editing Javascript in my browser
If you don’t know JTalk yet, you’re missing something. It’s an awesome piece of work: a Smalltalk to Javascript compiler and a Smalltalk editor running in Javascript, IN YOUR BROWSER! Go check it out, now!
Now that you’ve played a bit with JTalk, let’s get started.
If you’re like me, you’re a bit annoyed by WebDAV, the proposed solution to save changes to disk. And if you’re like me, you would like to use Jtalk with Rails, and because you’re a lazy ass like me, you use WEBrick instead of Apache for your development.
Let’s hack something up to replace WebDAV!
Create a Rails application
rails new jtalkonrails cd jtalkonrails bundle install rm public/index.html rails generate controller home index printf "Jtalkonrails::Application.routes.draw do\n root :to => \"home#index\"\nend\n" > config/routes.rb
(I should really make a script out of all my rails initialization commands, one of these days…)
Add Jtalk to your application
cd public/ wget http://github.com/NicolasPetton/jtalk/tarball/master --no-check-certificate tar zxvf master cp -R NicolasPetton-jtalk-20cd63e/st . cp -R NicolasPetton-jtalk-20cd63e/js . cp -R NicolasPetton-jtalk-20cd63e/css . cp -R NicolasPetton-jtalk-20cd63e/ide . rm -rf NicolasPetton-jtalk-20cd63e
JTalk stores source code in three forms: Smalltalk code, Javascript code and smaller Javascript code (“*.deploy.js”).
Jtalk hello world: the Counter example
now, edit app/views/layouts/application.html.erb so that it looks like this:
<!DOCTYPE html>
<html>
<head>
<title>Jtalk On Rails</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<script src="js/jtalk.js" type="text/javascript"></script>
<script type="text/javascript"> loadJtalk()</script>
</head>
<body>
<button onclick="smalltalk.Browser._open()">Class browser</button>
<div id="counters"></div>
<script type="text/javascript">
jQuery(document).ready(function() {'#counters'._asJQuery()._append_(smalltalk.Counter._new())});
</script>
<%= yield %>
</body>
</html>
Here, we included a button to open the code browser, and added a Counter in a div. Oh, I forgot to tell you: Jtalk works seamlessly with JQuery ![]()
Now, go check it out, and you will seee the counter and be able to increase and decrease the value displayed (yes, that’s a counter).
Editing the code
Click on the “Class browser” button to start the IDE. Select the “Examples” category, the “Counter” class, the “actions” method category, and the “increase method”. You will see in the text box below the source code of the increase method:
increase count := count + 1. header contents: [:html | html with: count asString]
Edit that method to increase by steps of 2 instead of 1, and hit “Save”. Now, the counter on your page will increase by steps of 2.
Unfortunately, on the next page refresh, you will lose these changes. That’s why the “Commit category” button is there.
It will take the updated files (here, Examples.st, Examples.js and Examples.deploy.js) and make a PUT request to their original URL.
A PUT, you said? Well, I can work something out with a PUT.
Saving the code
Let’s create a new controller, called Uploader:
rails generate controller uploader jtalk
And edit config/routes.rb as follows:
Jtalkonrails::Application.routes.draw do
root :to => "home#index"
if Rails.env == 'development'
put 'st/:id' => 'uploader#jtalk'
put 'js/:id' => 'uploader#jtalk'
put 'js/:id.:deploy' => 'uploader#jtalk'
end
end
Now the PUT requests are redirected to our controller, but only in the development environment. You do not want to make your JS editable from the browser in a production app. DO NOT WANT!
The only thing left is the controller itself:
class UploaderController < ApplicationController
def jtalk
path = Rails.root.join('public')
if(params[:format] == "js")
path = path.join("js")
elsif(params[:format] == "st")
path = path.join("st")
end
if(params[:deploy])
path = path.join(params[:id]+".deploy."+params[:format])
else
path = path.join(params[:id]+"."+params[:format])
end
File.open(path, "w") do |f|
f.write(request.body.read())
end
head 200
end
end
Here, we build the file path from the parameters. I use request.body.read() to get the file content because Rails seems to truncate the beginning of the file.
Profit
Now, go back to the web page, click on “Commit category”, and refresh the page. Your changes were saved! You can enjoy editing your frontend directly from the webpage itself, in the code browser, and more importantly, write your whole frontend in Smalltalk! It’s still missing the workflow “edit-try-debug-edit-continue”, but it already feels just like a “normal” Smalltalk environment. It feels like home
Post Scriptum
If you want to add a new category, it’s easy: create a file Mycategory.js and put it in public/js, with this content:
smalltalk.addClass('Myclass', smalltalk.Object, [], 'Mycategory');
and change your initialization from loadJtalk() to loadJtalk(new Array(“Mycategory.js”)). The new category will now appear in the code browser, and clicking on “Commit category” will create the deployment file and Smalltalk source file.
Manage your libraries with symlinks on Windows
My Windows development environment is a bit complex. I work on multiple projects, at multiple versions, with different compiler environments, and with dependencies on different libraries and versions of these libraries.
Now, how do I specify where the compiler must search the libraries, and which version to use? Most of the time, I will add it directly in the project configuration. Easy at first, but quickly,I find myself writing by hand the path to each library (and header) in each project and each configuration of this project. And then, writing by hand the different names of the libraries (mylibrary.lib, mylibraryd.lib, mylibrary-static.lib, mylibrary-MTD.lib, etc).
And when I want to update to a new version of the library? If I’m lucky, I just have to change the library and header paths (in every project using the library). If not, I also have to change the name, because of the library developer’s convention.
The first solution to these problems was to use a batch file to launch Visual Studio and MSYS, and set some environment variables in this file. I quickly ended up with one big file containing two environment variables (include path and lib path) per library, possibly more if there were some big changes in the library names. My Visual Studio configuration was cluttered with $(MYLIBRARY_LIBPATH), $(MYLIBRARY_INCLUDEPATH), $(MYLIBRARY_NAME). It is unreadable, and again, impossible to maintain.
My solution comes from the Unix world, where you have a correct organization for your development files:
- one folder containing the subfolders include, bin and lib
- library names including version, and a symlink (without the version number) to the latest version of the lib
Can I do that on Windows? YES \o/
Here is the trick: normal links on Windows won’t work, but the mklink tool can create symlinks. And Visual Studio will recognize those as files and folders while looking for libraries.
Now, how would I organize my development environment? I chose to use (and abuse) symlinks, to create include, lib and bin folders for each project and configuration, and use generic names for the libraries.
- I create a folder containing include, lib and bin
- in the include/ folder, I put symlinks to the header file or the subfolder for each library I will use in that project
- in the lib directory, I create symlinks to the library version I want, one symlink per static/dynamic, MT/MD, Debug/Release version. But I could create one lib folder per static/dynamic, etc. A bit complex, but feasible (most of the time, I use only debug and release version, so it’s still manageable).
With this setup, I only set the INCLUDE and LIB environment variables, and I use directly the library names I need.
Here is an example script I use to create different library folders for x86 and x64 libs:
echo "Building include and library directories for Windows %PLATFORM%" @mkdir %PLATFORM% @mkdir %PLATFORM%\include @mkdir %PLATFORM%\lib @mklink /D %PLATFORM%\include\boost %BOOST%\boost @for %%i in (%BOOST%\lib\*.lib) do (mklink %PLATFORM%\lib\%%~ni.lib %%~fi) @mklink /D %PLATFORM%\include\cpptest %CPPTEST%\include\cpptest @for %%i in (%CPPTEST%\lib\*.lib) do (mklink %PLATFORM%\lib\%%~ni.lib %%~fi)
I set up the BOOST and CPPTEST environment variables in another file. Then, I launch Visual Studio from another script which includes it.
There may be better ways, and that system will evolve in the future, but I’m pretty comfortable with it right now
Depending on my needs, I may grab from the bottom of my disk the package manager I wrote back in school, and make a big solution to download, build and link libs and personal projects. But later, I have some procrastination planned right now.
Rails and oauth-plugin part 2: the consumer
In the previous post, I showed how you could build a provider with oauth-plugin and Rails. Now, I will demonstrate how to build a consumer (it’s a lot easier).
I will assume that your provider is already running on localhost:3000. The consumer will run on localhost:4000 (run it with “rails server -p 4000″).
Here we go!
rails new consumer cd consumer
Put this in your Gemfile:
source 'http://rubygems.org' gem 'rails', '3.0.7' gem 'sqlite3' gem 'devise' gem "oauth-plugin", ">= 0.4.0.pre1"
And run these commands:
bundle install rails generate devise:install rails generate devise User rake db:migrate rails generate controller welcome index rm public/index.html
And here is your routes.rb:
Provider::Application.routes.draw do devise_for :users root :to => "welcome#index" end
Create the consumer
rails generate oauth_consumer user rake db:migrate
in app/controllers/oauth_consumers_controller.rb, replace:
before_filter :login_required, :only=>:index
by
before_filter :authenticate_user!, :only=>:index
Uncomment the methods for devise (go_back, logged_in? currentuser=, deny_access!) in app/controllers/oauth_consumers_controller.rb.
Add to app/models/user.rb:
has_one :test, :class_name=>"TestToken", :dependent=>:destroy
Now go to http://localhost:3000/oauth_clients/ to register your first application with these parameters:
Name: Test consumer
Main Application URL: http://localhost:4000/
Callback URL: http://localhost:4000/oauth_consumers/test/callback
You’re redirected to http://localhost:3000/oauth_clients/1. It shows:
Consumer Key: CRcIJ15MwSqlDTxsH8MpO3En4wjaOxkqeofLioH4
Consumer Secret: C7uci8xkyMShCf4SNXWPclKbBo3ml1Zf2W2XWu4W
Request Token URL: http://localhost:3000/oauth/request_token
Access Token URL: http://localhost:3000/oauth/access_token
Authorize URL: http://localhost:3000/oauth/authorize
Now, you need to put the key and secret in config/initializers/oauth_consumers.rb:
OAUTH_CREDENTIALS={
:test =>{
:key => "CRcIJ15MwSqlDTxsH8MpO3En4wjaOxkqeofLioH4",
:secret => "C7uci8xkyMShCf4SNXWPclKbBo3ml1Zf2W2XWu4W",
:expose => true
}
}
Create app/models/test_token.rb. This model will store the token for your provider. If you want to provide helpful methods, take inspiration from lib/oauth/models/consumers/services/.
class TestToken < ConsumerToken
TEST_SETTINGS={
:site => "http://localhost:3000",
:request_token_path => "/oauth/request_token",
:access_token_path => "/oauth/access_token",
:authorize_path => "/oauth/authorize"
}
def self.consumer(options={})
@consumer ||= OAuth::Consumer.new(credentials[:key], credentials[:secret], TEST_SETTINGS.merge(options))
end
end
You should now be able to use the URLs “/oauth_consumers/test/client/”, “/oauth_consumers/test/callback”, “/oauth_consumers/test/callback2″,” /oauth_consumers/test/edit”,
and “/oauth_consumers/test”.
Modify the welcome controller t get the provider data:
class WelcomeController < ApplicationController
def index
# cf http://oauth.rubyforge.org/rdoc/classes/OAuth/AccessToken.html
@consumer_tokens=TestToken.all :conditions=>{:user_id=>current_user.id}
@token = @consumer_tokens.first.client
logger.info "private data: "+@token.get("/data/index").body
end
end
To connect a user to an external service link or redirect them to:
/oauth_consumers/[SERVICE_NAME]
Where SERVICE_NAME is the name you set in the OAUTH_CREDENTIALS hash. This will request the request token and redirect the user to the services authorization screen. When the user accepts the get redirected back to:
/oauth_consumers/[SERVICE_NAME]/callback
That’s it
This tutorial is really short, and could be explained a bit more, but I’ll leave that for another post. You have enough to start tinkering with OAuth. Have fun!
Rails and oauth-plugin part 1: the provider
These days, I have been playing a lot with Oauth and its RoR implementation, oauth-plugin. Its documentation is a bit short, so here is a tutorial to show how to use it, both in provider and consumer mode. And we will even make them communicate with each other.
We will now build an Oauth provider using oauth-plugin for authorization and Devise for authentication. And we will add a controller protected by Oauth.
Starting up
A few instructions to create the application. You won’t need an explanation for this:
rails new provider cd provider
Put this in your Gemfile:
source 'http://rubygems.org' gem 'rails', '3.0.7' gem 'sqlite3' gem 'devise' gem "oauth-plugin", ">= 0.4.0.pre1"
And a few more commands:
bundle install rails generate devise:install rails generate devise User rake db:migrate rails generate controller welcome index rm public/index.html
And don’t forget ‘root :to => “welcome#index”‘ in config/routes.rb.
Create the provider
rails generate oauth_provider oauth rake db:migrate
You could put something else than “oauth” as parameter, but for the moment, the generator has some bugs (it always generate the class OauthController, but with a different name). I’ll check more recent versions of the code.
Now, modify config/application.rb and add:
require 'oauth/rack/oauth_filter' config.middleware.use OAuth::Rack::OAuthFilter
Put in app/models/user.rb:
has_many :client_applications has_many :tokens, :class_name=>"OauthToken",:order=>"authorized_at desc",:include=>[:client_application]
Put in app/controllers/oauth_controller.rb:
alias :logged_in? :user_signed_in? alias :login_required :authenticate_user!
and uncomment authenticate_user.
Put in app/controllers/oauth_clients_controller.rb:
alias :login_required :authenticate_user!
And now some data
Create a new controller:
rails generate controller data index
And now, edit your controller:
class DataController < ApplicationController
before_filter :oauth_required
def index
@data = { "coincoin" => "o< o<" }
respond_to do |format|
format.json { render :json => @data }
end
end
end
UPDATE
I discovered a few bugs in this tutorial, so here are the fixes.
oauth-plugin needs the function current_user=, so add this to your ApplicationController:
def current_user=(user) current_user = user end
Next, to handle revocation, you need to add this to config/routes.rb:
post 'oauth/revoke'
And at last, you need to fix the rack filter. The current code doesn’t verify the token validity, and lets revoked tokens access your data.
You have to modify lib/oauth/rack/oauth_filter.rb in the oauth-plugin gem folder.
Replace the line 46:
oauth_token = client_application.tokens.first(:conditions=>{:token => request_proxy.token})
by
oauth_token = ClientApplication.find_token(request_proxy.token)
And that’s it!
You now have a working provider. OauthController handles all the communication with the consumers. OauthClientsController manages the registration of new consumers. They both have customizable views: oauth for the authorization part (for users) and oauth clients for the consumers. And you just need the oauth_required filter to manage access to your data.
And now, you can go to /users/sign_up, then /users/sign_in, then /oauth_clients to register a new client application. You just need to give a name for your application, your URL, and a callback URL.
In the next post, we will build a consumer, and this consumer will access the provider’s data.
Yet another authentication scheme
Recently, I was asked to design a new authentication protocol for a web service. I know that I shouldn’t do reinvent the wheel, so I immediatly proposed OAUTH. It turns out that it can’t be used in this situation. Here are the constraints:
-calls to the webservice must be authenticated: I can keep the tokens and signature from OAUTH here. The problem is: how do I get that token?
-calls are made from devices or applications without access to a webbrowser (embedded devices, phones, etc.). The redirection dance of OAUTH is not acceptable here
-communications are done over an untrusted network, without SSL.
-I can’t use application keys and secrets to encrypt and sign the authentication process: clients include open source software and smartphone applications. You can’t hide a secret key in these.
-the protocol has to be simple to implement, on a lot of languages
-the server must not store the password in cleartext (I shouldn’t have to precise this…), the client must not store the password
Summing it up: no preshared keys, no browser, no SSL, untrusted networks, no passwords stored, and an OAUTH-like environment once the client is authenticated (tokens, authorizations, revoking, etc)
Apparently, I should just give up. But I like to play, so I’ll try!
First, I must say that I am not an expert in security nor cryptography. But I’m really enthusiastic about these subjects, and my day job is at a company providing strong authentication solutions (no, this protocol is not related to my day job). So, I know a bit about the subject, and I know that I should ask for reviews, hence this post.
Rough ideas
We need a safe communication over an untrusted network. TLS immediatly comes to mind, but the targeted applications might not have access to a TLS implementation. I’d like to use SRP, but I don’t think I’m able to implement it correctly (and it has to be SIMPLE). Using Diffie-Hellman to establish a shared key is another idea, but it is not safe against MITM.
Here’s my idea: we don’t need to generate a shared secret, we already have it. It’s the password!
But how can I use the password if the server doesn’t store it in cleartext?
The trick: key derivation functions
Decveoplers are finally understanding that they should not use MD5 nor SHA1 to store their passwords, even with a salt, because computing power is so cheap these days that anyone could crack easily a lot of passwords.
It is now recommended to use other functrions tro store passwords. The key derivation functions are a class of functions that create a key from a password. Basically, they do it by interating a lot of times. That makes them very slow, which is an interesting property if you want to stpre passwords: it is too expensive to “crack” the password. PBKDF2, bcrypt and scrypt are well known key derivation functions. They’re simple to use and available in a lot of languages.
With these functions, I can safely store the passwords, and generate a key shared with the client.
In short: if I store kdf(password, N) with N the number of iterations, I can send any M > N to the client and ask him to compute the key, without compromising what I store.
Designing the protocol
Now that we have a way to use a shared key, we can look at what will go over the wire to establish it. If I use directly kdf(pass, M), anybody getting access to the client storage will be able to obtain the key for any L > M. So, the key establishment has to use a nonce. That way, the client will only use the password once and forget it, and store the derivated key.
I would rather use a truly random key that has no relation with the password. It could be given to the client, encrypted with the derivated key. The derivated key could then be thrown away. But I still do not know if it is really necesary.
The server still needs to authenticate the client. The client will make a second call to the web service, signing it with HMAC and the key.
That’s it! It is really simple, so if there are flaws I did not see, you will surely catch them.
TL; DR
The protocol is based on key derivation functions, like PBKDF or bcrypt.
- The server stores login and H = kdf(pass, N), with N integer
- The client wants to authenticate and makes a call to the server with the login as argument
- The server replies with M > N and i nonce
- The client calculates k1 = kdf(kdf(pass, M)+i, 1)
- The server calculates k2 = kdf(kdf(H, M-N)+i, 1)
- The client calls the server with args “user=login&sign=”.HMAC(“user=login”, k2)
- If k1=k2. The signature matches and the client is authenticated.
The Geal test: extending the Joel Test
The Joel test was written by Joel Spolsky to provide a few very simple questions for developers to ask in an interview. Here they are:
The Joel Test
- Do you use source control?
- Can you make a build in one step?
- Do you make daily builds?
- Do you have a bug database?
- Do you fix bugs before writing new code?
- Do you have an up-to-date schedule?
- Do you have a spec?
- Do programmers have quiet working conditions?
- Do you use the best tools money can buy?
- Do you have testers?
- Do new candidates write code during their interview?
- Do you do hallway usability testing?
They seem basic, and that’s the point: a company with a poor score doesn’t give a nice environment to its developers.
While this test is still applicable, it was written in 2000, and software development has seen a lot of changes and innovation. So, I thought of a few other questions that you can ask your current or future employer:
The Geal Test
- Do you use agile development methods?
- Do you have unit tests?
- Do you perform code reviews?
- Do you use known technologies and frameworks (open source or not)?
- Do developers train and learn on office hours, or in their spare time?
- Do developers communicate with system administrators (deployment requests and bug reports don’t count)?
- Do developers communicate with the client?
- Do developers retain copyright on the work done in their spare time?
That’s it, 8 more questions, 1 point by positive answer. Joel said that 11 or 12 for his test is ok. I’m nicer, so I’ll say that 6 on my test is good enough.
1. Do you use agile development methods?
Agile methods have been there for a few years now, and they have proven useful for a lot of projects, especially when you have changing requirements or a very short time to market. Don’t let your developers fight everyday against specifications written 5 years ago, let them adapt on the way.
2. Do you have unit tests?
This should be standard. There are a lot of libraries to write tests in every language, for specific functions, for APIs, for user interfaces, so this approach is well supported. Moreover, if you answered “yes” to Joel’s question about daily builds, you can add tests to the loop, and run them right after the daily build. If you’re not convinced about the usefulness of unit tests, or fear that it will take too much time: unit tests give you assurance that you won’t break the code, they can validate the compliance with the specifications, and automated unit tests will save some time for development. You don’t want to pay a developer to test manually over and over the same code, but you can buy a machine to do that.
3. Do you perform code reviews?
I know that this one is hard to implement in a team, but once the developers are past the “I’m too shy to show you my code” phase, this will help them spot mistakes, learn from the better developers and find new ways to improve the code.
4. Do you use known technologies and frameworks (open source or not)?
A lot of companies have custom frameworks that they develop and use for their products, that nobody else uses. Although it can be comforting to have your own technology, that you control and maintain, it has a few problems:
- it reeks of NIH syndrome
- it is a cost not directly linked to what you’re selling
- you have to train developers to use it
- the expertise they build will be useless in future jobs
If you use known (and hopefully, recent) technologies, you don’t have to maintain it (although you may need to pay for it), you profit from bugfixes for other clients, and you are more likely to attract and hire skilled developers. Seriously, I don’t want to waste years to maintain your dead framework.
5. Do developers train and learn on office hours, or in their spare time?
Software development moves very fast and a developer needs to catch up often. If you don’t allocate time in his schedule to read, try and learn, you can still assume that he will still train himself in his spare time. But you take the risk that your Java developer becomes a Ruby expert, because he will learn what he wants, not what you need. If you want your developers to become experts, help them.
6. Do developers communicate with system administrators (deployment requests and bug reports don’t count)?
Too often, the only communication between developers and tech ops is through deployment request and bug reports. The consequence: they don’t know each other, they don’t trust each other, and when there’s a problem, they don’t work together. Obviously, this is not a good work environment. As a developer, I’m interested in how my code behaves in real conditions, and I would like helpful bug reports, instead of “it doesn’t work, I rollback”, and knowing and working with the sys admins can provide it.
7. Do developers communicate with the client?
Ok, this one will horrify some project managers and a few developers. I know that you want to control all the interactions with the client, and that developers sometimes have poor communication skills. But if you put a few layers between the developer and the client, this is what the developer will see: specifications that don’t make sense, and useless bug reports. Developers are problem analysis machines, so they can understand the needs of your client, and see right away what is implied in architecture, technology and performance. Use their insight, and they will feel useful, and produce better software. Also, if you can, send a developer to watch a bit how the client works with the software. In 5 minutes, they will spot more bugs and usability problems than in 5 weeks of bug reports.
8. Do developers retain copyright on the work done in their spare time?
When you’re passionate about development, you often have ideas, itches to scratch, and you may not be able to develop them at work. But a lot of contracts have non competition clauses and other clauses giving copyright of ALL your work to the employer. As an employer, it’s a way to protect the company, but as a developer, it is scary: you can’t use or sell the code written in your spare time. Let your developers work on what they want when they’re not in the office, and you will profit from the experience they gained developing their side projects (but state clearly that they work for you on office hours).
Bonus
I also have 4 bonus questions. They’re optional, but they don’t hurt.
- Do the developers participate in <LANGUAGE> user groups or developer meetups? In these meetups, they will learn a lot, and if they’re experts and enjoy working for you, they will attract other developers.
- Will I have a technical manager? It is reassuring for a developer to know that his manager has a clue about development, knows the difference between a good and a bad developer, can understand his problems and stabd up for his team.
- Do you use a recent version control software? Joel already asked this, but it needs to be precised. Version control systems have improved a lot since his test so, if you can, avoid old stuff like CVS or (worse) SourceSafe. Subversion is fine for most setups now (even on Windows), and if you use Git or Mercurial, I will be reaaaally happy.
- Do you accept remote working? There are a lot of tools to communicate online: mail, IM, VoIP, web project managers and bug trackers, and developers often know very well how to use them. It’s comforting for the employer to know that the developer is always at arm’s length, but this will not mean they’re more productive. If you remove distractions from the work environment (phone, colleagues), the developer can be more productive (yes, there are actually LESS distractions at home). Also, they won’t waste time in transport.
Now, if you’re a developer, rate your own company or future job. If you’re a manager, rate your team, and please, please, on behalf of all the developers out there, try to get the perfect score!
How much did you get?
Smalltalk for engineers
For more than a year, I have been playing with Smalltalk, and more specifically the Pharo project, and I had a lot of fun! Now, I’d like to share this experience. I saw a lot of introductions to Smalltalk, but they were all about its amazing features from a CS point of vue. I’m a software engineer, so I’ll give you a more pragmatic look, with a few useful tips.
When you hear about Smalltalk, you imagine old bearded guys, clinging to their outdated language. In reality, this is what I saw: a small yet growing community full of nice and motivated people, enjoying development and innovating everyday. Even if the language is old, they’re keeping it up to date with today’s standards: JIT compiling, web development, iPhone port… I strongly encourage you to take a look and, maybe, participate!
First look: the interface
The first impression is the most shocking: you don’t understand what you can/should do with that empty window. It is not the code editor you would expect. It is an entire world, full of living objects. The behaviour of these objects is described by code, but they’re not programs with a beginning and an end. For a good impression of that, try closing the environment (don’t forget to save) and starting it again: your windows are still open, exactly in the same place! Even selected text is still there! Your object’s life doesn’t end when you close the environment: they’re serialized in the image file.
The environment is composed of a virtual machine executing the code, an image file containing the objects, and a source file, storing a part of the source code. And that’s all. No files.
UPDATE: the GNU Smalltalk environment uses files to store source code.
In the previous picture, you will see the code browser, used for everyday development. It doesn’t display files, but (from left to right) categories, classes, method categories, methods, and under that, the actual code for the method. The code editor is organized around the actual structure of the code, not some arbitrary folder tree. It can be confusing at first, but it’s actually quite elegant. There’s a drawback though: you can’t use your favorite code editor to write Smalltalk code. Another nice side effect of the image: I store my environment on a USB key, and can use it to work seamlessly on Windows, Mac and Linux (using the one click pharo image).
Second look: the language
The language itself is another surprise: what are those ifTrue and whileTrue? You can’t think that Smalltalk has a syntax used for control flow. In Smalltalk, everything is an object. And the primary way of interacting with an object is sending it a message. The whole syntax of Smalltalk revolves around messages:
- “1+2/3″ is not equal to 5/3, but to 1, because you send to 1 the message “+” with argument 2, which gives you 3, and you send this result the message “/” with argument 3.
- ifTrue is a message sent to a boolean, with a “block” as argument (a block is a piece of code). The block will be executed if the boolean is an instance of True.
- you can’t access directly the members of an object: you need to create messages to read and modify these members.
The methods are separated between the class side and the instance side. The classes are objects, so they have their own methods (think of it as static methods). They’re used for a lot of things, like generating common instances (String crlf, Color blue, etc), or starting servers.
If you take a good look at a class like string, you will spot apparently redundant methods like displayOn:, displayOn:at:, displayAt:, displayOn:at:textColor:. They’re not redundant: displayOn calls displayOn:at:, which calls displayOn:at:textColor:. This is actually very elegant, because it keeps methods small and readable.
Keep that in mind when you’re developing in Smalltalk: readability is more important that speed, because the time you gain now will be wasted the next time you try to read your code.
Next: the tools
You saw the code browser, but there are other nice tools designed to help you every day.
Monticello is a distributed versioning system integrated in the environment. Nothing special here: it tracks your changes, create revisions, and supports local (folders) and remote (HTTP, FTP) repositories.
There is a test runner that displays all the tests loaded in your environment. You will see that there is a very good coverage, but it is not enough! Contribute a test or two if you have time.
Last but not least: the refactoring browser. It is an amazing piece of code which analyzes your classes, points out design mistakes, and in some cases, can correct them in your place.
OK, now, what can I develop?
You can do about anything in Smalltalk, like other languages: desktop applications, web applications, use databases, network protocols, REST APIs… It is particularly suited for big applications with complex object models.
For desktop applications, you will easily have cross platform code and UI, but you won’t be able to use native windows (at least, not with Squeak or Pharo). For web applications, you can choose between these frameworks: Seaside, Iliad and Aida. Each one has a different philosophy, and different strengths, so try them all out!
Developing in Smalltalk has been an amazing experience: I learned a lot, and the concepts and habits I took are easily applied to other languages. now, I just need a way to work in Smalltalk for my day job
Update to a safer VLC
VLC 1.1.4 is out, with a fix for the DLL preloading attack!
Read more about that issue in the release notes and the security advisory.
