Showing posts with label Lambda Jakarta. Show all posts
Showing posts with label Lambda Jakarta. Show all posts

Thursday, January 21, 2016

Presenting F# at Lambda Jakarta’s Coding Dojo January 2016

Hi guys!

It’s now community time! I have been active in mostly these two communities, MUGI and Lambda Jakarta.

This time, it’s for Lambda Jakarta. For quick overview of Lambda Jakarta, please read my previous blog: speaking on Lambda Jakarta and welcoming new members on May 2015.

The agenda is having a Coding Dojo in January 16, 2016 that showcases solutions to a specific problem. Thanks to KMKLabs that generously provides us the place to have this meetup! Smile

This is the agenda link on meetup.com:

http://www.meetup.com/Lambda-Jakarta/events/227571071/

These are the language list that joined the coding dojo:

  • F# (brought by me)
  • Scala (brought by Herdy Handoko)
  • Haskell (brought by Abdullah)
  • Scheme
  • Elixir
  • .. and more (including Clojure!)

We have relaxed the coding dojo a bit, as we focusing on functional programming languages but we are welcome participations from attendees Smile

This means, we got a lot of contributions with lots of different programming languages. Bring it on!

coding_dojo_201601

The problems we’re going to solve are FizzBuzz and Dice Roll. Because of our limited time, we only had the chance to present FizzBuzz solutions.

You may read the problem description of FizzBuzz and Dice Roll on the event website. The interesting problem is the FizzBuzz, as it’s often asked at interview of software developer (see this site and this Jeff Atwood’s blog for example).

FizzBuzz was a child’s math puzzle, it’s simply saying Fizz for any number that is divisible by 3, and Buzz for any number divisible by 5, then FizzBuzz for any number divisible by 3 and 5.

put it simply: 3 – Fizz, 5 –Buzz, 15 – FizzBuzz

But then there are various solutions to the problems, as we are trying to solve with the languages we have at each of us disposal.

We have intro from Tito, developer of KMK Labs (the place and the host):

codingdojo_tito_host

I have the chance to present F# as my language to solve. Here, using Visual Studio projected to a large LED display:

WP_20160116_15_28_45_Pro

Here’s the code in F#, you can write this using F# pattern matching:

CodingDojo_FizzBuzz

Here’s the result display on F# interactive:

CodingDojo_FSInteractive_FizzBuzz

We also have Herdy, Abdullah, and others to present as well:

WP_20160116_15_16_30_Pro 

The next meetup? Just stick around at Lambda Jakarta meetup website: http://www.meetup.com/Lambda-Jakarta/

See ya!

Sunday, November 1, 2015

Giving quick intro on functional programming on Lambda Jakarta October 2015 Meetup

Hi guys!

Now it’s community time! To be specific, Lambda Jakarta meetup time!

lambda_global_326137232

This time (as suggested on previous meetup, on my blog, and on Lambda Jakarta’s Slack group) Erik Dominicus and I are going to give separate presentations on the same topic: introduction to functional programming language.

The place was still the same, MNC building, but the date was 31st October, 2015 on 12.30 PM (after lunch).

Yes, we both deliver the same concept but we decided to give different ways to deliver these presentations.

I focused on giving intro with the past background of common non functional programming introductions including OOP (hence imperative), and then gently driving the mindset into functional. Eric focused on giving intro directly on conceptual principles on functional programming.

The invitation page on Lambda Jakarta’s meetup of October 2015 page neatly described this:

image

Yes, I focused on gentle intro with introduction from non functional programming.

Introduction to functional programming will be delivered and presented as gentle intro into the concept regardless of functional programming languages (language agnostic). This quick intro will get you jumpstart with relevance to other todays programming paradigm such as OOP and imperative without hurting your brain

This is the excerpt from my slides:

image

..and we all know these facts:

image

Yes, functional programming should be fun! Unfortunately, I didn’t have the chance to be captured as video. The next meetup will try to repeat my talk and it’ll be video captured Smile

These are the pictures:

WP_20151031_001WP_20151031_005WP_20151031_006

WP_20151031_009

..and there’s more on Lambda Jakarta’s meetup page for October 2015 Smile

I was so excited to have many feedbacks and questions in the middle of my talk! One of them was asking about asynchrony and synchrony concept. Although they are concerned and closely related to parallel programming, asynchrony and synchrony are not parallel programming concept. Asynchrony, synchrony are just part of concurrent programming, and parallel programming also part of concurrent programming.

This is also unfortunate consequence of common fresh graduate of computer science faculty in Indonesia: the curriculum keep mixing wrong concepts, and always leaning more on “industrial trend” based on not so official TIOBE index.

Very well, this is our responsibility to change this, right?

We have agreed to have next meetup soon after the TechinAsia event (11th November). Stay tuned on Lambda Jakarta’s meetup and Slack website!

UPDATE:

This is my slide for the presentation: http://1drv.ms/1X07sFT (feel free to download) Smile

Monday, September 21, 2015

Attending Lambda Jakarta September 2015 meetup

Hi guys!

In this blog entry, this is my story about helping to organize meetup of Lambda Jakarta.

The meetup was held on 19th September at MD Entertainment Tower 2.

The link is: http://www.meetup.com/Lambda-Jakarta/events/225037500/

The place of this meetup look weird, it looks like a building with lots of venous blood pumping;

MD_Place

The agenda is:

  • Presentations from Erik Dominicus and Dicky Arinal
  • General functional discussion,
  • Meetup formalization and next steps

Presentations from Erik Dominicus was quite great. He presented a quick intro to Haskell, a quite old functional programming language that still influences many functional programming language today including ML, F#, Scala.

Dicky Arinal presented a lightning intro to concurrency in networking. A quite tedious and technical talk, but quite refreshing to know deep into what’s going on at multithreading in networking world.

The formalization was originally to discuss what will be the next meetup, but then the discussion crystalized onto one need of having online collaboration. After brainstorming, I proposed to use Github and Gitter to have chat. But most of the audiences were familiar with Slack, so I decided to jump in and set up Slack:

image

The Lambda’s Slack link: https://lambda-jakarta.slack.com/messages/general/

The collaboration is nice, you should try it! It’s quite the same as Gitter, but unfortunately not all of us can directly join the confirmation, you have to be invited first.

Here is the conversation at #general channel:

image

Now we have more channels for specific interests:

image

Of course, there’s F# in #fsharp channel Smile

Now the organization of Lambda Jakarta has been set up as a repo in Github! <link is: https://github.com/Lambda-Jakarta >

image

Go Github! At the picture above, I also set up a repo to contain all of the source code sample to teach functional programming. This meetup was fun! Smile

This the shoot from the meetup:

The next meetup has been also scheduled for 31st October 2015. Guess what? I’ll present an intro to Functional Programming without hurting your brain, and Erik will present an intro to Functional Programming but with totally noob view!

Monday, May 11, 2015

Speaking on Lambda Jakarta: welcoming new Lambda Jakarta meetup member, new organizer, platform concern, and more

Lambda Jakarta meetup time! Now the meetup is themed “Casual Meetup”. This meetup is now located at Starbuck, at Tebet Green Mall on May 9, 2015.
The meetup is casual, as currently we didn’t have defined talks to be delivered but we have free topics (about programming language, of course) and still mainly focusing on functional programming.
For the detail on this meetup, visit the official event page: http://www.meetup.com/Lambda-Jakarta/events/222067797/

Agenda on this meetup is themed basically on these:
  1. Announcement of new organizer, handled from Abdullah to Tino (a.k.a. “Kusut”)
  2. Planning for the next meetup to have some presentations for next meetup. Again, I voluntarily for the next meetup
Without further ado, let’s welcome Kusut as the new organizer! Kusut has been around for more than 6 years in programming. Currently he has been fluent in Python, Ruby. For the last 2 years he began to dive into Haskell, with the help of Abdullah and Erik. By the way, Erik was one of the original founder of Lambda Jakarta meetup.

UPDATE 1: The original founder is Abdullah, Kusut and Asep. Thanks for clarifications, Erik :)

We welcomed new members: Rezha, Irvan and 2 more (sorry guys, I can’t remember your real names). Reza is still undergraduate student, with a passion to learn more than just OOP and procedural programming languages in his study! Irvan is still working at Traveloka as team leader and also software architect.
This is the picture:



The total of attendances was not so many, it was about 15 attendants. But we have so much fun discussing what happened in programming language world, and we agreed that we will touch more on platform.

After we introduced ourselves, we had topics to discuss. As always, I was happy to answer and discuss more on F#, .NET and platform relevance.

Platform (runtime platform) concern


Platform in this sense is platform in a sense of runtime platform, either .NET (and its Mono on Linux/UNIX) and Java. True that we as Lambdas love Haskell, but Haskell itself can’t be considered as true platform on its own. I shall focusing on the runtime virtualization platform on these two: .NET and Java.

Non runtime virtualization is usually native and closer to metal, like Win32, Bash, Csh, ObjectiveC, and many more (including DirectX, device driver).

A simple illustration about this native versus virtualized is:



Now you may wonder, why .NET/Mono apps (and hence Java) called managed? Because they have their own virtualization on top of the native OS runtime.
Therefore this bring these consequences:

  1. Applications has their own shared virtualized runtime, often in some isolated fashion (in modern OS such as Windows Store Apps in Windows 8.0 and 8.1)
  2. Memory, I/O, and other side effects are managed as abstracted from the underlying native OS. Often the virtualization provides some mechanism to access native OS API. Some example of this is the use of P/Invoke within .NET apps and JNI within Java.
  3. These abstractions can add a little overhead to the performance, but this is by design. This also brings more room for innovations such as cross platforms (in a sense of running on other OS platform). We see in real world as Java and .NET/Mono, that runs on Windows and Linux/UNIX/MacOS.
  4. When these virtualized apps run, not just in a managed environment but most of them are often well behaved as they often have a little knowledge of how they run in parallel according to the underlying OS. Therefore there are no simple or definite way to provide one-on-one performance profile on many OS. This is why (again) managed applications are mostly not geared for performance when compared against native applications.


Now that we understand why they are managed, it’s time to understand implications on the functional programming world. We know that Scala in Java and F# in .NET/Mono are the strong contender for the managed programming languages that also functional!

But then, at the core of those platforms, the virtualized platforms matter itself. The choice between Java or .NET is still not easy, as each platforms has their own advantages over the others.

Platform (runtime platform) choice


Why the choice of the runtime matters more? Because there’s no easy interoperability between the two major platform.

My own choice? The answer is complicated, but for those like me that already has enough manhours spent on these two, the clear winner (although it has its own disadvantages) is .NET.Let’s dive into the current states of Java as runtime.
Java 8, the latest incarnation of JDK, has these:

    1. Generic support (using type erasure strategy) since JDK 1.4
    2. wildcard for covariance/contravariance relaxation, but it’s still partial due to type erasure
    3. rich type reflection through bean descriptor and class mechanism (explicit setter and getter)
    4. No tail call support yet


    .NET 4.5 has these:
    1. Generic support using type reification strategy since .NET 2.0
    2. support for STRUCT type (value type as .NET called it)
    3. Iterator since .NET 2.0
    4. Parallel support since .NET 4.0
    5. Covariance/contravariance in generics
    6. rich type reflection through inherent setter getter with properties
    7. tail call
    My main reasons in deciding that .NET is the winner are the type reification, STRUCT type, and the covariance/contravariance support. There are also minor comparing factor such as Lambda statements in Java, but this is not a true comparison as Lambda is truly language feature, not runtime feature.
     
    Curious about type erasure? Read this from the official source: https://docs.oracle.com/javase/tutorial/java/generics/erasure.html

    But for me, the most decisive factor is the use of type erasure in Java. It’s quite annoying because the type information can’t be ensured at runtime! This is the big issue in Java that is a big disadvantages compared to .NET. It’s also a wrong decision at start, for the sake of compatibility.
    This matter of type erasure choice has its own backup supporters, such as this guy in a blog post for example. But still in that article, he also mentioned that it’s still a wrong decision.
    Further implications? Many! The nature of functional programming languages are strong type everywhere, including generic supports. This weak generic support of Java can make even Scala losing its backers in long run as it doesn’t fit for strong functional programming runtime.
    Hey, I’m not Java haters! I’m still a polyglot developers, and I still have high hope for Java. For Java 9, there will be a support for STRUCT type, and Java 9 will be the starting point to support type reification, by paving the way for STRUCT.
    This means that we’ll see type reification after Java 9. But the exact release will be further decided by the community and Oracle. Don’t be excited first, guys.

    What about Haskell?

    Unfortunately there’s no definite answer about this. We still don’t know yet about mature support of Haskell in Java or .NET. There is GHC for .NET, but this support is still far from mature and stable although it was developed by Simon Peyton Jones, the same guy developed GHC.
    My big intelligent guess is: there’s no direct support for type classes in the runtime, and it’s also quite hard to implement pure functional language boiled into the managed runtime. Try implementing Haskell’s IO monad using the managed runtime, for example. You will find it quite hard even for long time .NET developers.
    That’s it, folks! Can’t wait to attend the next Lambda meetups!
     
     

    Friday, October 10, 2014

    Speaking on Lambda Jakarta: delivering intro to concurrency and asynchrony

    Now it’s Lambda Jakarta meetup time! This meetup is on 4th October, 2014. Again, thanks to Traveloka for preparing the place for us to meet!

    This time, Abdullah was presenting about the problem of concurrency titled: “Promise of Better Concurrency in Functional Programming: Big Win or BS?”. Yes, concurrency is everywhere now, and it’s becoming more and more relevant because of the fact that nowadays CPU is not getting speedier, but the CPU is keep getting denser with more core CPUs.

    WP_20141004_004

    Even on my laptop, the HP Envy beefed with intel CORE i7, it has 4 core and each core has 2 logical hyperthreading:

    HPEnvy_TaskManager

    This makes the logical overall CPU to be 8 logical CPUs! As we see, the clock speed is only at 2.39Ghz.

    And this has becoming trend, not just from Intel. AMD has begun releasing microprocessor using this scheme/model.

    Abdullah in his presentation was quoting this nice article from Herb Sutter (the Visual C++ lead dev of Microsoft) about “Free lunch is over.” published in 2005.

    Herb_CPU_chart

    He said that developer should not depend on CPU speed, instead they should begin to think on how to maximize the existing CPU cores. Otherwise the developed application will always run on one core and the rest of CPU core will be wasted. This of course will have negative impact not just on performance, but it will make the application to lose competitive factor of being efficient and support multi core.

    Herb also added an undeniable fact of concurrency, it’s not just becoming relevant but it’s already relevant at the time of his writing!

    The known concept of these maximizing cores to run at many cores, hence running multiple processes at a time is called parallel programming or on more abstract, parallelism.

    This is the original link of the article: http://www.gotw.ca/publications/concurrency-ddj.htm

    But concurrency doesn’t stop at just parallelism. Concurrency is also dealing with states, dealing with race conditions, and also traditional concept of operating system such as locks, semaphores, mutexes, and execution contexts.

    Now execution contexts are becoming more relevant as the advances in hardware are allowing us to free us from having to wait for blocking operations such as I/O (including networks, printers). But then the software has to leverage this feature as much as possible by freeing current thread to be available for other execution context. The thread doesn’t have to be multithread, as you can still use the same thread but with different execution context.

    This concept is known for asynchronous programming, or simply just asynchrony. Most programming languages handles this by providing state continuations such as “Futures” and “Promises”, or using complex callback with support for function as parameter (delegate in .NET, functional interface in Java 8, function in Haskell, Scala, and other functional programming languages).

    I was also helping Abdullah to further explain asynchrony in the pragmatic perspective.

    WP_20141004_016

    The easiest way to explain asynchrony is if we are ordering food at a restaurant:

    1. We order the food/beverages and we are served by a waiter
    2. Waiter deliver the order list to the cook
    3. Waiter serves other customer without waiting the cook to complete our order
    4. Our order is complete, and the cook is telling the waiter by putting our finished order at the waiter tray (this is the callback)
    5. Waiter checks the tray, grabs the finished order, and delivers the order to us

    I also promised the audience that the next meetup, I will deliver small presentation about asynchrony sample in detail Smile

    The gory detail of concurrency is also nicely explained by this guy (formerly Oracle’s Java developer, now one of NodeJS founder) Bryan Cantrill in his excellent article: https://blogs.oracle.com/bmc/entry/concurrency_s_shysters

    That’s all, folks!

    This is the official landing page of this session’s Lambda Jakarta: http://www.meetup.com/Lambda-Jakarta/events/206904832/

    If you live in nearby Jakarta, I encourage you to participate on this meetup, guys!