<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cake Solutions Team Blog &#187; training</title>
	<atom:link href="http://www.cakesolutions.net/teamblogs/tag/training/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cakesolutions.net/teamblogs</link>
	<description>void magic() { }</description>
	<lastBuildDate>Tue, 07 Feb 2012 12:02:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Why we come to work at Cake</title>
		<link>http://www.cakesolutions.net/teamblogs/2012/02/02/why-we-come-to-work-at-cake/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-we-come-to-work-at-cake</link>
		<comments>http://www.cakesolutions.net/teamblogs/2012/02/02/why-we-come-to-work-at-cake/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 15:22:21 +0000</pubDate>
		<dc:creator>petere</dc:creator>
				<category><![CDATA[Ian's Blog]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=1971</guid>
		<description><![CDATA[One of the most noticeable attributes of everyone at Cake is the burning desire to acquire, assimilate and utilise as much knowledge about what we do for a living as we can – it’s an addiction in good sense. This &#8230; <a href="http://www.cakesolutions.net/teamblogs/2012/02/02/why-we-come-to-work-at-cake/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the most noticeable attributes of everyone at Cake is the burning desire to acquire, assimilate and utilise as much knowledge about what we do for a living as we can – it’s an addiction in good sense.</p>
<p>This came up as we were closing-out a recent stand-up meeting on an agile project, when the team were excited about some of the functional programming ideas we’d come up with. <em>I love this place…my knowledge increases every day</em> said one of the team, and this got me thinking about why Cake is such a great place to work – we live and learn and do great stuff – and we get paid for it too!</p>
<p>Cake is about to embark on a period of growth, with the opening of our second office, in Oxford. It’s a clear statement of ambition and confidence, and at the same time it’s a big stretch. We need to ensure the <em>Cakeness</em> which makes us special is preserved, especially the knowledge pool. Working for a small company means we have an intimacy about the team, especially individual and collective knowledge, rapport and camaraderie – it’s not like working for a large company, which is like getting on a train with all the other passengers. Are you doing fifty miles and hour or is the train going fifty miles an hour and you’re just standing still?</p>
<p>We’re knowledge and innovation business, operating in the software development market, and consequently everyone wants to make a difference and keep on top of their game. So what drives us in this hunger for knowledge?</p>
<p>You start craving for knowledge and do not leave any source unturned to acquire it. It may be making you and people around you wiser, it could be adding spiritual maturity to you or it could be to improve your capability and fulfilment in your current or future role at work. Whatever your motivation, the mental process of knowing, including aspects such as awareness, perception, reasoning, and judgment are all stimulating and interesting points for self-reflection.</p>
<p>What is it that drives people into the jungles of the unknown? For me it is the mind&#8217;s inner urge to seek more learning, developing points of view and perspectives. The all-absorbing urge for knowledge is one of the thinking person&#8217;s deepest needs, and for me knowledge is interesting in itself and is personal strength, the greatest strength of all. There is much effort in gaining knowledge by everyone of us as we all think that what knowledge we have is insufficient. By understanding ever more knowledge, testing it and experiencing the wisdom in it one can only ever love the thirst. It is knowledge that is truly satisfying to our spirit, it brings us life and ever more greater life. Of course, that depends on your point of view, I’ve heard some people say ‘Ignorance is paradise’, but for me that’s simply not true.</p>
<p>But is the widespread availability of technology generating such wisdom or even improving our learning? Research shows that students using Google and online information portals today are producing work no better than they were 20 years ago using printed sources. Despite amazing technical breakthroughs, these technologies haven&#8217;t added to human knowledge, rather making plagiarism rife and discouraging original thinking and ‘lazy’ research. Information on a plate to satisfy short-term hunger, rather than feeding a yearning for genuine knowledge, and while technology enthusiasts celebrate the destruction of old industries, we&#8217;re left with the banality of Google and Wikipedia.</p>
<p>Of course, e-books are great inventions of convenience, but just like iTunes and digital music downloads, the tactile experience of holding a book in your hands is lost just as the loss of album sleeve notes is no longer part of the experience. However, I realise that after spending my Christmas Amazon vouchers – on a combination of ‘real’ books and kindle e-books – that I’m a collector of books rather than a reader, but feel good about myself in that I have an accumulated stock of future reading and thus a pile of new knowledge to unearth from reading.</p>
<p>Once I’ve done this, I find the tactile experience of finishing a physical book and closing it for the last time produces a mellowness, a warm glow, an inner feeling of contentment and happiness. Ok, we have the web with various blogs and online community sources to reach out and get new knowledge, but there is something about reading a book, the physicality of having it in your hands, that stands out from digital media.</p>
<p>The most wonderful thing that reading offers is a peep into another world. When you pick up a book and lose yourself into it, its like you have transcended your present situation. This temporary escape from our routine life is of great significance when it comes to your mental well-being. We all have day-to-days tasks to take care of, and many a times we go to bed all tense and frustrated and sometimes just downright bored with life. This is when reading comes to our rescue and we should welcome it with open arms if we truly want to be happy and alive. Reading offers us a chance to see the world from someone else&#8217;s eyes, thus broadening our horizons and opening our minds to new possibilities. Reading is to the mind what exercise is to the body.</p>
<p>You emerge out of this trance-like situation, fully refreshed, with a clearer vision and rejuvenated spirit. So the next time you feel as if your mental batteries could do with a recharge, pick up a good book and immerse yourself into for a good hour or so. And mind you, this solution comes with a guarantee card.  Reading is a great imagination booster and it helps develop a sense of creativity in you. It will also help you develop better concentration which we need so bad at all times.</p>
<p><strong>Are there many times in life where you probably find yourself gaining knowledge and coming to a place where everything is working well for you at the given moment because of your newfound awareness……but then it all fall apart again at the next moment?</strong></p>
<p>Sometimes it just makes you wonder what the heck is going on. The reason is because you still haven’t possessed the rest of the awareness you need for it to happen. As you keep learning and growing, you will keep getting more and more pieces of the puzzle so that you are able to acquire better and better mastery in different areas of life for creating your desired reality. Your life will get better and better when you keep picking yourself up in those areas that you have fallen and walk on, and do some great stuff!</p>
<p>But back to Cake, and our knowledge pool, and the point about knowledge, fulfilment and personal progression at work. Think about the formula for the traditional deal at work, which goes something like this:</p>
<p><em>I work&#8230; to earn money&#8230; which I use&#8230; to consume stuff&#8230; which makes me happy.</em></p>
<p>I suggest that this deal is not a sufficient description of what work can and should be. Instead I put forward the following knowledge-based and future-focused deal, which we think makes Cake different:</p>
<p><em>I work&#8230; to gain productive experiences&#8230; to improve my knowledge…that is the basis&#8230; of my happiness.</em></p>
<p>But this begs the question – what exactly is a meaningful productive experience, and how do you know when your work is meaningful? So here are the 10 questions we asked ourselves to establish whether our work at Cake is meaningful, based around knowledge, fulfilment and all the stuff we’ve gone on about above:</p>
<ul>
<li>Do you use the majority of the knowledge you have on a daily basis?&#8230;because meaningful work provides an opportunity for you to keep your knowledge fresh by using it constantly.</li>
</ul>
<ul>
<li>Do you feel intellectually stretched in your work?&#8230;because meaningful work both uses the knowledge you have and pushes the boundaries of what you can become.</li>
</ul>
<ul>
<li>Are you able to learn something new at least once a week?&#8230;because meaningful work creates constant opportunity for learning.</li>
</ul>
<ul>
<li>In your view are your colleagues at work knowledgeable and do you learn from them constantly?&#8230;because meaningful work is also about the colleagues who come with it, and your learning and development comes primarily through learning from others: ‘The Cake Tribe’.</li>
</ul>
<ul>
<li>Are the tasks you do at work interesting and complex?&#8230;because at the heart of meaningful work are the day-to-day tasks that you do.</li>
</ul>
<p>&nbsp;</p>
<ul>
<li>Do you get lots of feedback about how you are doing?&#8230;because meaningful work enables you to grow, and feedback from others is a crucial part of this.</li>
</ul>
<ul>
<li>Do you think that the work you do has a positive impact on the business?&#8230;because meaningful work enables you to make a clear link in your mind between the tasks you perform and the broader goals of the business.</li>
</ul>
<ul>
<li>Do you think that the work you do has a positive impact on society?&#8230;because meaningful work is made up of tasks that you believe do good and, as a consequence, make you feel good about yourself.</li>
</ul>
<ul>
<li>In your daily work, do you have the opportunity to reach out to develop networks with people very different from yourself?&#8230;because meaningful work creates opportunities for you to develop the ‘Big Ideas Crowd’ that is so crucial to developing your innovative and creative capacity.</li>
</ul>
<ul>
<li>Does your work give you time to really develop deep regenerative relationships with people inside and outside of your organisation?&#8230;because meaningful work creates time and space for you to develop emotionally.</li>
</ul>
<p>&nbsp;</p>
<p>So where are you on meaningful work?</p>
<p><strong>Score 8-10</strong> Through your active choices, or sheer luck, you are working in a meaningful way. Cherish the opportunities this provides and don’t compromise in the future.</p>
<p><strong>Score 5-7</strong><br />
Some aspects of your work are meaningful. Take a closer look at those you have said no to and search for the underlying patterns. Is it possible to focus on developing these areas?</p>
<p><strong>Score 1-4</strong><br />
Your job lacks meaning – you already know that! The question is – what are you going to do about it?</p>
<p>So there you have it, an inside perspective of what we think about in Cake when we’re not building great software. Take a look at our blogs, get in touch and join one of our communities, come inside for a conversation where we can share knowledge and do some meaningful work together.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2012/02/02/why-we-come-to-work-at-cake/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Functional training</title>
		<link>http://www.cakesolutions.net/teamblogs/2011/11/23/functional-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=functional-training</link>
		<comments>http://www.cakesolutions.net/teamblogs/2011/11/23/functional-training/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 11:46:27 +0000</pubDate>
		<dc:creator>Jan Machacek</dc:creator>
				<category><![CDATA[Jan's Blog]]></category>
		<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=1331</guid>
		<description><![CDATA[I thought it might be useful to publish our internal Introducing functional programming manual. I am lucky that everyone who wants to work for Cake Solutions is keen to learn new things, and&#8211;to my surprise &#38; immense pleasure&#8211;most people are &#8230; <a href="http://www.cakesolutions.net/teamblogs/2011/11/23/functional-training/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I thought it might be useful to publish our internal <em>Introducing functional programming</em> manual. I am lucky that everyone who wants to work for Cake Solutions is keen to learn new things, and&#8211;to my surprise &amp; immense pleasure&#8211;most people are keen to get started even before their first day in the office! Their questions usually start with something like:</p>
<p><quote>&#8220;My question is whether this is the most logical/efficient approach as per the reading list and updated topics you&#8217;ve given. My revised approach is to approach a little of everything: Haskell, Scala, Akka, AMQP, virtualization, et cetera. I wondered if you had any recommendations&#8230;&#8221;<br />
</quote></p>
<p>Indeed I have.</p>
<h2>What is functional programming</h2>
<p>Functional programming languages help us reason about the outcome of a computation. As you might guess, the core element of functional language is a <em>function</em>; a function in a mathematical sense. A function that takes some input and maps it to some output; we might not be able to see inside a function, but we know that for the same <em>x a function will always give the same </em><em>y</em>. Notice that this is very different from the concept of functions in C, Pascal, Java and others.</p>
<h3>Functions</h3>
<p>Let&#8217;s take what might seem like a detour through mathematics. In mathematics, when I write</p>
<p><em>f</em>(<em>x</em>) = <em>x</em> * <em>x</em>,</p>
<p>I know that <em>f</em>(5) is 25 every time I &#8220;execute&#8221; the function. This gives us a convenient computational model: substitution. Imagine I add another function, <em>g</em>(<em>x</em>) = <em>x</em> + 1. If I now ask you to compute (<em>f</em> o <em>g</em>)(5). You will probably go about this by performing substitution:</p>
<ul>
<li>Compute <em>g</em>(5) by taking the &#8220;body&#8221; of <em>g</em>, substituting every x for 5, giving 5 + 1 = 6,</li>
<li>Substitute <em>g</em>(5) in <em>f</em>(<em>g</em>(5)) with 6, giving <em>f</em>(6),</li>
<li>Compute <em>f</em>(6) using the same substitution process, giving 36 &#x220E;</li>
</ul>
<p>But there&#8217;s another substitution: when computing <em>f</em>(<em>g</em>(<em>x</em>)), swap every <em>x</em> for <em>g</em>(<em>x</em>) in the body of <em>f</em>, giving (<em>f</em> o <em>g</em>)(<em>x</em>) = <em>g</em>(<em>x</em>) * <em>g</em>(<em>x</em>). I can even name the new function and arrive at <em>h</em> = (<em>f</em> o <em>g</em>), which&#8211;following the substitution steps&#8211;is <em>h</em>(x) = (<em>x</em> + 1) * (<em>x</em> + 1). Computing <em>h</em>(5) is (5 + 1) * (5 + 1), which is indeed 36 &#x220E; Good!
</p>
<h3>Non-functions</h3>
<p>Recall that a function returns the same value for the same input, <em>g</em>(5) is 6, <em>g</em>(6) = 7; <em>g</em>(5) is never 7 or 5 (or any other value). Let&#8217;s think of a simple non-function that you are all familiar with: <em>random</em>. If I include <em>random</em> in my function <em>g</em>(<em>x</em>) = <em>x</em> + random, then <em>g</em> is no longer a function. Computing <em>g</em>(5) could return 44 now and 5534345 a moment later. This makes our model of computation much more difficult. Namely, how to compute <em>f</em>(<em>g</em>(5)) with the <em>random</em> element? The two approaches now give different results! I can either compute <em>g</em>(5), remember the value and then supply it to <em>f</em> or I can substitute <em>g</em> in <em>f</em>(<em>x</em>), giving <em>h</em>(<em>x</em>) = (<em>x</em> + random) * (<em>x</em> + random).</p>
<p>Let&#8217;s do the calculations: we can either compute <em>g</em>(<em>x</em>)first, giving</p>
<ul>
<li>Compute <em>g</em>(5) by taking the &#8220;body&#8221; of <em>g</em>, substituting every x for 5, giving 5 + <em>random</em> = 8,</li>
<li>Substitute <em>g</em>(5) in <em>f</em>(<em>g</em>(5)) with 8, giving <em>f</em>(8),</li>
<li>Compute <em>f</em>(8) using the same substitution process, giving 64 &#x220E;</li>
</ul>
<p>Or, I can compute a new function, <em>h</em>(<em>x</em>) = (<em>x</em> + random) * (<em>x</em> + random) and then compute <em>h</em>(5): the first term is (<em>x</em> + random), giving on this occasion 8. The second term, (<em>x</em> + random), gives 14. The result of <em>h</em>(5) is now 8 * 14, giving 112 &#x220E; Oops!
</p>
<h2>Back to code</h2>
<p>After this brief excursion to mathematics, let&#8217;s turn our attention to programming, implementing the functions <code>f</code> and <code>g</code> in Java:</p>
<pre class="brush:[java]">
int f(int x) { return x * x; }
int g(int x) { return x + 1; }
</pre>
<p>Then the compiler cannot reason about the outcome of calling <code>f(5)</code>. All that the Java (and C, Pascal, C#, &#8230;) compiler does is to transform the <code>x * x</code> into the appropriate machine instructions. The machine that executes these instructions is even dumber, it simply executes one instruction at a time, without remembering the instruction that came before it and without knowing the instruction that will follow.</p>
<p>The Java compiler does that mainly because it treats every method as a non-function. So, if I ask Java to compute <code>f(g(5))</code>, it will first compute <code>g(5)</code>, and use the result in as the value of <code>x</code> in <code>f(x)</code>. Partially because of this, Java can never allow me to write <em>h</em> = (<em>f</em> o <em>g</em>). First of all, the Java compiler cannot decide how to substitute <code>g(x)</code> and then Java does not have <em>function</em> as a data type. In other words, I cannot have:</p>
<pre class="brush:[java]">
int f ...
int g ...

int main(...) {
   Function h = f . g;

   h(5);
}
</pre>
<h3>Functions as first-class values</h3>
<p>So, this is the first thing functional languages bring: a function can now be a value; therefore I can assign a function to a variable and then take the variable that represents a function and apply it to some arguments. The concrete syntax differs language by language, but the concept is the same. <em>A function is a value.</em></p>
<h3>Non-pure functions</h3>
</p>
<p>There are differences between the functional languages in the way that they enforce the function-ness. Scala, for example, does not enforce that a function is a function in the mathematical sense. Therefore, in Scala, I can write <code>val f = (x: Int) =&gt; x * x</code> and Scala will create a variable <code>f</code> and set it to be the function that takes an <code>Int</code> and returns a <code>Int</code>. The function <code>f</code> just so happens to be a pure function&#8211;a function in the mathematical sense, whose result depends only on its input. In Scala, I can also create function <code>g</code> that includes the randomness: <code>val g = (x: Int) =&gt; x + (math.random * 1000).asInstanceOf[Int]</code>. The function <code>g</code> takes an <code>Int</code> and returns an <code>Int</code>. Recall though from the previous paragraph that <code>g</code> is not a function in the mathematical sense! This drives how <code>f(g(5))</code> will be computed: Scala will first compute <code>g(5)</code> and then use the computed value as the parameter of the function <code>f</code>. Most of the programmers don&#8217;t find this confusing or counter-intuitive, but it is not &#8220;right&#8221;. It restricts what I can do with the function variables and it fixes the flow of the program.</p>
<h3>Pure functions and pure functional languages</h3>
<p>Now, a pure function is our familiar <code>f</code>, whose result depends only on the value of its argument. Function <code>g</code> is not pure, because its result depends on <em>something other than</em> its argument. Now, there are functional programming languages that enforce that the functions are pure functions. Take Haskell, where the result of a function must depend only on its arguments. In Haskell, I cannot have the function <code>g</code>. So let&#8217;s change the function <code>g</code> back to its trivial form <em>g</em>(<em>x</em>) = <em>x</em> + 1 and write:</p>
<pre class="brush:[c]">
f :: Int -&gt; Int
f x = x * x

g :: Int -&gt; Int
g x = x + 1
</pre>
<p>I can now ask Haskell to compute <code>f(g 5)</code>. It will say 36. But it will compute 36 completely differently. It will start by computing <code>f x</code>, where <code>x</code> acts like a promise to give the value when needed. When evaluating <code>f</code>, Haskell will delay computing the value of <code>x</code> until it needs it. (As it happens, in our function <code>f</code>, we need it immediately, but the pattern remains.) So, in the body of <code>f</code>, when Haskell needs <code>x</code>, it will evaluate <code>g 5</code>. This means Haskell actually computes <code>(g 5) * (g 5)</code>. Obviously, <code>g 5</code> gives 6, so the result of computing <code>f(g(5))</code> is 36. Just like the Java or Scala code, but the difference is the way in which Haskell arrived at the result.</p>
<p>Now, because in Haskell (and other pure functional languages) functions are functions in the mathematical sense, I can easily create compound functions. The particular syntax in Haskell is <code>f . g</code>. This returns a new function whose body we&#8217;ve already seen. I can therefore have code:</p>
<pre class="brush:[c]">
h = f . g
</pre>
<p>Computing <code>h(5)</code> indeed returns 36.</p>
<h3>Higher-order functions</h3>
</p>
<p>Because functions (whether pure or not) are first-class values, there&#8217;s nothing stopping me from accepting functions as parameters of other functions. I can also create functions that return other functions. When a function takes another function as its parameter or when it returns a function, we call it higher-order function. Most of you will have heard of the map-and-reduce algorithm. Let&#8217;s focus on the map part for now. We take some sequence of things and we wish to do something to each thing in the sequence. We could write specialised map-like functions that perform operations such as &#8220;double every element&#8221;, &#8220;add 5 to every element&#8221;, and many more. We could have</p>
<pre class="brush:[c]">
double :: [Int] -&gt; [Int]
double [] = []
double (x:xs) = x * x : double xs

addFive :: [Int] -&gt; [Int]
addFive [] = []
addFive (x:xs) = x + 5 : addFive xs
</pre>
<p>In this case, we have two functions: the <code>double</code> and <code>addFive</code> which take list of numbers and return a list of numbers that have been doubled or have 5 added to them, respectively. But look! Both functions are nearly the same, except that the <code>double</code> function contains code <code>x * x</code> and the <code>addFive</code> function contains <code>x + 5</code>. It would be better if we could somehow inject code to be applied to every element. Remember that functions are first-class values, which we can use as arguments of functions! Let&#8217;s get rid of the <code>double</code> and <code>addFive</code> functions and replace them with a higher-order function <code>map</code>:</p>
<pre class="brush:[scala]">
def map(as: List[Int])(f: Int =&gt; Int): List[Int] =
  as match {
    case Nil  => Nil
    case h::t => f(h) :: map(t)(f)
  }
</pre>
<p>This code is in Scala (thanks to <a href="http://tmorris.net">Tony Morris</a> for the improvement!); I can write similar code in Haskell:</p>
<pre class="brush:[c]">
map' :: [Int] -> (Int -> Int) -> [Int]
map' [] _ = []
map' (a:as) f = f a : map' as f
</pre>
<p>In both cases, I have function <code>map</code> that takes a function that takes a sequence of values of <code>Int</code>s and a function that takes individual <code>Int</code> and returns a new <code>Int</code>. Now I can compute the value of <code>map(List(1, 2, 3))(_ + 1)</code> in Scala (or <code>map' [1, 2, 3] (+1)</code> in Haskell) and get the same result, namely <code>List(2, 3, 4)</code>.</p>
<p>Let&#8217;s complete the introduction by looking at functions that return functions. Such a function is a kind of factory of functions, say depending on the value of its argument. If the argument is 1 then the function should return a function that adds one; if the argument is 2 then the function should return a function that adds two, and so on. For example:</p>
<pre class="brush:[scala]">
def mkf(x: Int) = x match {
  case 1 => {x: Int => x + 1}
  case 2 => {x: Int => x + 2}
  case 3 => {x: Int => x * x}
}
</pre>
<p>This is the code in Scala, we can have the same thing in Haskell&#8217;s syntax:</p>
<pre class="brush:[c]">
mkf :: Int -> (Int -> Int)
mkf x = case x of
         1 -> (\x -> x + 1)
         2 -> (\x -> x + 2)
         3 -> (\x -> x * x)
</pre>
<p>Now, let&#8217;s combine everything together. Let&#8217;s use the <code>map</code> function together with the <code>mkf</code> function to create a truly Frankensteinian monster:</p>
<pre class="brush:[c]">
map' [1, 2, 3] (mkf 1)
</pre>
<p>This Haskell gem will poo out <code>[2,3,4]</code>. It applies the function returned by computing <code>mkf 1</code> to every element in the source sequence <code>[1,2,3]</code>. </p>
<h2>What&#8217;s next?</h2>
</p>
<p>In the next instalment, we will explore type systems. Type systems are not specific to functional systems, but our favourite functional languages, <a href="http://scala-lang.org">Scala</a> and <a href="http://haskell.org">Haskell</a> are both functional and type safe languages.</p>
<p>As a motivation, doesn&#8217;t it bother you that the <code>map</code> function can apply arbitrary function to every element, but we require the elements to be <code>Int</code>s. What if I needed to map <code>String</code>s? Or <code>Customer</code>s? In the next post, you will learn about types; you will understand what we mean when we write:</p>
<pre class="brush:[c]">
map' :: [a] -> (a -> b) -> [b]
</pre>
<p>or </p>
<pre class="brush:[scala]">
def map[A, B](as: List[A])(f: A => B): List[B]
</pre>
<h2>Summary</h2>
<p>In this introduction to functional programming, we found out what the mathematicians call a function. We then looked at how programming languages model the mathematical concept. We discovered that all languages allow us to compute results. Some languages simply spit out instructions that just so happen to arrive at the result. In those non-functional languages, a function is simply a name for a block of code that does something. Functional languages understand the notion of a function, therefore a function is no longer just a block of code, it can be a value. Because a function is a value, it can be passed around and even returned from other functions. Some functional languages go a step further and enforce the pureness of a function. Those language do a lot more reasoning of the control flow in the program.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2011/11/23/functional-training/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Practical Roo</title>
		<link>http://www.cakesolutions.net/teamblogs/2010/08/19/practical-roo/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=practical-roo</link>
		<comments>http://www.cakesolutions.net/teamblogs/2010/08/19/practical-roo/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 15:32:25 +0000</pubDate>
		<dc:creator>Jan Machacek</dc:creator>
				<category><![CDATA[Jan's Blog]]></category>
		<category><![CDATA[Spring Roo]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=641</guid>
		<description><![CDATA[I have the pleasure of introducing another training course: Practical Roo! Huge discount to whoever guesses what the course is about. Actually no, there&#8217;s no discount, but I&#8217;d be happy to send my personal well done note. Now, to the &#8230; <a href="http://www.cakesolutions.net/teamblogs/2010/08/19/practical-roo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have the pleasure of introducing another training course: <b>Practical Roo</b>! Huge discount to whoever guesses what the course is about. Actually no, there&#8217;s no discount, but I&#8217;d be happy to send my personal <i>well done</i> note.<br />
Now, to the course itself. It is a two-day course, you will need some Java experience, it will help if you have done some Spring and AspectJ coding, but it is not strictly necessary. The modules we are covering are:</p>
<h4>Introduction</h4>
<ul>
<li>What is Roo, what does it solve and why do we need it?
<ul>
<li>Roo is a code generator</li>
<li>The generated code follows contemporary Java/Spring style</li>
<li>It is easy to modify / add to the generated code</li>
<li>Roo can re-synchronise with the modified code</li>
<li>It is easy to remove Roo</li>
</ul>
</li>
<li>What Roo isn&#8217;t?
<ul>
<li>Not a multi-module, general purpose tool</li>
<li>Not a one-way code generator</li>
</ul>
</li>
</ul>
<p>[10:00]</p>
<h4>Hello, World</h4>
<ul>
<li>Show Hello, World Roo application (generate &#038; run)</li>
<li>Go through the commands we issue (project, persistence, entity, controller)</li>
<li>Explore the generated source code (the directories, Maven dependencies)</li>
<li>Building Roo applications</li>
<li>The apps don&#8217;t build using javac? WTF?</li>
</ul>
<p>[10:40]</p>
<h4>Spring Framework Primer</h4>
<ul>
<li>What is Spring? </li>
<li>What does it solve?</li>
<li>Its main components</li>
</ul>
<p>[12:30]</p>
<h3>Food!</h3>
<h4>AOP Primer</h4>
<ul>
<li>Why do we need AOP when we have OOP?</li>
<li>Cross-cutting concerns</li>
<li>Pointcuts, Advices, JoinPoints and Aspects</li>
<li>Dynamic weaving (proxies, subclasses)</li>
<li>Static weaving (load and compile-time)</li>
</ul>
<p>[14:30]</p>
<h4>Architecting Hello, World</h4>
<ul>
<li>Roo is not just one-way generator
<ul>
<li>It is very difficult to separate out custom code from the generated one</li>
<li>Roo splits the generated code from the custom code</li>
<li>It uses IDT aspects to simulate .NET&#8217;s partial classes</li>
<li>Roo can re-examine our code and keep its model of the application up to date</li>
</ul>
</li>
<li>Domain objects have persistence methods (just like RoR and Grails)</li>
<li>Domain objects are the core of the application</li>
<li>Controllers use the domain (and the persistence) to manipulate the data</li>
<li>Maven maintains the dependencies and configures the build process (ajc)</li>
</ul>
<p>[16:00]</p>
<h4>Extending Hello, World</h4>
<ul>
<li>Add a service</li>
<li>Add a handler method to the controller</li>
<li>Use &#038; see DI</li>
</ul>
<p>[17:00]</p>
<h3>Sweet, sweet sleep</h3>
<h4>More AOP</h4>
<ul>
<li>AspectJ syntax</li>
<li>Mixins</li>
<li>Compile-time static weaving using the ajc compiler</li>
</ul>
<p>[10:00]</p>
<h4>Exploring different fields</h4>
<ul>
<li>See strings, integers, booleans, dates &#038; friends</li>
<li>Declarative validation, custom validation rules</li>
</ul>
<p>[11:30]</p>
<h4>Associations</h4>
<ul>
<li>Have a Blog and Post relationship</li>
<li>Explore the details of different associations (many-to-one, many-to-many)</li>
</ul>
<p>[13:00]</p>
<h3>Food!</h3>
<h4>Exploring the web tier</h4>
<ul>
<li>Improve the standard data scaffolding</li>
<li>Structure of the generated pages, tiles</li>
<li>Explore the style sheets, JavaScript and AJAX</li>
<li>Roo and REST</li>
</ul>
<p>[14:30]</p>
<h4>Roo and the team</h4>
<ul>
<li>What if you have more people working on the same Roo application</li>
<li>How to share the Roo code, how to keep the generated code and the Roo sources synchronized</li>
<li>Automated builds and tests</li>
<p>[16:00]</p>
<h4>Q&#038;A</h4>
</ul>
<ul>
<li>Interesting goodies for exceptional attendees</li>
<li>Questions</li>
<li>Pet projects</li>
</ul>
<p>[17:00]</p>
<h1>Get booking!</h1>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2010/08/19/practical-roo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Memory management module updated</title>
		<link>http://www.cakesolutions.net/teamblogs/2010/03/17/memory-management-module-updated/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=memory-management-module-updated</link>
		<comments>http://www.cakesolutions.net/teamblogs/2010/03/17/memory-management-module-updated/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 15:57:17 +0000</pubDate>
		<dc:creator>Jan Machacek</dc:creator>
				<category><![CDATA[Jan's Blog]]></category>
		<category><![CDATA[Garbage collection]]></category>
		<category><![CDATA[Java memory management]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=559</guid>
		<description><![CDATA[I have made significant updates to our memory management and garbage collection training module. Previously, I left out the details of the memory manager in the OS and some of the hardware details of the UMA platforms. I also skipped &#8230; <a href="http://www.cakesolutions.net/teamblogs/2010/03/17/memory-management-module-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have made significant updates to our memory management and garbage collection training module. Previously, I left out the details of the memory manager in the OS and some of the hardware details of the UMA platforms. I also skipped the low-level details of the JVM and covered just strong, weak, soft and phantom references. </p>
<p>With the new version of the module, the first attendees are going to explore how deep the rabbit hole <i>really</i> goes! I talk about the various types of memory in a computer, then show how the operating system presents this memory to user processes (see Figure 1).<br />
<a href="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/low-memory.png"><img src="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/low-memory-300x231.png" alt="Low-level memory overview" title="Low-level memory overview" width="300" height="231" class="aligncenter size-medium wp-image-560" /></a><br />
I then take a plunge into memory management in user processes. I start with the simplest memory management strategy: reference counting. Even though it is not applicable to Java and [safe] .NET code, it is still widely used strategy.<br />
Once the reference counting is out of the way, I look at true managed environments. I explore the operation as well as management of the managed heap. The example slide in Figure 2 shows what the JVM does to allocate an object on the heap.<br />
<a href="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/managed-heap.png"><img src="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/managed-heap-300x208.png" alt="Managed heap" title="Managed heap" width="300" height="208" class="aligncenter size-medium wp-image-561" /></a><br />
Next, I show what happens when the JVM frees some objects and I don&#8217;t skim on the details. You will learn about the defragmentation strategies and you will understand exactly why generational heaps are an excellent idea (see Figure 3).<br />
<a href="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/compacting.png"><img src="http://www.cakesolutions.net/teamblogs/wp-content/uploads/2010/03/compacting-300x202.png" alt="Heap compacting" title="Heap compacting" width="300" height="202" class="aligncenter size-medium wp-image-562" /></a><br />
But that&#8217;s not all. Lifecycle of Java objects is not simply active -> freed; Java objects can be finalizable, in which case, the garbage objects fester around until the finalizer thread deals with them. (Does &#8216;festering&#8217; sufficiently convey the fact that finalizers are generally not a good idea? Yes? Good!)</p>
<p>Obviously, I did not remove the content on the reference types and their operation and typical usage. So, after taking this module, you will have a good understanding of what the OS and the JVM does to manage memory. You will also be able to use this knowledge to make your Java programs perform much better by configuring the garbage collector and using the appropriate references in your code.</p>
<p>A word of warning, though: this module is complex and you may be wishing that you did not sleep through those hardware architecture and discrete mathematics lectures!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2010/03/17/memory-management-module-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring 3 training course</title>
		<link>http://www.cakesolutions.net/teamblogs/2009/11/30/spring-3-course/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spring-3-course</link>
		<comments>http://www.cakesolutions.net/teamblogs/2009/11/30/spring-3-course/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 15:45:22 +0000</pubDate>
		<dc:creator>Jan Machacek</dc:creator>
				<category><![CDATA[Jan's Blog]]></category>
		<category><![CDATA["Spring 3 course"]]></category>
		<category><![CDATA["Spring 3 training"]]></category>
		<category><![CDATA[course]]></category>
		<category><![CDATA[Spring 3]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=490</guid>
		<description><![CDATA[It is my pleasure to announce that we now have Practical Spring 3 training course. It is a four-day course aimed at beginner Spring developers. So, if you&#8217;re experienced Java developer and want to learn about the Spring Framework, book &#8230; <a href="http://www.cakesolutions.net/teamblogs/2009/11/30/spring-3-course/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It is my pleasure to announce that we now have Practical Spring 3 training course. It is a four-day course aimed at beginner Spring developers.</p>
<p>So, if you&#8217;re experienced Java developer and want to learn about the Spring Framework, book the course and, in four days&#8217; time, you will be able to create three-tiered Spring 3 web application.</p>
<p>The course outline is</p>
<h3>Anatomy of Spring application</h3>
<p>Why Spring and how does Spring fit into your application.</p>
<h3>What does Spring do?</h3>
<p>Dependency injection and AOP; we explain the dependency injection concepts, bean lifecycle, we sprinkle it with the Spring annotations, including SPEL! We then press on with aspect-oriented programming, showing AOP support in the Spring Framework.</p>
<h3>The workers</h3>
<p>Understand how Spring fits into the data access and middle tiers. We go from JDBC to Hibernate and sprinkle it with a bit of Spring transaction management.</p>
<h3>The web</h3>
<p>Overview of modern web applications; understanding how Spring&#8217;s MVC support makes web programming really easy and efficient. We wrap up with REST support!</p>
<h3>The goodies</h3>
<p>If there is still some time left at the end of the course, we can include large-scale data processing (using JDBC batching and job monitoring); after which, we show that Spring Batch 2.0 offers the solution out of the box!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2009/11/30/spring-3-course/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Base training</title>
		<link>http://www.cakesolutions.net/teamblogs/2008/09/14/base-training/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=base-training</link>
		<comments>http://www.cakesolutions.net/teamblogs/2008/09/14/base-training/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 12:03:25 +0000</pubDate>
		<dc:creator>Jan Machacek</dc:creator>
				<category><![CDATA[Jan's Blog]]></category>
		<category><![CDATA[racing]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.cakesolutions.net/teamblogs/?p=65</guid>
		<description><![CDATA[The racing season is over, the nights are drawing in and it isn&#8217;t raining as much as it did in the summer. It&#8217;s time to do a lot of base training. This means hundreds and thousands of kilometres over the &#8230; <a href="http://www.cakesolutions.net/teamblogs/2008/09/14/base-training/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The racing season is over, the nights are drawing in and it isn&#8217;t raining as much as it did in the summer. It&#8217;s time to do a lot of base training. This means hundreds and thousands of kilometres over the next few months. The aim of the base training is to become much more efficient at fat metabolism; in other words, to be able to give as much power as possible using fat as the energy source. I will be doing low-intensity rides and measuring how much my power output increases.<br />
The ultimate aim of this is to be able to use as much fat as possible during a race. At any moment, I have enough energy in fat for at least 20,000 km of easy riding. During a race to sustain the needed power output, the body uses sugar as main type of energy source. The problem is that even if I fully load my glucose stores (liver and muscles), it will only last for about 30 km. So, if I become more efficient at using fat, I will be able to give full power at 40 km time trial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cakesolutions.net/teamblogs/2008/09/14/base-training/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

