Dr. Livingstone, I presume?
~ Greeting of H. M. Stanley (on locating and meeting David Livingstone in Africa)
No one has ever quoted me back to me before.
~ When Harry Met Sally (The 1989 American romantic comedy movie by Nora Ephron)
Till love that was, and love too blest to be,
Meetâand the junction be Eternity?
~ Emily Dickinson (In XIX, from The Complete Poems of Emily Dickinson)
…a blending of concepts that achieve a greater whole when combined. In particular, three dichotomies…: static typing versus expressiveness, functional programming versus object-oriented programming, and powerful language features versus dead simple Java integration.
~ Joshua Suereth (Scala in Depth, Manning Publications)
Meet tranquilly as friends,
Salute and pass without a hintâ
And there the matter ends.
~ Dickinson, Emily (In VII, from The Complete Poems of Emily Dickinson)
When the worlds of object orientation and functional programming collide, there can be awkward moments. Imagine, if you will, object orientation meeting the functional style of programming for the first time. The silence is deafening, both desperately trying to break the ice. Object Orientation finally plucks up the courage and, sounding a polite note of civilized diffidence, innocently asks, “Functional, I presume?” đ In less ethereal realms, we can look to a more tangible example, perhaps most memorably captured by Vaughn Vernon in the preface to his book Reactive Messaging Patterns with the Actor Model: Applications and Integration in Scala and Akka where he hastened to comfort us in the knowledge that
…if Functor and Monad sound like viruses you caught as a child, steer clear of scalaz for a while.
Originality does not consist in saying what no one has ever said before, but in saying exactly what you think yourself.
True Ease in Writing comes from Art, not Chance,
As those move easiest who have learn’d to dance
Writing a book is a horrible, exhausting struggle, like a long bout of some painful illness. One would never undertake such a thing if one were not driven on by some demon whom one can neither resist nor understand. For all one knows that demon is simply the same instinct that makes a baby squall for attention. And yet it is also true that one can write nothing readable unless one constantly struggles to efface one’s own personality. Good prose is like a windowpane.
Oh, East is East and West is West, and never the twain shall meet,Till Earth and Sky stand presently at God’s great Judgment Seat;But there is neither East nor West, Border, nor Breed, nor Birth,When two strong men stand face to face, though they come from the ends of the earth!
If you need an extreme programming model and are willing to pay the price of learning the language, Clojure is a great fit. I think this is a great language for disciplined, educated teams looking for leverage. You can build better software faster with Clojure.
Thereâs a joke in the Haskell community that they have delayed success until the last possible minute.
The authors were, of course, relating that joke while educating us in the finer points of lazy evaluation, in particular the use of data structures with lazy evaluation, such as Scalaâs Stream type, pointing out how a few functional languages, like Haskell, are lazy by default.
Scala provides the tools needed to blend the object-oriented and functional programming worlds. Scala is at its best when these two evenly share a codebase. The biggest danger to misusing Scala is to ignore its object orientation or its functional programming. But combining the two is the sweet spot that the language was designed to fulfill (italics mine).
The book promotes the blended style of Scala, where paradigms are mixed to achieve something greater (italics mine).
Let’s remember also how, in praising Scala, James Gosling, father of the Java programming language, once remarked that
If I were to pick a language to use today other than Java, it would be Scala.
It pays to listen when smart people are talking đŻ
…I think we agree that all languages inevitably carry some baggageâit’s the relative degree of the conceptual burden that a programmer has to bear, when using the model of a given language, which sets a language apart from others. To put this in more concrete terms, allow me to share an anecdote based on my half-dozen years of programming in C++. With all due respect to those for whom the experience of programming in C++ is a pleasant and productive oneârather than the harrowing torment of Sisyphus, penitently toiling away at pushing the boulder uphillâgiven the bewildering variety of rules, exceptions-to-said-rules, which is the conceptual burden that a C++ programmer has to bear.
The setting for my half-dozen years of programming in C++ was the beautiful state of Minnesotaâbeautiful, but the harsh, frigid winter season, however, seemed to stretch interminably each yearâso the more I would try to warm up to C++, the more that recalcitrant mule of a stubborn language would dig in its heels, responding with nothing but mirthless frostiness… â
Because a constructor of this type operates By Order of Arguments, it is sometimes known as a BOA constructor đ (italics, bold, and the serpent are all mine).
We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp đ
Through some very elegant design choices and simple yet powerful abstractions that were taken from the object-oriented and functional programming worlds, Martin Odersky has managed to create a language with high cohesion and orthogonal, deep abstractions that invites composability in all dimensions of software design. Scala is truly a SCAlable LAnguage that scales with usage, from scripting all the way up to large-scale enterprise applications and middleware (bold is mine).
You are about to learn how to write reusable components using mixin and function composition; how to write Reactive applications using Akka; how to make effective use of advanced features in Scala such as macros and higher kinded types; how to utilize Scalaâs rich, flexible, and expressive syntax to build domain-specific languages; how to effectively test your Scala code; how to let Scala simplify your Big Data problems; and much, much more (italics mine).
These improvement to the Java 8 platform are very exciting for Scala, and it’s very rewarding to see Java align with the trend Scala has been setting for over a decade! There’s no doubt that Scala provides a much better functional programming experience, with immutability by default, a uniform treatment of expressions (there’s hardly a return statement in sight in this book), pattern matching, definition-site variance (Java’s use-site variance make function subtyping quite awkward), and so on! To be blunt, there’s more to functional programming than nice syntax for lambdas (italics mine).
Itâs worth noting that Java is best regarded as having support for âslightly functional programming.â It is not an especially functional language, nor does it try to be.
Java is fundamentally an object-oriented language. However, with the arrival of lambda expressions, it becomes much easier to write code that is closer to the functional approach.
The first taste of functional programming that Java developers are likely to encounter are three basic idioms that are remarkably useful … (eliding here the delightfully succinct coverages of filter(), map(), and reduce()… Java has full support for these key functional idioms (and several others).
…easy access to the basics of functional programingâand especially idioms such as map, filter, and reduceâis a huge step forward for the Java community. These idioms are so useful that a large majority of Java developers will never need or miss the more advanced capabilities provided by languages with a more thoroughbred functional pedigree.
Everyone involved in a software project has to learn as it progresses. For the project to succeed, the people involved have to work together just to understand what theyâre supposed to achieve, and to identify and resolve misunderstandings along the way. They all know there will be changes, they just donât know what changes. They need a process that will help them cope with uncertainty as their experience growsâto anticipate unanticipated changes.
We think that the best approach a team can take is to use empirical feedback to learn about the system and its use, and then apply that learning back to the system. A team needs repeated cycles of activity. In each cycle it adds new features and gets feedback about the quantity and quality of the work already done. The team members split the work into time boxes, within which they analyze, design, implement, and deploy as many features as they can.
â… you have nothing to lose but your bugsâ đ
Developers spend far more time reading code than writing it, so thatâs what we should optimize for… đ
Stop Me If Youâve Heard This One Before: This book is about the techniques of using tests to guide the development of object-oriented software, not about specific technologies đŽ
The catch is that few developers enjoy testing their code. In many development groups, writing automated tests is seen as not ârealâ work compared to adding features, and boring as well. Most people do not do as well as they should at work they find uninspiring… đČ
Test-Driven Development (TDD) turns this situation on its head. We write our tests before we write the code. Instead of just using testing to verify our work after itâs done, TDD turns testing into a design activity đł
At last a book, suffused with code, that exposes the deep symbiosis between TDD and OOD. The authors, pioneers in test-driven development, have packed it with principles, practices, heuristics, and (best of all) anecdotes drawn from their decades of professional experience. Every software craftsman will want to pore over the chapters of worked examples and study the advanced testing and design principles. This oneâs a keeper.
Scala is a functional programming language, but it is also an object-oriented programming language like Java, Python, Ruby, Smalltalk, and others. Iâve waited until now to explore Scalaâs âOO sideâ for two reasons.
First, I wanted to emphasize that functional programming has become an essential skill set for modern problems, a skill set that may be new to you. When you start with Scala, itâs easy to use it as a âbetter Java,â a better object-oriented language, and neglect the power of its functional side.
Second, a common architectural approach that Scala promotes is to use FP for programming in the small and OOP for programming in the large. Using FP for implementing algorithms, manipulating data, and managing state in a principled way is our best way to minimize bugs, the amount of code we write, and the risk of schedule delays. On the other hand, Scalaâs OO model provides tools for designing composable, reusable modules, which are essential for larger applications. Hence, Scala gives us the best of both worlds (italics mine).
Only connect! That was the whole of her sermon.
Only connect the prose and the passion, and both will be exalted,
And human love will be seen at its height.
Live in fragments no longer.
Only connect…
Only the paradox comes anywhere near to comprehending the fullness of life.
The three intermissions have changed to follow the developing relationship between the original Pac-Man and Ms. Pac-Man (from when they first meet to having a stork drop off their baby); the latter later served as the attract opening sequence for Jr. Pac-Man.
When two of them meet, they are no longer two.
They are one and six hundred thousand.
The ocean waves are their closest likeness,
when wind makes, from unity, the numerous.
This happened to the sun, and it broke into rays
through the window, into bodies.
The disc of the sun does exist, but if you see
only the ray-bodies, you may have doubts.
The human-divine combination is a oneness.
Plurality, the apparent separation into rays.
Friend, weâre traveling together.
Throw off your tiredness. Let me show you
one tiny spot of the beauty that cannot be spoken.
Iâm like an ant thatâs gotten into the granary,
ludicrously happy, and trying to lug out
a grain thatâs way too big.
Hi Akram, I think a lot of us were introduced to the wave/particle-like duality of OO/FP by Scala. What I think is unique about Scala is that Odersky managed to deftly weave a functional syntax on top of the traditional OOP bedrock of Java. E.g.:
– Objects/traits with type parameters -> function objects with arrow syntax
– Classes -> immutable data with case class syntax
– Method parameters -> implicit syntax and then typeclasses
– Static unapply method -> (extensible) pattern matching
– And so on.
If you haven't already, take a look at OCaml because it's the only other functional language which blends OOP in as well as (or even better than) Scala: https://realworldocaml.org/v1/en/html/objects.html
You may be interested in the following passage from Peter Seibel's book Coders at work:
'Seibel: What's your short list of ones you want to play with more?
'[Joshua] Bloch: I want to try Scala, though I have some doubts as to whether it will be the next big thing. I have great respect for Martin Odersky. I think there are a bunch of neat ideas in the language. But I also think it may be too complex and too oriented towards academics to succeed in the world at large. I have no right to say that, though, because I haven't learned it yet.'
– Hi Yawar, thank you for those deeply thought out, insightful observations. Other readers, and me, get educated tremendously in the process, as readers like you make the time to participate and improve the reading and programming communities, my blog included đ
– I thoroughly enjoyed reading how you draw parallels, and very aptly so, between the wave/particle-like duality and the blend of OO/FP in Scala! And what a coincidence, because just the other day I was reading a delightful treatment of this precise subjectâthe wave/particle-like duality you mention and whichâin the highly readable book called The Outer Limits of Reason: What Science, Mathematics, and Logic Cannot Tell Us (MIT Press) by Noson S. Yanofsky. Referring to the famous double-slit experiment, Yanofsky reminds us in stark terms the message of legendary Amercian physicist and Nobel laureate (the late Richard Feynman) in these words:
"We choose to examine a phenomenon which is impossible, absolutely impossible, to explain in any classical way, and which has in it the heart of quantum mechanics. In reality, it contains the only mystery. We cannot make the mystery go away by âexplainingâ how it works. We will just tell you how it works".
– Ah, the limiting factors in our lives… So space limitationsâyep we are ever so briefly digressing to talk about a book with the words "outer limits" in its titleâwill not permit my delving into the details, though I can't help but remark on the irony of it all, since this blog has the words Programming Digression in it lol.
– Anyhow, to bring closure to the point that Yanofsky is making about the blended nature (aka the wave/particle-like duality) of light, he remarks on a seemingly inexplicable aspect of the double-slit experiment, noting that
"Now, for the amazing aspect of this experiment and probably the most mind-blowing result in all of science. Physicists have a way of performing this experiment by releasing one piece of light at a time… The remarkable aspect is that an interference pattern is still found…. How can this be? When we have many photons, we can say that the photons are interfering with each other like waves in a pond. But when each photon is released one at a time, what can a single photon interfere with to create such a pattern? The answer is that the single photon interferes with itself… How can one object pass through both slits simultaneously? That is the major mystery of quantum mechanics".
– Cool stuff, which I invite interested readers to check out that book, and others, from the stellar MIT Press đ
– To your point about what is unique about Scala (i.e. in your own words: "Odersky managed to deftly weave a functional syntax on top of the traditional OOP bedrock of Java"). I find myself nodding in agreement as I read your first class observations, which I reproduce here to situate them in the context of my reply:
* Objects/traits with type parameters -> function objects with arrow syntax
* Classes -> immutable data with case class syntax
* Method parameters -> implicit syntax and then typeclasses
* Static unapply method -> (extensible) pattern matching
* And so on.
– Speaking of OCaml… Honestly, I know more languages than I know what to do with, lol. This is awesome, though: I hadn't quite realized that OCaml blends OOP with FP! Thank you for sharing the pointer. While browsing online at O'Reilly, I had come across their book called Real World OCaml: Functional Programming for the Masses but never got around to checking it out…
– Adding a few more thoughts…
– And then there is the remarkable volume by UPenn professor Benjamin Pierce (Professor of Computer and Information Science at the University of Pennsylvania) called Types and Programming Languages (MIT Press) in whose pages the glory of the lambda calculus is writ large… Yep, the whole mathematical machinery is in there, readers. So I pulled out my copy of the bookâlit up as it is with scores of brightly colored tape flagsâfrom one of my bookshelves and see that it makes mention of how "…The chapters on concrete implementations of typecheckers present significant code fragments in OCaml (or Objective Caml), a popular dialect of ML".
– Speaking of type theory, and its under-recognized (neologism alert?!) centrality to the craft of programming, I can only remind the interested reader that, over the last two decades type theory has emerged as the central, unifying framework for research in programming languages. I also invite you to check out its refreshing applicability to Scala in my review of Scala in Depth, a rather amazing language brought to us programmers by, of course, Martin Odersky.
– Oh goodness, I recall now that Pierce even mentions the programming language ML đ
– And speaking of ML, Chris Okasaki's sparkling gem of a book entitled Purely Functional Data Structures (Cambridge University Press) is replete with some of the highest quality ML on this planet. For those not familiar with Okasaki amazing work at Carnegie Mellon Universityâwhich is where he earned his Ph.D. under advisers Daniel Sleator, and Robert TarjanâPurely Functional Data Structures goes into the guts of vitally indispensable FP data strucutures. The book description succinctly reminds us how
"Most books on data structures assume an imperative language like C or C++. However, data structures for these languages do not always translate well to functional languages such as Standard ML, Haskell, or Scheme. This book describes data structures and data structure design techniques from the point of view of functional languages. It includes code for a wide assortment both of classical data structures and of data structures developed exclusively for functional languages.This handy reference for professional programmers working with functional languages can also be used as a tutorial or for self-study".
– And please don't anyone even get me started digressing on ML đ
– My paperback copy of ML for the Working Programmer, 2nd Edition (Cambridge University Press) by L. C. Paulson is not too far from where I sit at this moment. So my buddy and brilliant fellow programmer Josh (Suarez) one of the handful of programmers I know who actually took a university course that used ML as the vehicle of programming instruction; the rest of us learned the quixotic language fromâyes you guessed itâPaulson's ML for the Working Programmer…
– I'm happy, Yawar, that you mention one of my all-time favorite books, namely Coders at Work: Reflections on the Craft of Programming (Apress) by Peter Seibel! Since you mention Seibel's interview with Joshua Bloch-each of my paperback copies of his first and second edition of the outstanding book Effective Java (Addison-Wesley) are falling apart at the seams from overuse-it got me thinking to another one of Seibel's interviews (in the book), that one with Guy Steele, who happens to be one of my programming heroes, widely regarded as the father of Common Lisp, and of course the lead author of the Java Language Specification. BTW, a third edition of Bloch's Effective Java is in the works, stay tuned (Java 7 and Java 8 changed things dramatically, and Java's increased support for multiple paradigms increases the need for best-practices advice, and the third edition, when it hits the bookstores, is supposed to deliver).
– Finally, thanks also for sharing an apt excerpt from Bloch's reply in his interview with Seibel (in Coders at Work). I dug up my well-worn copy of Coders at Work, and found, elsewhere in the same interview, this intriguing reply by Bloch in response to a question by Seibel:
"The jury is basically still out on anything that hasn't been tested by a huge quantity of programmers under real-world conditions. Often languages only succeed in some niche and people say, âOh, they're great and it's such a pity they didn't become the successful language in the world.â But often there are reasons they didn't. Hopefully some language that does use declaration-site variance, like Scala or C# 4.0, will answer this question once and for all".
– Looking forward to future comments and observations from you, as well as from other readers!
Thank you for the nice article here. Really nice and keep update to explore more gaming tips and ideas.
PS4 Game Tester
Game Testing Services
Video Game Testing Companies
You are so awesome! I don't believe I have read something like this before.
So wonderful to find someone with some unique thoughts on this topic.
Seriously.. thank you for starting this up. This website is
one thing that's needed on the internet, someone with a bit of originality!
Writers ⊠use the same words everyone uses, but when we get it right, the emotions, the feelings, the concepts, the images, the ideas are distilled with clarity and force. Then nobody notices our words. ⊠Like cleaning a window. When you do it right, and the light shines through and you donât notice the glass. (Angels in Red Suspenders, 1998)
Keep cranking out your prose, my friend, and keep the light shining through!
Mobile app testing service is a vital part of every software product development project. However, not everyone is a professional software tester, or not many people are willing to spend their time as one. This is where a software testing service can help. Companies that use software tester services save thousands of dollars a year by using only high quality testers. Most professional software testers charge thousands of dollars per test. Yet, if you use a good tester, the cost is much lower. There are many benefits to using a testing service.