Joss Posted January 28, 2013 Share Posted January 28, 2013 When you are trying to mix disciplines, it is amazingly easy to find they overlap in odd places. I have just been doing a template where I have a foreach statement retrieving values from some blocks. My variable would be, quite understandably $thisblock. In the style that is common with such things, I dutifully wrote: foreach($thisblocks as $thisblock) Then, as I looked at it, and before I could stop myself, the writer side of me kicked in and I corrected it to: foreach($theseblocks as $thisblock) There is no hope for me.... 3 Link to comment Share on other sites More sharing options...
Soma Posted January 28, 2013 Share Posted January 28, 2013 You think there's no hope, but every coder struggles with it. So to say it's THE hardest part of coding. Link to comment Share on other sites More sharing options...
Pete Posted January 29, 2013 Share Posted January 29, 2013 Had a confusing one yesterday as I have a page field called areas and another called sectors (as in business sectors). Because I omitted the word business from the front of sectors and was doing something reasonably complex I created my own pagearray and them had to deal with foreach loops of areas, sectors and areasectors all on the same page. Oh, and services which looks similar to sectors when you're going cross-eyed. I guess the moral of the story for me was to take a break more often and give things more descriptive names for the sake of a few extra characters. Also, if you give a field a singular name as only one option will be selected in your initial plans, don't be afraid to change the name it plural if you then go on to allow multiple selections - you will probably only have to change a small section of code but it will preserve your sanity so you don't do silly things like foreach $page->area as $area as that's the sort of thing I then correct with an s on the end and it all falls apart and much head-scratching ensues Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 29, 2013 Share Posted January 29, 2013 @Joss, having the same problems every project. Much time is spend on variable names. Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 @Joss, having the same problems every project. Much time is spend on variable names. Yeah, but how many times do you check them for English Grammar, like wot I did? Link to comment Share on other sites More sharing options...
onjegolders Posted January 29, 2013 Share Posted January 29, 2013 Yeah, but how many times do you check them for English Grammar, like wot I did? You're old-school Joss. These young'uns don't know they're born! Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 School? Okay, I think I can remember something about a school somewhere ... North London, I believe. I had to do an O-something in Woodwork, I think. Link to comment Share on other sites More sharing options...
dynweb Posted January 29, 2013 Share Posted January 29, 2013 My favorite: http://martinfowler.com/bliki/TwoHardThings.html 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 29, 2013 Share Posted January 29, 2013 @Joss, I think we all use a little bit english grammar in the code we write. But in your example these & this doesn't say anything about the blocks. So if I want to be a bit vague, I would probably/maybe use: foreach( $allBlocks as $block ) Link to comment Share on other sites More sharing options...
apeisa Posted January 29, 2013 Share Posted January 29, 2013 foreach($blocks as $block) 1 Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 And there I was thinking I was making a joke! foreach($blokes as $bollocks) 3 Link to comment Share on other sites More sharing options...
apeisa Posted January 29, 2013 Share Posted January 29, 2013 You don't know what it is like here. Always mixing English and Finnish: foreach($blocks as $palikka) 2 Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 Well, if English were made to work like Finnish it would be foreach($blocks as $thewordthatmeansthosethingsthathurtlikehellwhenyouhithem) Link to comment Share on other sites More sharing options...
DaveP Posted January 29, 2013 Share Posted January 29, 2013 foreach($blocks as $thewordthatmeansthosethingsthathurtlikehellwhenyouhithem) Don't you mean $theWordThatMeansThoseThingsThatHurtLikeHellWhenYouHitThem ? camelCaseSelfDocumentingCode Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 foreach ($accepted as $corrected) But, to be fair, when the Finnish use compound words, they do not put any nice clues in - for instance, where to take a breath! Link to comment Share on other sites More sharing options...
apeisa Posted January 29, 2013 Share Posted January 29, 2013 But, to be fair, when the Finnish use compound words, they do not put any nice clues in - for instance, where to take a breath! Järjestelmä - System Epäjärjestelmä - Unsystem Epäjärjestelmällisyys - Unsystematicality Epäjärjestelmällisyydellinen - Something that is seen as unsystematicality Epäjärjestelmällisyydellistyttää - To make something/-one be seen as unsystematicality Epäjärjestelmällisyydellistyttämätön - One that hasn't made something be seen as unsystematicality / Something that hasn't been made be seen as unsystematicality Epäjärjestelmällisyydellistyttämättömyys - The act of not having made something be seen as unsystematicality Epäjärjestelmällisyydellistyttämättömyydellä - With the act of not having made something be seen as unsystematicality Epäjärjestelmällisyydellistyttämättömyydellänsä - With his/her act of not having made something be seen as unsystematicality. Epäjärjestelmällisyydellistyttämättömyydellänsäkään - Not even with his act of not having made something be seen as unsystematicality. Epäjärjestelmällisyydellistyttämättömyydellänsäkäänkö - Is it not even with his act of not having made something be seen as unsystematicality. Epäjärjestelmällisyydellistyttämättömyydellänsäkäänköhän - I wonder if it's not with his act of not having made something be seen as unsystematicality. source: http://www.finlandforum.org/viewtopic.php?f=9&t=9172 4 Link to comment Share on other sites More sharing options...
Joss Posted January 29, 2013 Author Share Posted January 29, 2013 See what I mean? When I used to do those programmes for Finnish Broadcasting, some of the words used to be the full length of the line. Even Erkki Toivanen (who was Finnish) used to fall over them. "Stupid language!" he used to say. "Who's idiotic idea was it to base the written version on Hungarian!!!!" (or whatever it was based on - long time ago this!) And he was the script writer too.... PS: I should add a little apocryphal story I was told at a party held by Finnish Broadcasting at the Finnish Consulate - one of the most drunken affairs I have ever attended! (This was over 20 years ago, so I hope I do it justice) "Once upon a time, the Finnish people were the happiest people in the world. They loved the cold, they loved the snow and ice, and they were very fond of Reindeer and Vodka (though not necessarily in that order). "Then one day, a very clever Fin said 'We have all this knowledge about Reindeer but we have no way of writing it down - and after all the Vodka, are in severe risk of forgetting it all! Lets invent a written language. "And so they looked for someone who could help, and they found this lovely old chap who had been a teacher in a far away land. They asked him, did he know any written languages and could he invent one for them? Of course he could, he told them, and went away to do it. "The Fins could hardly wait. Perhaps it would be like their Anglo Saxon friends - very clipped and to the point - or like the odd Frenchman they had met with his soft tones and latin. "So, they asked the old man when he arrived with his new dictionary. What language is this based on? "Hungarian. "That was many years ago and now the Fins are sad and fed up with their written language and the amount of vodka they drink has gone through the roof. "They still know a lot about cooking reindeer, however." Link to comment Share on other sites More sharing options...
panictree Posted January 31, 2013 Share Posted January 31, 2013 Epäjärjestelmällisyydellistyttämättömyydellänsäkäänköhän - I wonder if it's not with his act of not having made something be seen as unsystematicality. My goodness me! Longest word I've seen in my life, by quite a margin. Now, I have to say I visited Finland some years ago and really liked how Finnish sounds. It was so different to anything else I had been exposed to (language wise), that I simply loved it! Link to comment Share on other sites More sharing options...
Joss Posted January 31, 2013 Author Share Posted January 31, 2013 Oh, the Fins I worked with were great, but they came with a health warning. They could REALLY drink! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now