They say you learn something new every day.

Posts tagged ‘ideas’

Pie Design (09/03/2012)

Possibly the worst, and most obscure pun yet, this title.

So, the other day I mentioned I’d started unconsciously hoarding things

The things I’d been hoarding were these Tesco packaging designs because… well, I think they’re really good, and I like the idea.

 

 

 

I like the font, I like the plain background colour and I particularly like showing images of the ingredients.

That, I think is a really good idea. Obviously, they didn’t put the gravy in a gravy boat and pour it in, but it works so well. It’s created a “brand” of meals as well – they’re all clearly the same, yet different colours.

Ingredients lists are, of course, mandatory, and a little boring. But here, rather than showing a picture of the product, as you usually would, showing the ingredients really turns them round. I really like them. Like my quotes list, it’s not so much “something” I’ve learnt, as a really good idea, and something I think I should remember when I’m next designing something.

A Touch of Class (17/02/2012)

I think I suddenly understood classes and objects today.

I get this quite a bit with coding concepts. Or maybe concepts in general. I leave them mulling over in my head, and then suddenly, one day, I get them,

I think no one has ever really explained objects very well, and I think a key part of that is that I never got when I would use one. I think the fact that you don’t really need them makes it even harder.

But classes are basically like multiple functions in one. Here’s a demo one I built to explain them to myself:

Class TVProgram

Public StartTime
Public Test
Public ProgramTitle

Public Property Get ProgramDate
ProgramDate = Day(Test) & ” ” & MonthName(Month(Test)) & ” ” & Year(Test)
End Property

End Class

Set objTVShow = New TVProgram
objTVShow.StartTime = CDate(“17:30”)
objTVShow.Test = DateSerial(1999,9,17)
objTVShow.ProgramTitle = “TV Show”

wscript.echo objTVShow.ProgramDate & ” – ” & objTVShow.Test

So the first few lines:

Public StartTime
Public Test
Public ProgramTitle

Are like the Function variables. You assign values to these.

Public Property Get ProgramDate

Is like the Function output. You can have several of these in one class, and this is the real value to them and the thing I don’t think I got until now: classes are like functions with lots of outputs. This means you can define different outputs with the same data, or different parts of output for the same idea.

It gives me a nice warm feeling when I suddenly understand something like this. And it makes me wonder why I never understood it before. However, I think part of this comes from the fact no one ever really says what classes actually are:

You can use classes to describe complex data structures. For example, if your application tracks customers and orders, you can define two classes for them, each with a unique set of internal data (typically called properties) and functions (typically called methods). You can then manage customers and orders as if they were native VBScript subtypes. More important, because you assign a class its properties and methods (i.e., its programming interface), you have an object-oriented tool to improve VBScript applications.

Does that really help in any way? Or does that leave you even more confused by what they’re actually talking about?

Tag Cloud