The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Net::SFTP

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jamis Buck

Posts: 184
Nickname: minam
Registered: Oct, 2004

Jamis Buck is a C/Java software developer for BYU, and hacks in Ruby for fun.
Net::SFTP Posted: Dec 5, 2004 9:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jamis Buck.
Original Post: Net::SFTP
Feed Title: the buckblogs here
Feed URL: http://weblog.jamisbuck.org/blog.cgi/programming/index.rss
Feed Description: Jamis Buck's corner of the blogging universe. Mostly about ruby, but includes ramblings on a variety of topics.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jamis Buck
Latest Posts From the buckblogs here

Advertisement

So, I’ve started on Net::SFTP. I was originally planning to just refactor the original implementation out of Net::SSH 0.1.0, but after reacquainting myself with the code, I decided a rewrite was in order. Yah, I frequently find myself disgusted with code that I wrote only months before, but I suppose that’s a good thing, since it means I’m always learning better ways of doing things.

So, what’s wrong with the original implementation? Plenty.

The entire SFTP protocol was implemented in a single class. (With the exception of one auxiliary class, anyway, but the auxiliary class was more of a glorified structure, with only a tiny bit of protocol-specific logic in it.) That alone may or may not sound bad to you, but if you consider that the class also supported three different versions of the SFTP protocol simultaneously... yah. You’re picturing it, I think. Lots of if, case and unless statements, sprinkled at seeming random throughout the code.

The new version is not yet checked into CVS, but is coming along nicely. I’ve separated it into two layers: the SFTP protocol layer (which implements the low-level protocol itself), and the interface layer (which implements a more user-friendly presentation of the SFTP operations).

The protocol layer is split into 5 different pieces, one for each existing version of the protocol. (Yup, Net::SFTP will support, in its nascent release, all 5 existing versions of the protocol!) This turned out pretty slick (if I do say so myself). Each subsequent protocol version inherits from the previous, extending and modifying as needed. It made for a very natural, very extendible implementation of the protocol spec. (This means that when version 6 of the SFTP protocol is solidified, it should be almost trivial to add to Net::SFTP.) It is still not a complete implementation of the specification, but it covers all the major operations. Certainly enough for an initial release.

All told, the new version consists of about 20 classes, just in the protocol layer. I’m a bit more pleased with the architecture this time around.

What is more, the protocol layer is completely unit-tested, with 100% code coverage. (I love dependency injection!) Over 1,500 individual tests! (I love code generation!)

I’ve got about 30% of the interface layer written, with plans to work on it some more tonight (if I have time after setting up the Christmas tree). With any luck, I’ll have version 0.5.0 of Net::SFTP finished by the end of the week. With a little more luck, that may include a first pass at user manual. I may need to release an update to Net::SSH simultaneously, if I can’t get Net::SFTP implemented as I’d like with the existing 0.5.0 release. We’ll see.

Read: Net::SFTP

Topic: Ashamed to be a Java programmer Previous Topic   Next Topic Topic: Too Many Distractions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use