Subscribe: Pragmatic Studio
Added By: Feedage Forager Feedage Grade B rated
Language: English
app  application  countdown timer  elixir otp  elixir  elm  file  javascript  mike  otp  project  rails  start  time  timer  video 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Pragmatic Studio

The Pragmatic Studio

Top developer training from the folks who wrote the books

Updated: 2017-11-21T00:00:00Z


Thanksgiving Sale: Save 40% On All Courses



This Thanksgiving holiday you can save 40% on all our courses, including:

Use coupon code THANKS2017 through midnight on Friday, December 1st.

THANK YOU for supporting our small business this year!

Elixir/OTP Course Launches!



If you’ve been waiting to snag your copy of the Developing With Elixir/OTP course until it was complete, your wait it over!

In this course, you’ll see and experience Elixir/OTP development in action. For software developers, learning within this context of building a real application makes a huge difference!

By developing a real app with real code, you’ll gain practical experience putting all the pieces together to craft applications the Elixir way.

The full course includes:

  • 6.5 hours of step-by-step live coding
  • 15 animations that break down advanced concepts
  • 35 videos - streamable and downloadable
  • 56 hands-on exercises with all the solutions, of course
  • Never-ending access (no monthly subscription!)

⭐️   Use coupon code ELIXIRLAUNCH to save 10% off the special launch price through October 8th. Got a whole team that needs to quickly master Elixir for an upcoming project? Save 40% by getting a team license for up to 10 developers.

Integrating Elm with Rails 5.1


Rails 5.1 makes it easier to sprinkle bits of Elm into your Rails app, or even to go all in with Elm! Here’s a quick rundown of how to start using Elm with Rails: First, create a new Rails 5.1 app using the --webpack option: rails new elm_on_rails --webpack Next, change into the generated application directory and install everything needed for Elm with the help of Webpacker: rails webpacker:install:elm This runs elm package install which downloads and installs the Elm packages elm-lang/core, elm-lang/html, and elm-lang/virtual-dom. Now pop open an editor in the application directory and navigate to the app/javascript/packs directory. You’ll find a generated Main.elm file that displays “Hello Elm!” text. You’ll also find a companion hello_elm file that embeds the output of Main.elm in the HTML document: import Elm from './Main' document.addEventListener('DOMContentLoaded', () => { const target = document.createElement('div') document.body.appendChild(target) Elm.Main.embed(target) }) You need a page to display the Elm output. Any page will do since hello_elm embeds the output in the current document. I ended up making an app/views/application/index.html.erb file. In that file, use the javascript_pack_tag helper to import the hello_elm file: <%= javascript_pack_tag "hello_elm" %> Then I added a default route in config/routes.rb to that page: get '/', to: 'application#index' Game time! Fire up the Rails server: rails s In development, you also need to run a Webpack Dev Server in a separate terminal so that Elm files are automatically compiled as you make changes: ./bin/webpack-dev-server Browse over to http://localhost:3000 and you should see the “Hello Elm!” greeting. Countdown Timer To kick things up a notch and see another example, here’s how to integrate the countdown timer we build in our free Integrating Elm course: Paste CountdownTimer.elm and countdown_timer into the app/javascript/packs directory. Notice that the countdown_timer file embeds the timer in a DOM element with the id of countdown-timer: import Elm from './CountdownTimer' document.addEventListener('DOMContentLoaded', () => { const target = document.getElementById('countdown-timer') Elm.CountdownTimer.embed(target, { deadline: "May 30 2017 14:05:00" }); }) Import countdown_timer in your app/views/application/index.html.erb file and add an element with the id of countdown-timer: <%= javascript_pack_tag "countdown_timer" %>
The countdown timer relies on a touch of style, so paste timer.css into the app/assets/stylesheets/timer.css file. Reload and the timer should start ticking down! Bonus: Use Foreman In development, you can sidestep having to run the Webpack Dev Server separately by using the foreman gem. Add the gem to your Gemfile: gem 'foreman' And install it: bundle install Then create a Procfile in the top-level application directory with the following two lines: web: ./bin/rails server webpack: ./bin/webpack-dev-server Now you can start the Rails server and the Webpack Dev Server in one fell swoop using: foreman start It’s never been easier to integrate Elm into a Rails app, and I suspect it will only get smoother from here! Build a complete Elm web app from start to finish! Quickly get up to speed with Elm and functional programming as you build a reactive web app step-by-step in our 3.5-hour Building Web Apps With Elm video course. You go from a new project to talking to a JSON API, and everything in between! [...]

Transforming Data with Elixir


Elixir has really changed the way we think about programming. Instead of thinking about objects and calling methods that change their state, we now think more in terms of functions that transform data. An HTTP web server is a great example of the Elixir way of doing things. At a high level, a web server takes a request and, through a series of transformations, produces a response. In this video from our new Developing With Elixir/OTP course, we set up a pipeline for those high-level transformations so we have a basic outline of our program. src="//" width="960" height="540" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""> The program doesn’t do anything interesting yet—the functions simply return hard-coded data. But we like to start this way as it helps us think through the program as a series of data transformations. In the video, we started by sequencing the three transformation functions in a traditional style using intermediate variables: def handle(request) do conv = parse(request) conv = route(conv) format_response(conv) end You could condense this a bit and remove the temporary variables by nesting the function calls like so: format_response(route(parse(request))) But this is difficult to read since the functions resolve from the inside out. Using the pipe operator lets us unwind these nested calls by chaining the functions together in a more readable style: request |> parse |> route |> format_response It transforms the request by piping the result of each function into the next function. Here’s a fun fact: At compile time this code is transformed to the nested call version. If you’re making the change from OO programming to functional programming, one of the big differences is learning to think in terms of transforming data. You’ll see a lot more examples of this throughout the course. In the next several modules, we’ll implement each of these functions so that an appropriate response is returned for different types of requests. Build a complete Elixir/OTP app from start to finish Put Elixir and OTP into action as you build a concurrent, fault-tolerant application from scratch in our 6.5-hour Developing With Elixir/OTP video course. By developing a real app with real code, you'll gain practical experience putting all the pieces together to craft applications the Elixir/OTP way. [...]

Up and Running Elixir


Creating an Elixir project and running code is straightforward thanks to good conventions and solid tooling. It’s impressive when you consider what’s going on under the hood: compiling Elixir files into byte code that is then run on an instance of the 20-year-old, battle-proven Erlang VM. In this video from our new Developing With Elixir/OTP course, we walk through setting up a project and various ways to run Elixir files: src="//" width="960" height="540" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""> Here’s a quick recap of the commands we used in the video to run an Elixir file: Run the elixir command with the relative path of the Elixir file: elixir lib/servy.ex The file gets compiled into bytecode (in memory) and then run on an Erlang virtual machine. Fire up an iex (Interactive Elixir) session and then use the c helper function to compile and run the file: iex iex> c "lib/servy.ex" The c helper function compiles the given file in memory, the module (Servy in this case) is loaded into the session, and any code outside of the module is interpreted. To exit the iex session, press Ctrl+C twice. Alternatively, you can tell iex to interpret an Elixir file while starting by passing the relative path of the file: iex lib/servy.ex When you start a standard iex session, it doesn’t know about the paths and dependencies of a mix project. So to start a session in the context of a project, you need to pass the -S mix option: iex -S mix Finally, to recompile a module while in iex, use the r helper function: iex> r Servy This recompiles and reloads the given module, which is Servy in this case. Build a complete Elixir/OTP app from start to finish Put Elixir and OTP into action as you build a concurrent, fault-tolerant application from scratch in our 6.5-hour Developing With Elixir/OTP video course. By developing a real app with real code, you'll gain practical experience putting all the pieces together to craft applications the Elixir/OTP way. [...]

Rails in 2017, For Reals?


Based on all our talk about Elm and Elixir recently, you may be wondering if we’ve kicked Ruby and Rails to the curb. Absolutely not!

We continue to use Rails every day for the same reasons we created our first Rails app 13 years ago and taught our first Rails course 12 years ago. When it comes to Rails, all the batteries are included. Out of the box, it just works. Any 5-year old will tell you that’s a huge selling point. Crack it open and start building an application that matters. It doesn’t force us to start by making arbitrary decisions about external libraries and tooling. That’s a recipe for procrastination. We want to make real progress.

Now, perhaps more than ever, we appreciate software that’s designed with intelligent defaults and sensible conventions. And you might think that after more than a decade this would be the norm. Surely any modern web development framework would deliver a similar out-of-the-box experience, right? And yet that doesn’t seem to be the case.

Rails continues to set a high bar in terms of fulfilling the promise of an integrated, full-stack framework. Equally impressive after all these years, Rails is still being actively developed and improved while holding true to the same core principles that guided its creation.

We will always look for the right tool for the job, and while Rails is no longer the media darling it once was, in many cases it’s still our go-to web development framework. So although we come at this from a different perspective than Rails’ creator David Heinemeier Hansson, we’re both bullish on Rails in 2017 and beyond.

Ruby and Rails Master Package Deal

If you're ready to dive into developing with Ruby and Rails this year, there's no better set of courses to put you on a path to success than our 4-course master package. You'll learn all the key fundamentals, advanced features and techniques, and best design principles. You'll get:

  • 96 videos (streamable and downloadable)
  • 17 hours of content
  • 86-chapter workbook with step-by-step exercises
  • updated for the latest versions of both Ruby and Rails
  • one low price (no subscription, no expiration)
  • 25% savings over buying each course individually 

Integrating Elm at Clarity Voice (Part 2)


When we last left Mike Onslow, he had rolled out two small, but successful, pilot Elm projects at Clarity Voice. (Part 1) Now he was eager to try a bigger project. But bigger would mean more visibility and, up to this point, he had flown under the radar. Starting with small, low-risk projects, Mike had been able to get hands-on experience with Elm and he’d discovered: “When we built our initial Elm apps, they compiled, and worked right away. And then, when we updated these Elm apps, not only could we do it faster, but again, they just compiled and worked. Elm gave us such a good development and deployment environment!” But Mike knew that management would still be reluctant to move forward with Elm on larger projects. They were likely to ask: “Do you want to use Elm just because it’s the latest thing?” Sometimes the shiny new things are actually better. But no, that wasn’t the reason Mike wanted to use more Elm. “New” and “latest” do not qualify a technology for adoption. Good developers know to be skeptical of hype and rely instead on actual experience. That’s what Mike did. From his experience with the first two pilot projects, he collected data points: QA issues to date 0 End user issues to date 0 Wonky bugs that "just happen" 0 Pull-your-hair-out compiling issues 0 Rework and refactoring delays 0 Based on these stats, Clarity Voice’s CTO Scott VanDeWater was quick to become an advocate for using more Elm. And that’s the brilliance of Mike’s strategy: Sprinkle in a bit of Elm Track and share the results Win a bit more approval Rinse and repeat You don’t need a hard sell. A series of small successes that over time yield big supporters—from the CTO to the COO—has a way of selling itself. It’s not a flashy approach, but it is pragmatic. The result? Mike got a green light from the CEO to do more Elm! Bringing down the risk With the CEO’s approval now in hand, Mike and Scott were ready to try creating a bigger, customer-facing Elm app. Pilot App #3 Description: To create an Elm front-end that consolidated various pages and backend components from the current portal system into a single dashboard view. Project Risk: Higher, but mitigated. The scope and complexity of this project made the risk significantly higher. To minimize risk, Mike brought in an Elm consultant to help him work through the various design and architecture challenges. Time Spent: 120 hours Result: A self-service app where Clarity Voice’s customers can set up their communication preferences (ex. call routing) in a single place. Bugs Reported: 0 Mike told us, “This was a bigger project, so it was bound to have some issues. But we had absolutely no issues on the Elm front-end. All the issues were on the back-end. The API would do something unexpected or the logic would need to be reworked. We fixed all the issues in literally one day, released the app into production, and I’ve never heard of any issues since.” “Can we afford not to do future projects in Elm?” This was the question Mike and Scott began asking themselves. They both knew a big rewrite was looming and they wanted to put Elm through all the paces before making a final decision. Pilot App #4 Description: To create an Elm front-end to a PhantomJS back-end. Project Risk: Low (This was their fourth pilot app after all.) Time Spent: 18 hours Result: A CRUD Elm app that allows customers to go into their portal and in a few quick steps schedule specific reports to be delivered to their email. Bugs Reported: 0 With another successful Elm project under their belt, the answer has become clear: “We cannot afford not[...]

Integrating Elm at Clarity Voice (Part 1)


“We were tired of silly runtime exceptions breaking our souls.” That’s how Mike Onslow responded when we asked him why he made the decision to start using Elm at Clarity Voice. He was a software developer facing the need to replace a 10-year-old internal system that was showing signs of its age. And Mike was tired of working with a broken soul. But you won’t sense any exhaustion in Mike these days. He is cheerful, optimistic, and brimming with creative ideas. This spring they’re excited to kick off a project rebuilding the frontend of their ERP system. So how did they go from crushed souls to happy coders? What was Mike’s simple, yet brilliant, strategy for introducing Elm? And how did he “sell” Elm to his management such that it’s now the language of choice at Clarity Voice? It’s a great story and we’re pleased that Mike and Clarity Voice have given us this opportunity to share it with you. “We had Javascript fatigue.” In 2013, Mike and his small team built a large JavaScript UI library for Clarity Voice’s internal ERP system. The UI library used jQuery/jQueryUI and had a lot of nice features: Their library worked well… for a while. But then their requirements grew and they needed to deal with more complex workflows. As they began to layer in more state changes and dependencies, two things happened at the same time: their app got more difficult to develop and less reliable. As Mike describes it, “The error message ‘Undefined is not a function’ was a major part of our lives and caused us to keep our heads down around the QA team as well as the end-users.” Sound familiar? So he started looking around at different languages, libraries, and frameworks. In particular, he was searching for something that could give his team: speedy and yet safe development more reliability for their end users a replacement for jQuery entirely decreased frustration and exhaustion with JavaScript Mike closely evaluated a number of popular front-end solutions, including Angular and React. Alas, the last requirement seemed entirely unrealistic as nothing addressed his JavaScript fatigue. And then along came a podcast. The allure of no runtime exceptions Late in 2015, Mike listened to a JavaScript Jabber podcast with Elm’s creator Evan Czaplicki and experienced Elm developer Richard Feldman. Three minutes into the podcast, Evan began to describe Elm by saying, “I wanted to do front-end stuff but I wanted it to feel nice… to make front-end programming really really pleasant.” The more Mike listened, the more intrigued he became with what Elm might offer: no runtime exceptions quick rendering and re-rendering the safety of a declarative compiled language the simple structure of The Elm Architecture a way to begin to break free of the JavaScript ecosystem In terms of the Elm Architecture, Mike said he “really liked that the state of the application lived in one model. And that at any given time, the view represented on the screen was based on the state of that data rather than a bunch of components containing their own state. There was a clear hierarchy and I liked that.” Clarity Voice’s CTO Scott VanDeWater, also experiencing JavaScript fatigue, began to get interested in Elm around the same time. Coming from a C/C++ background, Scott was keen on Elm’s type safety and the extra safety of everything being immutable. Over the next several months, Mike and Scott researched Elm a bit more with an eye toward integrating it within their larger applications. Neither of them had previous experience with a functional programming language but they “figured things out easily enough” as they spent time just toying around with the language. The simplicity and readability of the code was a big plus for them and when Elm 0.17 was released—and the signal boilerplate for [...]

How Long Does It Take?


In yesterday’s inbox, from someone we’ll call “Rudy”:

"Hi, I've been putting together an Angular 2 video course and I'm wondering how much work/hours was put into your Elm video course, I've been considering doing one but I'm not sure if it'll be simpler than Angular 2 / React."

Hi Rudy,

I appreciate your due diligence. Your question reminds me of the time Bob Landis, a legendary wildlife filmmaker, was asked how many days he spent in the field to capture the footage for one of his hour-long documentaries. A humble man, he chuckled a simple reply: “Years”.

I don’t mean to sound flippant. I wish I could quantify how much work I’ve put into the Elm course. Back when I started making courses I tried to track my hours in hopes of calculating the development cost. And the detail-oriented (ok, let’s call it obsessive) part of me wanted to analyze those metrics so I could more accurately estimate the cost of future courses. Alas, I soon realized that tracking my time was futile.

For this Elm course in particular, it literally has taken years. I first started learning Elm over the holiday season in 2014. Six months later we released our first Elm course. Being a relatively new language, Elm continues to change and so we continually update the course. Then, late last year we spent several months completely redesigning and expanding the course to use the latest version and techniques. As they say, it’s not a sprint, it’s an obstacle course.

So, if I were to count my hours, I’m not sure where I’d begin. Do I count all the hours spent gaining experience with the language before even considering developing the initial course? What about all the time I’m doing something else but can’t stop thinking about how to explain a concept in the course? Honestly, once I start working on a course it kinda takes over my brain.

And I do a ton of research while writing a course. Should I include those hours or just the time I’m actually writing the script and building the example apps? What about the dead ends, false starts, and the rewrites? The 2am, bolt-upright anxieties—“Did I say function when I meant method?”—surely count, right? And do the video retakes and bloopers count? If so, that’s going to be a bit embarrassing.

I think you see where I’m going with this. But even if I had a full accounting of my time and could give you a tally of hours, it would be utterly meaningless to you. Your context is different. Your programming experience and background are different. You’ll have a different process. And I’m assuming your course will be different. That is, unless you’re planning to create a nearly-identical course. Surely you wouldn’t do that, would you Rudy?

So please don’t use me as a benchmark. It’s nonsensical. If you’re really keen to create an Elm course, by all means go for it! But I’d encourage you not to do it based on how many hours it took me or even whether it will be simpler than Angular 2. Do it because you’re genuinely interested in Elm and want to share the joy of it with other folks. Do it because your creative spirit won’t let you not do it. And do it your own way, in your own time.



P.S. Don’t forget to account for the time it’ll take to choose the right font size, editor color theme, and answer e-mails like this one.

Giving Hope: 30% of January's Sales To Go To Preemptive Love


"Violence unmakes the world,
but preemptive love has the power to unmake violence."


Update: Thank you for giving a lot of hope this year! Your purchases in January made it possible for Preemptive Love Coalition to feed 100 families for a month and provide sleeping bags for 100 people. There is still so much hope and help to be given in 2017. Find out more about their inspiring and courageous work in their 2-minute video. Thank you for standing with refugee children and families in Syria and Iraq!


Photo credit to Preemptive Love Coalition.

Violence unmade the world for families in Syria and Iraq last year. The terror, slavery, separation, extortion, hunger, fear, heartbreak, poisoning of water springs, and cold nights were widespread. There was no discrimination or favoritism shown when it came to the loss of children, parents, husbands, wives, homes, businesses, and communities for Syrian, Iraqis, Kurds, Christians, Muslims, Yazidis. The young and old, the rich and poor, the rural and urban were all victims in the Middle East violence.

And while we know we cannot singlehandedly change the situation for all the families in Aleppo, Mosul, Damascus, or Fallujah, we are striving to resist the temptation to divide the situation into "us" versus "them" and turn away. Collectively we can actively give hope. Just maybe we can give enough hope and love to unmake the violence and forge peace.

So, here's the small part we’d like to do together with all of you: 30% of the sales from all your course purchases in January will be donated to a charity that's close to our hearts. We've been following the inspiring and courageous work of Preemptive Love Coalition for some time now. For this first month of the new year, we're selecting them to act as our hands and feet to the families in Syria and Iraq that need food and water, sleeping bags, small business grants, education in conflict-zones, lifesaving heart surgeries for children, and the chance for reconciliation and restoration.

We'd be so delighted if you'd join us in giving hope this New Year!

P.S. If you already own all our courses (many thanks!) and want to start your new year off by giving real, tangible hope, you can give directly to Preemptive Love Coalition. We'd love to hear from you if you do so and find out what stirred in your heart.