development

You are currently browsing articles tagged development.

OK, OK, yes, this post is partly blatent self-promotion, but it’s also a moment of honesty and a hopefully-interesting reflection on an interesting little test that I did today.

Read the rest of this entry »

Tags: , , , , ,

CSSAfter a little flurry of activity last Christmas the updating of my web development skills has been slow for most of the rest of the year.

But I’m currently running…err…at least 4 small web-based projects at the moment, so I decided to invest in some web hosting to get some prototype sites actually up onto the ‘net.  I’ll probably host this blog there eventually too, with all the benefits and flexibility that come with hosting your own WordPress install.

Internet Reviews

Now, I have another post in my head titled “How to do an Internet Review”; maybe that’s for another day, but the premise will be that internet reviews of anything are either by people who are so completely in awe of the product that it’s worth 5 stars, or people who’ve had a problem and therefore thing it’s the worst thing in the world and so worth zero stars and lots of use of the words “suck”, “sucks” and “sucky”.  Such reviews have made objectively choosing a host difficult.

Hosting Requirements and Recommendations

My requirements for a web host are basically that I need lots of php, domain name, and MySQL flexibility at low cost and, preferably, on a month-by-month contract while I try things out.  I can see the benefits of having limits on storage and data transfer – this will put off people who just want to waste server resources and probably make for a speedier service.

I also really wanted a UK-based host – because it would make for localised support and less trans-atlantic lag, while helping out the UK economy (a LITTLE!!)

With internet reviews being mostly very unhelpful I Tweeted for recommendations and was surprised to only get one.  But the company looked good, met the requirements and allowed me to sign up for a month at a time.

DNS woes

Once up and running I then had to delve into the world of DNS, subdomains, add-on domains, CNAMEs, MX records, virtual hosts, domain transfers, and…err…other stuff.  I know about all this, but it’s been a while since I practically did anything with it, so it took a bit of refreshing.  Plus, you’re playing with the real live internet when you’re doing this and I didn’t want people’s email and websites going off line, so I was doing things cautiously.

I think it’s worked out that I understand things better then the hosting company’s support team – who are quick but don’t seem to really read what I’ve asked of them and understand my problem.  It’s been difficult to convince them of what needs to happen, but I think we’re getting there.  Currently the host does NEARLY all that I need it to, but not quite.  If their support team can turn around adding me a new domain that’s hosted with them but DNS-managed elsewhere then I’ll be happy.

CSS complications

With that all sorted I could turn to doing some web-page mock-ups for one of my apps.  I’ve moved on a bit from when I was Debugging the Borders, but I still find CSS awkward to use.

When I was a software engineer we used to say that the engineering principles were the key skill and that languages were like tools.  What’s important for a woodworker is knowing how to build things out of wood.  What type of plane or screwdriver you use is almost irrelevant.  And to a well-trained software engineer a new language is like a new type of screwdriver, it’s a tool that you use to apply the engineering principles and can be learned and applied quickly.

However, as I previously wrote, HTML and CSS aren’t really programming languages and so don’t fit with an existing paradigm in my head.  It’s not just another type of screwdriver – it requires learning a new set of principles and practices.

In the past I’ve just applied what little CSS I know in a fairly unstructured fashion.  But what I really need to do is learn CSS from first principles and see it applied by others to get to grips with it.  I need to understand “non-replaced elements”, “block-level layouts” and “selectors” and how these, and other things, fit together in “the cascade”.

In the meantime, does anyone know how to left-align text in a centre-aligned box?

Tags: , , , ,

I don’t normally talk about my work, but if I generalise this I reckon I can make a half-decent point about modern software practices.

I work with a set of tools provided by a best-in-class software house. These tools aren’t cheap, and we expect them to be good.

But we’ve been having problems with quality lately and this has caused me to be contacting the supplier for support.

Read the rest of this entry »

Tags: , ,

Sadly, this is not a gardening post and has nothing to do with insects or plants…though you’d be forgiven for thinking it was.

It’s actually a learning-web-development skills post and one which is really just a rant to say “CCS….what the?!”

See…for those of you that don’t know, the appearance of most of the web pages you see is controlled by little files called “cascading style sheets” – CSS for short.  These little bits of code say things like:

“That table has a 3 pixel border and a blue background”

and:

“That text over there is green and bold and extra small”

or even:

“That thing over there should be in a box 200 pixels wide, 100 tall, with a picture as a backgound and it should be offset by 50 pixels from the top of the page”

And it should be really simple, but you know what.  I’ve written high-integrity, safety-critical software for aircraft.  I wrote the basics of a Window-based GUI in Pascal when at college (well…sort of).  I know languages that are procedural and functional, imperative and declarative.  I’ve written everything from assembler to Prolog.  I have a degree in computer science from a highly respectable university.  (note: if you want to employ me then leave a comment and I’ll get back to you! ;-) )

But nothing…NOTHING I’ve ever come across is as unpredictable, complicated, difficult to get right, and downright confusing as this CSS stuff.

I’ve spent quite a while now trying to work out how to get a table to look just like it should.  I think the final solution was “border-collapse: collapse”, but man, it was tough to find.

I take my hat off to those web developers that actually understand this.  Pray tell…how did you learn to write proper CSS-based web pages???  Self teaching doesn’t seem to be an option.  Or do you have a good book?

Tags: , , ,

Learning all this new software development stuff is all well and good, but at some point you actually have to develop something.  And developing a computer program of any size, like any engineering trade, requires some tools and some planning.

One of my main applications of what I’m learning is to a database that I maintain at work.  This is currently running on a Windows server with MS SQL as the database and MS IIS (Internet Information Service?) as the web server.

This is all well and good, but it’s not an environment I can easily and cheaply re-create for testing and development purposes, and some of my code is not portable between databases.  (I’ve made a good attempt at adding a database abstraction layer, but it’s not QUITE there).

So, the natural thing to do is to migrate to Unix, Apache and MySQL, which I can freely and easily deploy pretty much anywhere.  And that’s what I’ve been up to this week.

I LIKE Windows?

I do link Unix.  It’s a much better server OS than Windows, in my opinon.  But I’m also a user – even as a developer – and Windows IS much more user friendly.

For example, I’ve been using NotePad++ as my text editor, which has syntax-highlighting, auto-indentation, auto-completion of words, good handling of multiple files, and a whole host of other lovely things.

Moving to Unix means moving to Vi or EMACS.  Tools which are great but not simple to learn (do I HAVE to learn to use another tool to do this?!).

Don’t get me wrong, I like vi, in a massochistic sort of way, but not for writing a complex software project!

Keeping Track

I’m also vaguely aware that this sort of project would be good to have under version control (which I won’t explain here – ask if you want to know).

I used to use CVS in my old job and it was a great help.  If I’m setting up a development system, making significant code changes, and migrating to a new platform, then a version control system would be a great help.

Considering My Options

So I need some of the following:

  • a nice Unix text editor for my command line/terminal
  • a GUI for my Unix system (with a nice GUI text editor)
  • a version control system

Asking around, the text editor of choice with Unix boffins is…vi!  But I’m not happy with that.  vim has been suggested as it has syntax-highlighting, split screens, and stuff like that.  Maybe it’s a nice half-way house.

I’ve been playing with getting the X Windowing System to work.  There’s a free, open source X server called “X Ming” which does the job and works prett seamlessly over ssh tunnels, but I’ve found setting up the client side (which is actually on the server!) a bit difficult.  Too complicated.  And I’d probably only end up using xvim, which would probably only be a three-quarters-way house.

Sublime Subversion

Version control has been a boon though!  I quickly read the important bits of the Subversion book and  realised what I’d been missing.  My vague rememberance of CVS should have spurred me on sooner – this is REALLY important stuff!

In minutes (well, OK, hours, but not many) I had a SVN server accessible locally and over SVN and SSH protocols, with my production code on it and with all my development areas, in both Windows and Unix land, using checked-out, version-controlled copies.  Woo hoo!!  I was genuinely excitied – in a geeky sort of way.

Where now?

Well, I’m mostly happy with the set up.  I’ll probably miss my Windows editors for a while, but I’m generally content.

I have a Linux production server, running open-source tools, which I’ve nearly migrated to.  I have easy and safe access to the code from multiple locations.  I have a reasonably good text editor, with scope for GUI access in the future.  I can bring my code home to develop.  And I can easily and cheaply set up a test or development environment if I need to.

It’s a whole world better than the old Microsoft one!  And I’ve learned some good stuff along the way.

Now…the tools are in place…time to apply my new HTML, JavaScript, CSS, PHP, W3C DOM, Apache and MySQL skills to the task!

Amazingly, I’m not feeling very confused by this.  Are you?

Tags: , , , , , , , , ,

I suppose I’ve never really done a full and proper, Web 2.0, development project. And now I’m looking at how it might be done I confess that I’m a little overwhelmed.

I was trying to explain to Sally how many different technologies are involved:

  • databases
  • server-side scripting
  • web servers
  • markup (HTML and CSS)
  • client-side scripting
  • and possibly some XML for good measure too
  • and it helps plug all the stuff above together if you know a web development framework

To this end I’m trying to simulaneously get to grips with the following tools/languages:

  • MySQL (Database)
  • PHP (Server-side scripting)
  • Apache (Web Server)
  • HTML/XHTML
  • CSS
  • JavaScript (client-side scripting)
  • the Domain Object Model(s) needed to manipulate DHTML documents using JavaScript
  • XML
  • Symfony (a PHP-based web development framework)

I wonder if such a large collection of technologies has always been required to write a business application?  I remember, on my University work placement, using Oracle on a VAX/VMS System and using Oracle Forms.  And more recently I’ve been helping Sally with a MS Access database, which also has it’s own forms system.

I suppose at the very most you would previously have to have known the database, the forms program and possibly a scripting language (VB Script).

The problem with today’s systems is that things have gotten very flexible.  You can present data through the web in whatever formats and styles you like.  It can be branded and you can present very complex sets of data in a variety of meaningful ways – just check out Facebook and all the information on there…or read-again (if you dare) my rant about information overload on Amazon.

I suspect that if you want to present a simple database using a web-based form you can do this quite easily.

But, hey, why make things simple???

Back to my reference books…

Tags: , , ,

OK, so I was learning JavaScript from a JavaScript cookbook, which probably isn’t the best way.  It’s still a nasty language but a quick couple of hours with a decent reference book (the O’Reilly JavaScript Pocket Reference) and it’s all making a lot more sense, BUT, I might add, I still think it’s a bit of a daft language.

I’m also finding that though it’s quite powerful (“powerful” languages are usually flexible, and therefore complex, “helpful” and prone to unpredictable behaviour), you have to write a lot of code to do something very simple.

For example, one thing I want to do is create a new row in a table.  I can do this by calling the “insertRow” method of a table element.  But I then have to call the insertCell method of the row element to create all the cells.  And I then need to append some HTML or text into each cell (even if it’s just a  )  to make the cells appear to look right.  What a faff!

I suppose I want all things though.  A simple language with predictable behaviour, but one in which I don’t have to write much code to do what I want.

Yes…now if someone can just create that my life will be complete!

Tags: , , , ,

Javaaaarrghhscript

Geeky post…sorry if you get lost.

I’m still playing with Web Development languages and tools.  A few days in Devon with not much to do is a good time to invest in some self-learning and I’ve been given the O’Reilly JavaScript and DHTML Cookbook for Christmas too, so I’m working through that.

I’m pretty proficient with server-side scripting now, but it had limitatations and performance issues.  I’ve been so impressed by some of the Web 2.0-type sites out there (www.letsfreckle.com, www.twitter.com, www.facebook.com) that I feel I really need to get a handle on client-side scripting too.  That’s where JavaScript and DHTML come in.

But I’m really not liking JavaScript.  See, I was educated with a quite deep knowledge of programming languages.  I’ve studied both imperative (statement-based) and declarative (logic-based) languages.  I’ve studied compiler construction and language structure and analysis.  I understand object-orientation.  I know what’s going on under the hood, and I know the pitfalls of various programming languages styles.

I’ve also got a background in safety-critical software engineering.  Writing programs where you know what must happen and if that doesn’t happen then people’s lives are at risk.  I like to know what my programs are doing.

And with JavaScript, most of the time, I don’t have a clue what’s going on!  The language makes so many guesses on your behalf, allows you to pass objects and functions as data and doesn’t (appear to) contain notation for distinguishing between passing parameters by value and by reference.

To the uninitiated this will mean nothing…let’s take an example.  Lets say we want to write a little computer program called “add-one”.  This program has one input, a number, and one output, which will be the number plus one.

The preferred way to do this is to write what’s called a “function”.  A function is a little program which gives you back a value.  Like this:

function add-one ( x )
begin
  return x + 1
end

Here, x is the input and we “return” x + 1.  Simple.  So we can now do:

a = 1
print a
b = add-one ( a )
print b

I hope you can see (I’m racing ahead) that this will print “1″ then “2″.

But you can also write this as what’s called a procedure.  A procedure does some “stuff” but doesnt return a value.  Like this:

procedure add-one ( x )
begin
  x = x + 1
end

So what happens if we do the following with the procedure?:

a = 1
print a
add-one ( a )
print a

“That’s easy!” you may say, “it prints 1 then 2 again”.  But it’s not that easy.  Sometimes the language will take a “copy” of x into the procedure and modify the copy, leaving the original untouched.  This is called “pass-by-value”.  Why would you want to do this?  Well, let’s write a procedure that has someone’s full name as an input and prints their first name:

procedure print-first-name ( name )
begin
  remove surname from name
  print name
end

In this case we only want “name” to change within the procedure or the following would not work:

my-name = "Fred Flintstone"
print-first-name ( my-name ) 
print-surname ( my-name )

Here, print-surname would not work because the print-first-name removed the surname from my-name.

Your head probably aches now.

Anyway, JavaScript does LOTS of this sort of thing where pass-by-vaue and pass-by-reference really make a difference.

Another complication is that there’s two ways to create strings that return different types:

my-name1 = "Fred Flintstone";

and

my-name2 = new string("Fred Flintstone");

But these actualy do different things.  One creates a string value and one creates a string object.  And we find that:

my-name1 == my-name2

is true because the interpreter automatically converts the type but

my-name1 === my-name2

is false because it does type comparison too.

It has a variable called “this”, which refers to different things in different contexts.

And it doesn’t enforce important bits of syntax.  You’re supposed to end statements with a semi-colon, but if you split a statement over a line, then it will add the semi-colon at the line end (if that’s a valid place to end a statement).

These are all very minor examples of how this is a complex, weakly-typed, language the enforces very little checking on the programmer, makes lots of assumptions about what you mean in your program, and doesn’t seem to give you ways to enforce the meaning that you want.

All in all, I can see why so many web applications are so liable to not working.

Perhaps with a proper JavaScript tutorial, rather than just a cookbook, I might get a better grasp of the language and find some strong typing and better structures.

But for the moment it’s looking pretty complicated and chaotic!

Tags: , , , ,