Categories
Resources Software Development

Scala self types links and resources.

The Scala documentation coverage of self types is not very good. Here are some links to further information and explanations of self types in Scala.

Articles

Self types in Scala – This is a decent article that explains self types pretty well.

Scala Self types annotation – more information about Scala self types with examples.

Inheritance vs self types – this article covers the differences between inheritance and self types. Some of the content is repetitive of the above links but said in a different way with different examples. This does a good job of explaining why you would self type instead of inherit, the main thing  I was looking for.

Categories
Resources Software Development

Actual AKKA API documentation link

I may be doing something wrong.
While reading the Akka documentation about Dispatchers  I wanted a better look at the actual API. To my surprise and inconvenience, there was no  link on the page.

So I had to google and well the first link was just to the same damn page in the docs I was looking at. So  I clicked a few more until  I found what I was looking for. I have no idea why there are not links in the docs.

Low and behold the hard to find ACTUAL DOCUMENTATION LINK 

Categories
Resources Software Development

Interesting hosting options, information and links

amazon fargate – container hosting made easy.

google cloudfront – another container hosting option

Categories
Resources Software Development

Scala performance issues and tuning

Exploring Scala performance – Great article pointing out some of the small things you can do to improve performance or DESTROY it.

Reactive Audit – a program to help detect where an application is using blocking code. This audit tool aims to provide help to the use of Reactive architecture in project implementations

Categories
Resources Software Development

Scala case class resources links and information

Scala case classes are used heavily in Scala code. Understanding them is very important in order to be efficient in Scala. Instead of repeating everything in the below articles, I’ll post links instead.

Scala Case Class and Case Object In-Depth (Part-1)

Scala Case Class and Case Object In-Depth (Part-2) 

Using Case Classes to Structure Your Data

Categories
Resources Software Development

random programming articles videos and links

Is It Time to Get Over Design Patterns?– Interesting article pointing out some of the issues with the use of OOP Design patterns.

Category Theory  – This is what functional programming is based on.

Category Theory – Wikipedia entry covering category theory.

Categories
Resources Software Development

Scala Closure Functions resources, links and info

What is a Closure function in Scala? The simple answer is, it is a dirty function that uses variables declared outside the function inside the function, which are not passed as values to the function.

I call them dirty functions because it feels dirty to have some unknown variable outside of a function have power to influence the outcome of the operation in a function. This can be a class or object where the variable is defined or to have even more fun in Scala it can also be an implicit variable from an import.

So again a closure is a dirty function that takes values as parameters but also access variable values from outside of the function that are not passed to the function directly… dirty
Scala Tutorial 15 – How to use closures in Scala

This video demonstrates Scala Closures in detail.

Categories
Resources Software Development

Scala Threads, Futures and Promises, links and resources

Concurrency vs Parallel computing – good article on the subject

Don’t use actors for concurrency – article about using actors and futures for concurrency

A journey into concurrent programming in Scala – this article explains the basics of using futures and an execution context for concurrency. This is very basic.

Throttling Instantiations of Scala Futures – a very good article pointing out some of the issues with using Scala futures and how to back pressure them.

Understanding play thread pools – this is from the documentation on how to create thread pools


Videos

Scala Programming – Introduction to Threads and Futures

Futures and Async: When to Use Which?

You will want to speed this video up to 1.25 or 1.5 This video explains more of the theory of how Futures, Async and promises work than how to actually use them.


How to Write Controllable Futures in Scala | Rock the JVM

Categories
Resources Software Development

Reactive web applications notes

These are my personal notes about Reactive Web Applications by Manuel Bernhardt – It was written in 2016 it is a bit dated already as it covers Play Framework 2.4 and it is currently at 2.8 some of the things in play have changed. Play and everything in Scala world is changing so quickly all books are outdated the day they are published but they are still useful.

This book contains a lot of good general information about how Play Framework works.

One problem is certain things have either been removed from play framework code API and no one bothered to leave a link in the API docs, or the code was wrong. In particular chapter 5

import play.api.libs.concurrent.Execution.Implicits._

The compiler complains Execution does not exist.

The book is still full of great information and examples that give you a good idea of why you should do things a certain way and even examples of things to avoid.

But these are my notes for me.

Good coverage of  how Plays ExecutionContext works in Chapter 5 starting on page 110 in particular. This chapter covers Futures, how to use them in Play and how the Execution context works. It covers how to create custom execution contexts for such things as DB access or for each service of a larger app.intensly

Chapter 5 page 11 covers Async Controller Actions, how to create them and why, lots of good info on pages 110 – 111.

Chapter 5 page 112 Covers Custom Error handlers, very useful information here, for handling errors when working with Futures.

Chapter 5 page 114 covers correctly configuring and using an ExecutionContext. It covers when and why you would want to do so.  Page 115 & 116 carries on and goes into deeper coverage with Specialized Execution contexts such as DB heavy code. Pages 117 & 118 continue to cover Execution context in depth  This is the best coverage of Play Frameworks Execution context I have found anywhere yet.

Page 119 & 120 covers testing futures a little

Page 120 section 5.2 talks about Designing Asynchronous business logic with Futures and identifying parallelizable elements.

Pages 121 through 128 continue to cover using Futures, the quirks associated with them and how to avoid them.

Page 123 mentions the reason Futures are better than callbacks is because futures can be composed or combined, this can make swapping things out quicker.

page 126 makes an interesting point about Futures and the order in which you declare them. This mentions a gotcha with a good example of something that wouldn’t work the way you expect it to with Futures.

Page 128 – 132 covers Handling errors when using futures.

Chapter 6 is a quick introduction to Akka Actors and how to use them in play apps.

Page 144 lists the actor methods such as tell, forward etc. and gives brief coverage.

Page 147 makes a point about using var over val for actors to make them immutable.

Pages 148 and 149 cover common beginner mistakes with actors and how to avoid them.

Page 149 quickly covers when to use an Actor vs Future, very good and useful insight here.

Page 154 Section 6.2.3 has good information about letting actors die and reviving them and other error/exception recovery information.

The rest of chapter 6 pages 155+ deal with monitoring and preventing actor service overload, circuit breakers and more on handing errors.

Page 157 – 158 address avoiding duplicate actions

Page 159 covers Actor Message priority as a way to keep an actor system from overlaoding.

Categories
Resources Software Development

Scala Option resources, links and info

When programming in Scala you will see Option used everywhere. What is Option? Basically Option is Scala’s version of Null. However using Option/Some/None is a way of handling errors it doesn’t tell you what went wrong. In order to know what went wrong you must use exception handling.

Option/Some/None is most useful when you have a function that needs to check for a value and tell you if it exists or not. It can’t tell you for example that something didn’t exist because an error occurred. This must be taken into consideration when programming.

Scala Option API documentation link – this is the actual API documentation showing all methods etc.

Tutorialspoint Scala Options – a great introduction to Scala Option
Using the Scala Option, Some, and None idiom (instead of Java null)

Using the Scala Option, Some, and None idiom (instead of Java null) – nice coverage of Option, Some, None syntax and how to use it and how it functions.

Scala best practice: How to use the Option/Some/None pattern – more coverage of Options in Scala