Hacking. Coding. System Architecture. Management. Startups. Technology. Greatness.
Showing posts with label Functional programming. Show all posts
Showing posts with label Functional programming. Show all posts
Friday, May 2, 2014
Some REST for the Wicked
The wicked coders at Dev Talk LA started a REST book the night before last. Discussion was amazing. First we covered the paper on functional programming, which we didn't get to last week. This paper is a response to another paper, so you should read both. Then we did chapter 1 of the REST book.
One fellow geek brought his date to the Meetup -- this was his date night entertainment! I hate getting pushed off my UberGeek pedestal, but stuff happens! I look forward to seeing the happy couple at future Meetups.
I was kind of blindsided by one discussion, which mentioned "traits" with Java. I never heard of them. That's pretty weird for a java techno-maven such as myself, so I need to follow that up with him. And Google didn't help me out this morning, either. It seems "traits" might be another term for "mixins," which were found in some OO environments, but never in Java. Mixins were/are a kind of inheritance where multiple inheritance didn't quite fit the bill. I'm not sure if he's thinking of AOP and mixing the notion in with traits, but it's something to check up on. Or it could be some kind of a library that offers this kind of support in the java ecosystem.
Someone else mentioned GPars, a concurrency framework used in Groovy quite a bit. I don't know that much about Groovy, so this one has to be put down on my "to be investigated list." I already spent a few minutes Googling it, and it appears to be an implementation of the "actors" abstraction from Scala and Erlang, but in the Groovy/Java world. I definitely need to spend some time playing with Groovy and taking advantage of it's type-inferencing, so I can avoid boilerplate code more. That just needs to happen. Because speed matters.
Another member highly recommended a concurrency talk by Doug Lea. From what he said, I believe that this is the talk.
Moving on to the REST book, the bid system got completely hijacked! Normally, everyone offers page "bids," and the lowest bid wins. But this time, one of our members just jumped in and pushed the last page of the chapter as the opening round!
The discussion focused on a Members key problem with REST for him in his work and in general., which was to get the human readable and machine readable representations integrated. For instance, he hates the whole embedding of versions into the URL for APIs. This is ugly and hard to support. Instead, if you traverse from the top of the hierarchy, and have clients parse a page of "billboard" information, which describes the kinds of additional services and methods available in the API (at that version), then you can completely avoid this. You are basically building the API spec into the page returned, which the client reads, scrapes, and uses to invoke the various additional API calls.
The problem is, this scheme doesn't allow permalinks and the use of bookmarked pages in the browser. You have to start at the top of the hierarchy and traverse it, because the site might have been reorganized since the last time your client noted a permalink.
But it occurred to us that you could have a versionless permalink API, that mapped permalinks to whatever new, reorganized location they now properly dwelt in. And that would effectively take care of most of the whole issue.
We still need to get our heads wrapped around the right way to do all of this, but the book promises to help us immensely in that regards.
I Remain,
TheHackerCIO
Tuesday, November 12, 2013
Reactive Programming
It's been recommended that I take a look at a Coursera course on Functional Reactive Programming. I wish I had time to add something more into the mix, because the reactive programming seems to mesh well with Functional programming.
To handle this class, I'd need an extra thirty hours a week in my schedule. I'd need to fulfill the prerequisite by learning Scala, as a functional programming language, rather than the Clojure I've been working on. So, it's not likely to happen.
But the idea of reactive programming is fairly simple to get an intuition of. It's the model used by spreadsheets. When a cell changes, all the calculations are updated.
This fits in well with the Functional Programming paradigm, where functions are composed to effect solutions rather than step-by-step imperative algorithm development. It's definitely worth a closer look.
To learn more about reactive programming, read the Reactive Manifesto.
I Remain,
TheHackerCIO
To handle this class, I'd need an extra thirty hours a week in my schedule. I'd need to fulfill the prerequisite by learning Scala, as a functional programming language, rather than the Clojure I've been working on. So, it's not likely to happen.
But the idea of reactive programming is fairly simple to get an intuition of. It's the model used by spreadsheets. When a cell changes, all the calculations are updated.
This fits in well with the Functional Programming paradigm, where functions are composed to effect solutions rather than step-by-step imperative algorithm development. It's definitely worth a closer look.
To learn more about reactive programming, read the Reactive Manifesto.
I Remain,
TheHackerCIO
Friday, October 25, 2013
4 Things 4 Your "To Do" Lisp
- For those who have never played with a functional programming environment, an easy way to do so is to use this web-site. It's been around forever; I used it over a decade ago! But it's a very easy online tutorial for the Lisp functional language. It has the additional virtue of learning what you know and what you don't.
- After you've played with this a bit, you'll be in good shape to start learning Clojure. That way, you can get access to the whole ecosystem of Java, while still retaining the best of what Lisp has to offer. Go here for practice.
- Use this web site, to learn more about Clojure.
- Break your head against Monads. Google "Monad Tutorial" & work your way through them, in the vain attempt to find one that really explains clearly and simply what they are & why they are so useful & how you're going to get 10x the productivity by using them. When you find one, please let me know.
If you find me ambiguous about Clojure, it's because I kind of like it, but I find it a steep learning curve. And I haven't been able to get to the power level of that curve yet. Your mileage may vary.
Still, it's excellent to break out of your paradigm and explore another language. "A new language a year" is one of the tips I've seen for staying "Technically Fit." So, playing a bit in the functional realms is definitely a plus for getting you out of the Object Oriented world.
I Remain
TheHackerCIO
As
Sunday, September 22, 2013
Why Losing Your House and Lisp-JVM Are Unrelated
Web sites are a great way to learn new languages. They offer a prebuilt compiler with a web input interface, so there's nothing to install to start learning. Plus, some sites offer Programming Koans, not to be confused with Hacker Koans. A programming Koan is a problem designed to test your ability to code and help teach you a particular language feature.
Yesterday, I mentioned how TheHackerCIO is learning Clojure, a functional language on the JVM. In fact, Clojure is a Lisp for the JVM. Again, the motivating reasons for this will have to await a future post. But the online Koans are a wonderful way to learn Clojure. They also will introduce the reader to a wonderful type of learning site.
So direct your browser to the 4Clojure site -- a site derived from Clojure-Koans -- as you continue to read my blog. Scroll down on the home page, to the section titled:
Yesterday, I mentioned how TheHackerCIO is learning Clojure, a functional language on the JVM. In fact, Clojure is a Lisp for the JVM. Again, the motivating reasons for this will have to await a future post. But the online Koans are a wonderful way to learn Clojure. They also will introduce the reader to a wonderful type of learning site.
So direct your browser to the 4Clojure site -- a site derived from Clojure-Koans -- as you continue to read my blog. Scroll down on the home page, to the section titled:
So wait, I can't buy cheap real estate here?
So now you will understand the cryptic title of this blog post! The 4clojure site says:
"At this time, 4clojure.com does not provide information regarding the sale of foreclosed homes, and has no plans of doing so in the future."
which explains Why Losing Your House and Lisp-JVM Are Unrelated!
On the site, which you should set up a free account and start playing with, you will find:
- a problem, stated in text,
- a test suite of 2 -4 tests, and
- a section for code entry.
Enjoy learning about Koans! And Clojure!
I Remain,
TheHackerCIO
Subscribe to:
Posts (Atom)