OU blog

Personal Blogs

This verdict is written on a cocktail napkin. And it still says guilty. And guilty is spelled wrong.

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:10

Just started my M363 "Software engineering with objects" studies and came across this in Unit 1 regarding keeping notes.

 

developer scribbles in a court of law

Gulp! Best stop drawing knobs in the margin.

Permalink Add your comment
Share post

BT HomeHub brawl

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:11

So, I have spent much of this weekend trying to sort out my mother-in-law's wired broadband connection via the BTHomeHub router. Not fun.

After a lengthy chat with their tech support they've decided to send someone out to inspect the network fault.

In the mean time, 'to get the internet to work', I've told the in-law to unplug the router and plug it back in, and then repair the LAN connection.

Repair LAN

To make things easier I've created a batch file (on her desktop) which repairs the LAN connection automatically for her at the double click of a button.

Batch file icon

I thought I'd record the .bat file here for my future reference and incase others might want do to the same.

@echo off
ipconfig /renew
arp -d *
netstat -r
netstat -rr
ipconfig /flushdns
ipconfig /registerdns
pause

Just open notepad and type in the above. Save the file with the .bat file extension and then just double click this file to repair your LAN.

Permalink Add your comment
Share post

I Suppose a First is Out of the Question..?

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:11

So,

Results are in. Repeat. Results are in.

It's so good to get the results even when they're poor.

M362

I was actually expecting a little more for M362 I thought the exam went really well. Just goes to show you can never be certain. M362 was also the first course I'd actually read all the material so it's a bit worrying I couldn't even pull off a Grade 2. No matter, it shows I'm either not working hard enough or am quite quite stupid.

M362 result grade 3

M359

M359 what a disaster! Oh boy. I do consider my commercial SQL strong but obviously not strong enough. I thought the TMA's undid me on this one. I thought. I tackled the first couple of TMA's without spending any real time on the materials and got woeful marks. From this start it was really tough to get anything better than a Grade 3 so I was in a real low gear for the exam revision. Bombed the exam as well though. Double trouble. Ouch! So didn't even scrape the Grade 3. Very poor! Lesson learnt here though. Always put a huge amount of work into the first TMA, you can always ease off later if you're lucky enough to be thraping them!

M359 result grade 4

 

Booo!

I quite liked the idea, when this OU campaign began, of getting a first. Now though. I'll be happy with a pass. I may have lost a first but I have gained the utmost respect for anyone with a first. Those guys are giants and I salute them all.

In brighter news. Officially three years down. Three years to go.

Permalink Add your comment
Share post

Visual Studio Inspector Window

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:11

So, one of the things I love about developing Swing forms in Netbeans is the Inspector 'Navigating Window'. This window lets you navigate all the controls on a form via a lovely hierarchical tree view.

Here is how it looks in the Netbeans IDE:

Netbeans Inspector window

 

The other day I found the Visual Studio equivilent. It's called the Document Outline Window. I was so happy. You can select this window from View> Other Windows> Document Outline. Like so:-

Document outline in Visual Studio

 

And this is how it looks:

Visual Studio Document Outline

 

It's so good... You'll never have to hunt for a control again... enjoy...

 

Permalink Add your comment
Share post

Geo Info Bingo Bango

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:11

So I've added loads of gadgets to my GMail account and generally pimped it up. Fine. Great. It's all good except for a minor beef I have with the theme's location setting. I added my postcode - standard - and now I get treated to the weather in Norwich behind my emails.

GMail weather

I work in Norwich. And I live pretty close to Norwich too. If I need to know the weather, right now, in Norwich, guess what? I look out the window.

We want to know what the weather's like in Paris or Cannock don't we? Well I do...

Permalink Add your comment
Share post

Cheat Guide to Regex

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:12

Years went by with me safely avoiding regular expressions. They were such happy times. Then twice this year I was forced to make its acquaintance. But it was a good thing - maybe even the best of things - because now I no longer feel a tingle in my bottom when I see it in our source. I thought I'd lay down what I've learnt, for my reference should more years come between us, and in case it can help others find their way into the arms of this barbed stranger without drawing as much blood or curse.

The following was tested using the .NET framework and the static method System.Text.RegularExpressions.Regex.Match(String, String). To ensure the entire strings are wholly matched my usage is:

VB.NET:

If  Match(searchText, searchPattern).Length = searchText.Length Then
 ' Matched
Else
 ' No match
End if

The Formatted Telephone Number

Consider this list of user-entered numbers. Let's say, of this list, H is the only valid number.

 A: AbcH0W_BOThemy84kies
B: 01543 MWC66
C: 8
D: 91543278966
E: 01543278966
F: 0145355 56 544 144
G: 01543 1231981
H: 01543 278966

As a first cut lets only accept string C (a single number).

Pattern:
 [0-9]
Tokens described:
[ ...start of character list...
0-9 ...any number between 0 and 9...
] ...end of character list
 

Now let's accept C, D & E(all multi-digit numbers without spaces)

Pattern:
 [0-9]+
Tokens described:
 [ ...start of character list...
 0-9 ...any number between 0 and 9...
 ] ...end of character list
 + ...one or more of the previous token ([0-9])
 

Now let's accept C, D, E, F, G & H (all numbers including those with spaces)

Pattern:
 [0-9 ]+
Tokens described:
 [ ...start of character list...
 0-9   ...any number between 0 and 9...
   ...or a space...
 ]  ...end of character list
 +   ...one or more of the previous token ([0-9 ])
 

Now let's accept  E, F, G, H (all numbers, including those with spaces, beginning with 0)

Pattern:
 ^0[0-9 ]+
Tokens:
 ^   Start of string...
 0   ...must be 0...
 [ ...start of character list...
 0-9   ...any number between 0 and 9...
   ...or a space...
 ]  ...end of character list
 +   ...one or more of the previous token ([0-9 ])

 

Now let's accept G & H(all multi-digit numbers beginning with 0 containing exactly one space and ending with numbers)

Pattern:
 ^0[0-9]+ [0-9]+$
Tokens:
 ^ Start of string...
 0  ...must be 0...
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 +   ...one or more of the previous token ([0-9])
    ...followed by a space
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 +   ...one or more of the previous token ([0-9])
 $  ...end of string.

 

Now let's accept H (all numbers beginning with 0 followed by exactly four numbers then exactly one space then exactly six numbers)

Pattern:
 ^0[0-9]{4} [0-9]{6}$
Tokens:
 ^ Start of string...
 0   ...must be 0...
 [   ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {4}   ...exactly four of the previous token ([0-9])
    ...followed by a space
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {6}   ...exactly six of the previous token ([0-9])
 $  ...end of string.

Useful Misc

The next example is given as it includes useful operations I couldn't include in the above sample without killing its simplicity. This includes:-

  • specifying ranges of character frequency e.g. xxx to xxxxxxx
  • Regex operators e.g. ^ + [ .
  • longer strings such as CAT, Bat, Coffee (character groups)
  • ranges of characters e.g. D-K

Consider these, highly fanciful, currency-esque, strings:

 A: X:GBR_£100.23p +17.05
B: Y:USA_$1981.01c =1.99
C: X:USA_$56.03c -0.23
D: D:GBR_£1.00p +0.50
E: X:GBR_£956.21p =0.211
F: X:USA_$6000.00k +29.02
Pattern:
 ^[X-Z]{1}:(GBR|USA|EUR)_[£\$][0-9]{2,6}\.[0-9]{2}[cp]{1} [=\-\+][0-9]{1,2}\.[0-9]{2}$

This Regex pattern will match the first three strings.

Tokens:
 ^ Start of string...
 [    ...start of character list...
 X-Z   ...any letter between X and Z in alphabet...
 ]  ...end of character list
 {1}  ...exactly one of the previous token ([X-Z])
 :  ...followed by an semi colon
 (   ...start of list of character groups...
 GBR  ...this character group...
 |  ...or...
 USA  ...this character group...
 |  ...or...
 EUR  ...this character group...
 )  ...end of list of character groups
 _  ...followed by an underscore
 [    ...start of character list...
 £  ...a pound sign
 $  ...or a dollar
 ]  ...end of character list 
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {2,6} ...between two and six of the previous token ([0-9])
 \. ...followed by a full stop
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {2}  ...exactly two of the previous token ([0-9])
 [    ...start of character list...
 c  ...a c
 p  ...or a p
 ]  ...end of character list 
 {1}  ...exactly one of the previous token ([cp])
    ...followed by a space
 [    ...start of character list...
 =   ...an equals sign...
 \-  ...or a minus sign...
 \+  ...or a plus sign...
 ]  ...end of character list
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {1,2} ...between one and two of the previous token ([0-9])
 \. ...followed by a full stop
 [    ...start of character list...
 0-9   ...any number between 0 and 9...
 ]  ...end of character list
 {2}  ...exactly two of the previous token ([0-9])
 $  ...end of string.

Links & Source:

The code I used in testing the above Regex can be found here.

Derek Slager has a great online tester here.

And easily the best Regex resource on the web is here.


The above expressions are presented merely as examples to illustrate basic Regex concepts. These are not conclusive and I do not credit them, by any means, as definitive for the solutions described, nor do I promote their use in anything other than learning scenarios. Your statutory rights are the things most affected and you need not send no money now.
Permalink Add your comment
Share post

Inflammable means Flammable?! What a DBMS.

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:12

So, I was getting down and dirty with some MS SQL today.

Loving it - standard. Aside from some basic string manipulation which I begrudgingly decided to leave out from the client code the procedure was quite straight-forward. Anyway, I wanted to determine the last character of a string and came across some odd LEN behaviour illustrated as follows:

Len of beard script

Returns:

Expected LEN

Right?

 

Wrong! You get:

SQL Results

So LEN ignores trailing spaces. I know it says as much, and very clearly, in the documentation but who would have expected that...?

Permalink Add your comment
Share post

Down with M253

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:12

Earlier this year I completed the OU course M253. It is a mandatory course for the Computing degree I'm going for. The course title is: Team working in distributed environments. It was a short course, worth only 10 points but, like I've said, I had to do it.

It was awful. It was so bad it actually moved me to post a review of the course - something I hadn't done up until now. To make sure my review wasn't too emotive I left it for a few months. I think enough time has passed now so I have finally posted it. It was, naturally, a pretty negative affair and whilst I've tried to be constructive I wasn't really expecting it to be become 'published' - as it were.

So fair play to the OU. They did stick it on the course's website. Here it is:

The course attempts to provide an insight into distributed working. In fabricating a realistic working scenario - building a new website - this course, I feel, fails in a big way.

The primary problem, in my opinion, is the actual content of the project. Stripped down to the actual product, the website task is essentially the production of a few word processor documents. Every OU student taking the course is fairly confident in producing a word document and because of this the course becomes a scramble to churn them out. It's hard to designate and enforce a single document author, because no-one can help themselves from squirting out their own versions of the word files. 

The forums contribute equally to this frantic wildness because it seems people are reluctant to digest comments made earlier in a forum, so the discussions become broad and unsophisticated. You end up drowning in a storm of poor quality documents, and a ten ton mass of forum prattle, all of which no one can control.

I wish a better project was used. Broken into smaller distinct solutions (like a real IT project) such as database design, testing & test plans, documentation, UI, support, installation, etc... where it takes an amount of research before a student could contribute. Or better yet only grant each student access to certain resources on the OU website so you would be forced to engage with each other with a focused aim. The bigger team requirement could then be experienced when all the solutions are brought together. 

Or something similar to this. Just any project where people can work on separate things. The present course does not reflect a real life scenario - when have you ever had to share the task of writing a word document between multiple colleagues?

If you are taking this course I would recommend making an impact early on. Get involved in the first discussions. On my course the students who were first out the blocks seemed to have the most influence later on.

Course starting: November 2008

Review posted: October 2009

Permalink 1 comment (latest comment by Dermot Beirne, Tuesday, 17 Jan 2012, 10:53)
Share post

Meccano & James (dis)May

Visible to anyone in the world
Edited by Mitchell Cooper, Wednesday, 25 Nov 2009, 21:37

There was a programme on BBC last night which followed James May, a gaggle of students - I said gaggle - and some professional architects as they attempted to build a man bearing bridge out of Meccano. On the whole, I felt the programme was good and I was I impressed with

  • the dedication of the students
  • the initial design for the bridge (a crazy one-way affair- how cool is that?)
  • the ultimate success of the project.

James did, however, make a particular point I wasn’t thrilled about. As part of the opening preamble, which introduced us to Meccano and described how fondly he and his generation regard it James drew an unfavourable comparison between Meccano and the Nintendo Wii slamming the Wii as a substandard toy. He then washed down this acrid dose of nepotism with a rather broad swipe at the digital age in general. His main gripe with the digital age is the tangible properties of the cogs and screws of Meccano and therefore the relative emptiness of the digital domain of blips and light.

I suspect, if pushed, James would concede that the 'digital age' is actually a rather exciting prospect and furthermore that his comment was mostly just for a bit of TV flam for affect but I do think it's worth defending the Wii, its peers, and all the former computer gaming generations.

Meccano

I agree that Meccano is great. We get to see and understand how mechanics works. It's simple yet boundless. I love the practical aspect of the 'toy' but the notion of it being inherently virtuous because of its material’s physicality is romantic and wrong. When I was a child I was addicted to my Spectrum 128k much like, I assume, kids are now addicted to Wii's. It gave me pure gaming joy and an insight into programming which has now forged a great career for me to support my family. To me this a practical gift from my childhood toy but for others still it has galvanised skills for them to run offices or conjure spectacular images, build websites to reach millions or even design bridges. I don’t purport that kids playing computer games suddenly become Google cracking wizards but neither does making an axle in Meccano qualify you to work the next day in a car production line. The best either can hope for is familiarising a child with the language of its field.

We can't begrudge the Wii, PS3 et al because kids are learning how to interact with computers and learn their habits which are now more ubiquitous than cams and pulleys ever were. And whilst the perception, as perpetuated by James, of science/mechanics/engineering’s technical difficulty is easy for our fathers to assert because they can point to trains and bridges and say this is our world, the reality is more complicated. Computers are a science and as worthy and demanding as any other science but a command of them is just not, I don’t think, so easily paraded as steel and steam.

James' passion for Meccano is, I think, rooted in the magic of opening a Meccano set and seeing, not a collection of shiny struts and bolts, but an infinite metropolis of whirling delight just waiting for you to give it life. And who would deny the magic found there. I can't. But I can say there is magic too in pixels. Something like 'LittleBIGPlanet' has so much creative juice flowing through it it's hard to do it enough justice or the invention of say Guitar Hero or the simplicity of Tetris or the beauty of WALL-E. These arresting digital products will inspire kids to become masters of these electric plastic boxes in whatever realm they care to take the computer. I think the generation in love with Meccano, and the technology it represents, find the world they became men in is now wrought with what they see as an 'easy' technology which has replaced theirs, but whilst I understand this changing of the ‘toy’ guards happens to every generation - along with music, kids TV, trousers and hair -  it is progress and one day our generation is going to wake up to find their childhood toys were just the beginning of a symbiotic and amazing relationship with computers.

So until we have to defend Playstations from our kid's pocket-sized edible robots made from holograms let's give the Wii players a break and acknowledge the merit in good interactive design and a long life with computers.

Permalink
Share post

What is a Blog?

Visible to anyone in the world
Edited by Mitchell Cooper, Friday, 20 Nov 2009, 22:59

Here at the OU there are a few student blogs which have a first entry along the following lines:

Cool, I have a blog. This is my first go at a blog. Is anyone actually reading my blog? What is a blog?

So here's a quick, 350 word, intro for first time OU bloggers.

 

Part I What is a Blog?

What is it?

A blog is a collection of articles, called posts, catalogued with tags - words which relates to an article. An article can - and usually does - have many tags. The same tag can - and should - be applied to multiple posts.

What do I write about?

A post can be about growing beards, hoeing allotments, racing bats, eating salt, tuning cars, tuning forks, packing bags or going nuts. If you can spell it, blog about it.

What are comments?

Readers of posts can leave public comments. Though conversations do naturally occur in these comments I personally think some off topic conversations detract from a blog's/post's impact. We have forums and emails for natter.

What about RSS?  RSS Chicklet

Readers can be alerted to new posts by subscribing to a blog. This is done via RSS. Find a blog you like. Click the RSS button and be taken to the RSS page. This - most likely text-only - web page is a version of the blog which RSS systems can read. Copy the URL address for this web page and then add it as a new RSS feed to your reader of choice. I use Outlook or Thunderbird but there are tons of other clients.

Adding a RSS feed in Thunderbird:

Adding RSS to Thunderbird

 

Adding a RSS feed in Outlook:

Adding RSS feed in Outlook

 

Part II How do I keep track of reader's comments?

You will note your blog has two RSS feeds. You lucky devil. The first one is for the blog - for punters - and the second is for the comments. Just subscribe to this 'comments' feed and, like any normal feed, you will get alerts for every new entry.

 

Part III Is anyone reading my blog?

The way I keep tabs on the traffic is via Google's Feedburner. It is a wonderful application which 'plugs into' any blog. So plug it into yours. It keeps counts of views per post, your subscribers and tons more good stuff. Just go to http://feedburner.google.com and follow the instructions. All you really have to do is paste your RSS address.

 

Permalink
Share post

Another Dirty Blow

Visible to anyone in the world
Edited by Mitchell Cooper, Wednesday, 11 Nov 2009, 13:27

So, Jeff Atwood - master of the Stack Overflow.com trilogy - over at the wonderful CodingHorror blog made this post and I - like most of the commenter’s it startled - have an issue with the harsh judgement on anyone not able to name the list of legends he provides. I guess it goes without saying I didn't know a single name in the list. But I got over that aspect and looked into the gents, and gal, named and I discovered something. I found a property which almost all the list shared and it made me quite blue.

My 'sister in law'* is presently mired in the final legs of her PhD and often I find her surrounded in photo copied articles and highlighter pens, or books fatter than my head and winding in Lockets for sustenance because there's no time for Pot Noodles**. On one such occasion I felt brave enough to thumb through one of her books and it subject was that of racial prejudice in the media. The three paragraphs I read described the crime it is, in the western world, that, when describing persons, the race is assumed to be white unless otherwise stated. It's outrageous, of course, and I think it is also symptomatic of an issue on the web which Jeff's post fell foul of.

So the megaton coders mentioned in Jeff's list are all related because they are (mostly) fellow Americans. His post is galvanised in the WWW prejudice which assumes every online sole is American. My list, for coders in England, would be Matthew Smith, Tommy Flowers, Ron Gilbert, Tim Berners-Lee, Charles Babbage, Clive Sinclair et al. So I would conclude: if your candidate cannot discuss any of the coders Jeff lists, then what you're interviewing is probably not American.

*Not technically true. I'm not actually married but the lady is my gee friend's sister.
**She hates Pot Noodles.***
***I don't. I love them.

Permalink
Share post

Set top box 'Woes' for Show

Visible to anyone in the world

So, my Virgin Media set top box makes me scowl, and here is why because:-

We have Google and it lets us get at pretty much any information in the world, in baby seconds, and all it asks us to do is enter some words in a text box. It is so fast that I suspect if it took ten times as long people would still use it. It is so good that I often find myself entering a website name into Google in favour of hunting through my bookmarks or browser history. Typing "OU" and hitting enter, for example, is about as quick as I can get, or need, when I want to visit the OU website.

We have mobile telephones with a genius text entry mechanism to enable us to write text using just twelve or so keys. Not just clipped text - like teenage girls insist upon - but any passage of text we desire. Except, of course, paragraphs. We can't do them. Well, we can, but it's expensive. And boring. This grammatical martyr aside the language remains intact and full of vim.

Virgin Media, Sky et al... have ten tons of program listings. The remote controls, they give us to command them, have about six buttons per finger. And yet it takes me forty five minutes to establish Poirot is not on. Come on  o' guardians of TV providings. Have you learnt nothing from these technologies? Let us search on program meta data. Just give us a chance...

 

P.S. Whatever happened to the 'previous channel' button on remote controls? The very first remote control we owned had this button, and about the next eight tellies did too. Not anymore though. It was mighty useful and now it's gone. Just like Gamesmaster.

Permalink
Share post

Queen says no to pot smoking FBI members

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:13


Today, at work, I managed to wrangle Windows XP into thinking there was an instance of our in house, single instance, application running when actually it wasn't. Not sure how I did it. Just happened after lots of impatient debugging and process killing but anyway...

Every time I clicked the .exe I got this error message: "An unexpected error has occurred because an operating system resource required for single instance startup cannot be acquired" Boooo. So I Googled it - standard. And I found this page on msdn.

http://msdn.microsoft.com/en-us/library/ms184509(classic).aspx

I'm really not a big fan of Microsoft bashing but I did enjoy their troubleshooting guide:

Microsofts answer to the single instance problem. To correct this error do...

Steps 1 & 2 I liked. Alot. Mostly because I didn't have to do anything and I'm so lazy.

Steps 3 & 4 are the belters. I was tempted to ring them. If only I wasn't so lazy...

 

 

Permalink Add your comment
Share post

I Me Minard

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:13

So my exams are over for the year and this is my first weekend of no OU work. Real nice. The exams went well – I hope – no real problems except I was horrified to see a question in the M359 (Relational Databases) exam regarding views and inserting records into views. Ooof! And I was dismayed that the invigilators spent all their time looking down with their heads buried in paper work. It took an absolute age to get their attention for extra paper and string. Not good...

Spirits remain high though so I thought I’d squirt out a positive note about the OU (having knocked out a couple of negatives ones). It goes way back to my first OU year and M150 (Computing and Information).

To illustrate the importance of symbolic representations and how complex data can be elegantly presented the course introduced a map created by Charles Joseph Minard. The map charts Napoleon’s less than successful 1812 wrangle with Russia. The map is notable because it shows a wealth of information including the army’s direction, location, density, size and the outside temperature during the retreat.

Minards map of Napoleon in Russia 1812

Any developer who has had to create a user interface for some prickly information will know what a battle it is to simplify complex data input or to display complex business information. Especially if you’re unlucky in MI building a report with time on the Y axis, cholesterol level on the X axis, grouped by animal type and hair colour for the first pancake day of each decade etc... Every time I encounter a tricky bit of UI design I always think of this map and its ambition. Simply, whatever design I end up with I always know that Minard would have done it with less controls, less labels and exposed more information.

So thanks to the OU for showing us this map.

 

Permalink Add your comment
Share post

Snot and Bother for M359

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:14

So, I'm busy revising for my M359 (Relational Database) exam. Due to take place in the morning and I've come across some material in Block 4 which illustrates an issue I have with some aspects of the course material, that is, the choice of real world examples

In the OU material good coding best practice and coding concepts seem to appear as disparate ideas, whereas, in a commercial setting it's much more likely that a competent developer will command both in equal measure.

Often, in the course material, I have read about a system or IT approach whilst being told to ignore the usage because it would not occur like this in a real setting. The scenario can then change and rather than the example evolving naturally, like a real business/system, it can't, because we're stuck with a limited abstraction, so instead we are told to simply reverse out some of the functionality and see what happens when we take a different approach. It's an economical way to create a fresh point but I think there are more natural progressions of systems in real business. As an IT professional when the course is concerned with concepts I'm familiar with I don't find it hard to extract the point being made whilst ignoring the implementation but I fear for my skills in enforcing a distinction on those areas of material which I find less comfortable.

The example I came across today is regarding check constraints (They ensure only data of a certain type in admitted into a database either based on other records in the database or the values of the data being inserted). Here is the example given in Block 4 of M359:

a check constraint

I cannot think of a worse example of using a check constraint. This is business logic which should be miles away from the database. Not only is this logic in the database layer it is also coupled with the table definition. Double trouble!

If we want to change the minimum age of a customer we now have to drop this constraint and re-build it but first we've got to find the logic in the first place. A check constraint: the last place I'd look. This is doubly bad because if we attempt to add a twelve year old customer to the system we would expect a nice message to the user along the lines: “Customer too young. You know the rules!”. Instead the database code throws a horrible database exception. We now must either return the exception's message to the user, which would be mind boggling to the average user, or display a generic message along on the lines "The database has sustained a lethal internal injury, sorry you are finished here." So now we have a bewildered user who keeps getting a scary error message every time they add this user.

It is not until we get to Block 5 that we encounter:

...

Constraints are a design choice

...

So the amount of logic we have in our database is a design choice but what are the repercussions of, for example, enforcing a minimum customer age as a check constraint? I personally think this is a bad design choice so the approach needed justifying - all the way to the front end. If there is a code sample you wouldn’t expect to find it in a production environment it should be introduced to the student surrounded with barb wire and dunked in dung.

 

Permalink Add your comment
Share post

Lights Out for Fridge Town

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:14

So, I've been wondering. Of all the cupboards, and shelves, we have in our kitchen why is it only the fridge that gets a light?

Do we need a light in our fridge? Generally speaking my kitchen light goes on if I'm in the kitchen at night. It illuminates all the cupboards just fine...

Permalink Add your comment
Share post

M329 TMA1 DB Question GRrrr

Visible to anyone in the world
Edited by Mitchell Cooper, Tuesday, 7 Sept 2010, 18:14

So, this question bugged the hell out of me:

M359 TMA1 2009

So, let's assume we all know that a tuple is a row and we also know this grid represents a table, and its data in a database. What isn't meaningful about the third row?... I stared and stared. Think think think (pooh). I couldn't see anything wrong with it. After a few minutes I decided I couldn't spend any longer on it. One mark and all that.

And then it dawned on me. The question's all about the order records are stored in a database. Of course! clustered index aside, record order is never known in a relational database. Sure, every time we run SELECT TOP 5 * FROM myTable - without an ORDER BY clause - we can guess the records returned but we should in no way expect it.

The answer then is something like: The order of records in a table can not be guaranteed. Each record is identified by its key, not its order...

So why didn't I like the question? Here it is: The question asks "...about the third tuple..." which surely means we're talking about a problem with the row above. To me this would be clearer if it had been "...about a tuple..." because we're not interested about this particular instance of a tuple. Or maybe even "...about the ninth tuple..." would have been better because at least this way we would have known it's nothing to do with the values above it. Grrrrr over and out.

Permalink 1 comment (latest comment by Perry Mc Daid, Thursday, 17 Sept 2009, 17:46)
Share post

Fun

Visible to anyone in the world
Edited by Mitchell Cooper, Thursday, 19 Nov 2009, 20:35

Is this fun?

 

Promote Your Blog

 

Programming Blogs - Blog Catalog Blog Directory

Permalink
Share post

This blog might contain posts that are only visible to logged-in users, or where only logged-in users can comment. If you have an account on the system, please log in for full access.

Total visits to this blog: 79523