Why bother with FP?

This is a short info page for my research project. I’ll try to provide backed by data (or at least reason) answer to eponymous question.

Why such project?

One of the first meetings of Lambda Lounge Kraków, back in early 2013, was dedicated to defining FP (Functional Programming) and finding the answers to following questions:

  • what makes a language “functional” one?
  • are functional languages out there in the real world and can one work (and earn well) in/with them?
  • is FP worthwhile just as pasture or as real career option?

The meeting was interesting and provided lots of information, but I felt the lack of data was really a problem, especially for last two questions.

Then, as a Lambda Lounge organizer I had my share of discourses about FP and it’s merits (not to mention those, where I was but a witness, because I ran away quickly enough NOT to be dragged in, or just closed the browser tab with disgust). Those discourses usually ran along very similar lines, and yet again I found myself with feeling that they lack data for claims they make (be it to disprove FP has merits or otherwise)

Finally, the now-trendy bashing OOP while in fact one is bashing procedural programming, irks me enough.

For all those reasons, I started researching FP merits for real and this led to me presenting some findings at LambdaDays conference, I heard that John Hughes himself said my abstract was promising and intriguing! Yay me! I sincerely hope my talk lived to it’s promise. However, this is by no means the end to my research and I found out quickly it extends far more than single blog post so… I’ll be sharing the work as I go, on GitHub, and will continue present next iterations during SFI and LambdaCon.

Results?

LambdaDays, why bother with FP version 1 slides:

Status?

GitHub repository with research: https://github.com/LIttleAncientForestKami/why-bother-with-FP

Licence?

Licence details:
Licencja Creative Commons
Why bother with FP by Tomasz Borek is licensed under a Creative Commons Uznanie autorstwa-Na tych samych warunkach 4.0 Międzynarodowe License.
Permissions beyond the scope of this license may be available at mailto:Tomasz.Borek@gmail.com.


Outdated maven-compiler plugin or what’s better than specifying source and target every time

Every now and then (beside build being platform dependent) you hit compilation problems in Maven, where it’s using outdated compiler plugin and all of a sudden it tells you you are using a Java feature that’s not in… 1.3. Like…

generics are not supported in -source 1.3

So, Internet will try telling you, you need to specify source and target but I say, listen to mvn versions:display-plugin-updates
Read the rest of this entry »


Why architectural kata?

Architectural kata?

Do you know code kata? You have a problem and try to code a solution. Well, here, you design it. Hence, you get to be an ARCHITECT.

Why it’s interesting?

Because it’s not always when you get to play a decision maker and without practice it’s hard to be great. Even with huge natural latent talent. Competing with other groups will keep you at your toes and hearing ideas from other in your groups will make you appreciate different perspectives. Finally – you will have instant verification of all your ideas – since you will see how many other groups are jealous… or dismissive!

All in all? Because you WILL grow.

What is it?

A designing exercise where facilitator (client) has a particular problem. Participants – in groups – try to understand this problem and design a solution that meets all requirements, functional and non-functional alike. Examples of problems (that were used, so will NOT appear), include: SMS campaign system, integrating many different and large e-commerce systems, creating an event platform capable of hosting many different event kinds.

How it happens?

Event is split in phases.

Phase 1 is introduction. Facilitator explains workshop rules, then participants form groups and workshop may start.

Phase 2: problem unveiled!
Facilitator presents the problem and – as a client, so not necessarily technical person! – answers questions. Phase includes short problem discussion.

Phase 3: design!
Working in groups, using pen, paper and your minds, you try to come up with a system that solves the problem client has, meeting his requirements.

Phase 4: presentation!
All groups present their design and defend them before questions (and sometimes even a question barrage!). Everybody gets to ask questions. Phase is important, because it’s not enough to have good design, you need to convince others it really is good!

Phase 5: voting
Each design is summed up and everybody votes for designs which really solve the problem.
Facilitator pronounces the winner.

Phase 6: retrospective.
Summary of common mistakes, good strategies or moves, best ideas and why and comparison to other katas. Also, discussion about the workshop itself.

I’ll try to write some experiences I had here, as examples. So far, I’ve conducted this in many different places (though not outside of Europe – yet?) and for quite different groups. And… it’s universally liked.


No man pages for zsh?

That’s a bug of omission with fix already released, but if you have older Ubuntu…

 
wget -qO- "http://downloads.sourceforge.net/project/zsh/zsh/5.0.2/zsh-5.0.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fzsh%2Ffiles%2Fzsh%2F5.0.2%2F&ts=1407408881&use_mirror=superb-dca3" | sudo tar xvz -C /usr/share/man/man1/ --wildcards "zsh-5.0.2/Doc/*.1" --strip-components=2 && sudo chown root:root /usr/share/man/man1/zsh*.1

More info here: https://bugs.launchpad.net/ubuntu/+source/zsh/+bug/1242108

Workaround posted by Mike Chelen, from here: https://gist.github.com/mchelen/60b2853bf84117088662.js

 


Why git diff shows nothing?

Short answer? You’re using it wrong or you mis-configured.

It works but not as you think it does

Most common. You expected something different. Perhaps you worked on Mercurial recently? Or perhaps you thought default behaviour should be something else in your case?

This should help:

image showing git diff between commits, branches, branch and working dir, HEAD and working dir, commit and index and index and working dir, along with commands

Mark Lodato’s beautiful explanation in SVG format (available on Github)

  1. By default it compares index and working dir, nothing in index means nothing to show)
  2. If you wish to see what will be in next commit, use `--staged` or `--cached`
  3. for comparing files use either paths or `--no-index`
  4. for branches, make sure they don’t point to same commit

Configuration

Either (most likely) a pager or mishandled permissions on a file. To correct:

# sets less as default pager
git config --global core.pager 'less'
# tells Git to ignore file modes
git config core.fileMode false

Pager problems

`git diff` uses pager to show results. If you

  1. don’t have any pager or
  2. have removed the default one: `less` (why would you?!) or
  3. have chosen another pager, or
  4. have configured it with auto-quit flags (-F | --quit-if-one-screen or -e | --quit-at-eof)

then `git diff` won’t show results even if they’re there. The last one deserves clarification. Usually you quit `less` only via key q. However, if you run less with extra options (or configure them for your user / system / whatever) then if you have only one screen of output, both flags will cause less to auto-quit. Since less doesn’t print to STDOUT, you lose the output.

For it’s config, check `$LESS` env variable (contains options auto-passed to less with each call) or if you’re not calling it like `less -options` somehow.

To eliminate pager, run `git --no-pager diff [...]`. If this shows output, you know where the problem is.

Permission problem

If someone is using unusual permissions and you are on Windows (why?!) you may have to bite it. Outside of that I’m yet to see this. Follow-up with whoever has unusual permissions or set your Git to ignore them altogether.

Something else

Time for some git debug.

$ GIT_TRACE=2 git diff
trace: built-in: git 'diff'
trace: run_command: 'less'
trace: exec: 'less'

Wrong – not a git repository

Checked on version 1.9.1 and it can work outside of git repo. According to commits, since 1.8.5. Obviously, requires diff to be used with `--no-index` or with two files (otherwise you WILL get error message).

Junio Hamano : git : 286bc123 – explains how it works.

Dale Worley : git : b214eddf – explains it further, when outside of the repo.

$ git diff
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index]


Bash shell builtin vs real command

Every now and then I’m hitting the problem of running a shell built-in when I want to run a real command. Built-in masks the command, of course.

Problem* is, one of them has options I want to use, the other does not (or has different ones).

Also, typing `man someBuiltInHere` gives you nothing, so you can’t check those options. So, few tricks about that.

* For those not so familiar with GNU/Linux it’s an even worse problem. For them the command doesn’t work with options it should’ve worked with.

Case 1: time

I want to use `time` command to see how many page faults I had when running something.

The option `-v` that shows page faults does NOT work with built in.

$ time -v elinks
-v: command not found

Case 2: kill

I want to list all signals kill takes in number – name (columnary) format.

$ kill -L
bash: kill: L: invalid signal specification

Tricks

  1. Realize the difference. You’re not calling the command. You’re calling something else. That was step one for me.
  2. See what options you have: type -a name | type -t name
  3. Add path for command
  4. Read help, not just man

Cases revisited

animated gif showing revisited kill case - that both shell built-in and command are available

animated gif showing revisited kill case – that both shell built-in and command are available

animated gif showing revisited time case - that both shell keyword and command are available

animated gif showing revisited time case – that both shell keyword and command are available


No man page for X

An Internet ‘wisdom’ or your own memory tells you this command had that switch. But strangely, it doesn’t work.

man this-command

doesn’t work either – more precisely it yields no results. Heck, even

man -k this-command

yields nothing of interest. What now?

Your REAL problem is – quite likely – that you’re running a shell built-in or an alias, not a command (thus no man). Click the link above if that’s the case.

Your other problem may be the fact, shell built-ins are NOT something that deserves their own man page. They are part of the shell. So, you either whip up your shell man page and start reading (or grepping for your particular case) or…

you use `help`.


tammo@T420s:~$ help alias
alias: alias [-p] [name[=value] ... ]
Define or display aliases.

Without arguments, `alias' prints the list of aliases in the reusable
form `alias NAME=VALUE' on standard output.

Otherwise, an alias is defined for each NAME whose VALUE is given.
A trailing space in VALUE causes the next word to be checked for
alias substitution when the alias is expanded.

Options:
-p Print all defined aliases in a reusable format

Exit Status:
alias returns true unless a NAME is supplied for which no alias has been
defined.


Dobra polska firma

W ramach polskiego JUGa robię ostatnio cykl promujący ciekawe polskie firmy – ciekawe głównie produktowo / technicznie.

Innymi słowy, firma powinna mieć własny produkt informatyczny, być w 100% polska (lub chociaż w większości udziałowców mieć polskich, preferencja jest, by była przez Polaków – a jeszcze lepiej w Polsce – założona).

Kilka takich znalazłem / znałem sam.

 

Read the rest of this entry »


Follow

Get every new post delivered to your Inbox.