What replaces the MVC pattern in functional programming? - orm

I'm a MVC web developer who's become very interested in functional programming to write web apps (specifically, I'm captivated by Erlang and Cowboy.)
What I'm having trouble finding an answer to/resources on is what pattern is used to replace MVC in FP.
Obviously the idea of an ORM is ludicrous in FP, since it's not object oriented, so what is used to replace it for persistence logic? Is it usual to just build a module that uses a library to create functions that interface with the datastore, or are there tools similar to ORMs?
Both advice and links to resources would be greatly appreciated. Bonus points for Erlang/Cowboy specific help. Thanks.

There are MVC frameworks for Erlang. It's ChicagoBoss for example.

Quoting from an article by #yarivs:
Erlang does carry its weight in all letters of the MVC. For the Model, forget database abstraction layers: you have a pure Erlang distributed database called Mnesia. For the view, Yaws has ehtml. For the controller, Yaws has appmods and Erlang's pattern matching.
I hope this helps.

im a coder for erlang. i use erlang for my web-game server...
so...there is no View..and in function luangues this is no Model...
so from my point of view, function luangues there is no need of MVC
(just like no class or subclasses in function luangues..)

Lift framework(written in Scala) uses pattern called 'view first'.
follow link https://www.assembla.com/wiki/show/liftweb/View_First

Related

Phalcon: How i can design a website with multi languages?

Later i worked with symfony framework. In this framework we can easily build a multi language project by using FOSUserBundle. But i do'nt know what to do in phalcon! In the Phalcon documentation (multi-lingual-support) explained a way for it! But if i have many languages this way is too difficult!
Do yo know about any provided library for multi language projects?
You can either use the Phalcon\Translate to translate all your strings in respective arrays - one file per language. The reference in the documentation as you correctly posted is here and it refers to the native array adapter.
There are additional adapters in the incubator repo, for PO files or database driven.
You might also want to see the internationalization area in the documentation.
take a look at this piece of code
https://bitbucket.org/moderndeveloperllc/phalconlocale/src

Writting My lightweight MVC framework

I have planned to write my own light weight MVC for PHP, that will be used as base for my sites I develop. I have no problem with PHP, OOP, et al. I have trouble on how to actually load Models In controllers and use them amd loading Controller values into Views. In short, I don't know how M-V-C interact behind the scenes.
Any tutorial (concentrating on that) or any contribution is welcomed!
Thanks!
ASP.NET MVC is open source: http://aspnet.codeplex.com/releases/view/58781
Edit: consider this: I believe you are trying to reinvent the wheel, thinking that those MVC framework out there are heavy and packed with uncessary features (acording to your double use of the word lightweigth). In my experience, I always ended up coding those extra "features" because a framework is required to evolve. Loading models In controllers, using them and loading controller values into views is just the begining. If you want to get started eventually, it would be a better investment to write some helper classes and methods: a popular pattern in the MVC world. Unless you are writing a MVC framework from scratch for fun and I am totally wrong (you said you needed a base to use for your sites ).
Best of luck!
Codeigniter is an open source MVC framework of php.
http://codeigniter.com/user_guide/overview/appflow.html
The major in MVC is first of all your controller class initiated and then calls view.
After google and check how other MVC works I decided to take this route. I redirect all my requests with .htaccess to index.php. Then there I define base paths. After all the definitions I include the core.php which in turn includes all core files to my mvc framework. Then in the same file I create Instances of Registry and router and the game starts from here!
Internals are a bit complex now but that is what I ended with!

Node based GUI (Cocoa)

I am in the process of starting a project and whilst the logic part is relatively simple for me to mull through I am not very experienced with creating GUIs.
If you are not familiar with node based workflow here are a few examples
Nuke (The Foundry)
Max/MSP (Cycling 74)
SoftImage (AutoDesk)
The problems I have is where to start, What kind of object should I use to encapsulate the node gui? Or How would I go about making custom GUI elements that are click-drag/movable within a workspace? Are there any Books you recommend or anything you can link me too that would be able to get me up to speed.
Thank You
Your node view will derive from NSView, and I imagine that you'll want to use CALayers for your nodes.
You may find it helpful to look at some opensource Cocoa frameworks that implement custom views. Two that spring to mind are TwUI and GCDrawKit. Neither are a drop-in solution for what you want but they should give you an idea about how to architect complex custom views in Cocoa.
I recommend you use interface builder and the AppKit framework. A good introductory book is Cocoa Programming for Mac Os X

difference between API and framework

what is the difference between these two terms, thanks in advance for any good simplifications and good examples.
A framework is a group of classes, interfaces and other pre-compiled code upon which or by the use of which applications can be built.
The API is the public face of a framework. A well designed framework only exposes those classes, interfaces, etc that are needed to use the framework. Code that supports the operation of the framework but that is not necessary to users of the framework is kept internal to the framework's assemblies/dlls. This keeps the public face of the framework small and encourages a "pit of success," or the quality of a framework which makes it simple to do the right thing.
(I provide an example from the .NET world)
The SqlConnection class is used to connect to a Sql Server instance. Its public API is pretty simple:
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
// Do work here; connection closed on following line.
}
However, this class depends on around 200 methods within the System.Data framework (in this case, an assembly), 3/4 of which are internal and not part of the public API of System.Data. Because the framework's API is kept simple, it becomes easy to use SqlConnection properly. If the user was required to deal with SqlConnectionFactory, SqlDebugContext, DbConnectionPoolGroup or any of the other internal classes required by the SqlConnection class, it would become exponentially more difficult to use SqlConnection properly. Because the API only exposes a small percentage of the framework, it is easier to create and use a connection.
An API is an interface to a (set of) component(s) encapsulating a functionality. For instance, the GoogleMaps API, the DirectX or OpenGL APIs.
A framework is more a set of tools, components aimed at helping the developer to develop his/her project in a given Frame. The framework usually sets some coding standards, provides useful components, ... For instance, Symfony/Cake are PHP web application frameworks. JUnit is a framework for unit tests in Java, ...
Frameworks can often bundle/provide a unified interface to some APIs.
Some APIs can be internally built using a framework.
API - application programming interface -> the contract you must obey when using a library's API
library - a set of classes/modules that solve a specific problem -> has an API
framework - a "bigger" set of libraries with a set of rules on how to use them
Since every library has an API, no point in giving examples.
A popular Java library for time is Joda time.
A popular Java framework is the Spring framework.
You must obey a lot of rules to use Spring well. You don't have to obey as many rules to use Joda time.
An API is something code has, not something it is. A framework has an API, but it is not itself an API.
API "Application Programming Interface" is set of prewritten packages, classes and interfaces with their respective methods. You can use it without much concern about internal implementations. API is used an interface between two or more applications and like REST API.
Framework is a skeleton that contains design patterns, classes, interfaces and libraries that can be used to build applications. Framework provides inversion of control which give the responsibility of program flow to the framework itself, also we can extend the framework without changing its predefined code. For example Spring is a framework that can be used to build web applications.
API's are pre-built-in from SDK (or from which you can include on to). Frameworks are loadable bundles wherein exposed functions of such bundles can be used. You can acquire expose functions of those frameworks by using pointer to functions.
Example:
API:
-stringWithString:
function from framework:
-myExposedMethod:
Framework is use to design an application, ie MVC, MEF. Like a model that you build on, almost a base for a certain set of functionality that you might want in your application.
API is for interaction between applications, your app would use the Facebook API to interact with Facebook.
Hope this is a bit more clear.
Java API simply means ...Application Programming Interface in which all the features describes of product or software.
Java Framework means semi-completed project or code. It provides an architecture to make project . Framework have own classes and methods etc..
An API is simply a library built with a particular language that developers can use to build applications.
Frameworks are a set of libraries, just like APIs however the syntaxes may deffer of the original language. So the developer may be writing a different syntax of PHP for example when using Symphony.
The main or core difference beteen framework and API is that framework allows developer to hook into the life cycle of the objects through lifecycle callback methods mechanism whereas API doesn't do that, API is only intended to perform a functionality only.
Another way to visualize it is this: (true of any programming language)
Any(!) "piece of software that is intended to be used by another piece of software" by-definition must have some "application program interface (API)," which represents the "knobs, switches and dials" that the other piece of software is expected (and, permitted) to use. All of the internal implementation details are not visible and cannot be reached.
"Frameworks" are tools that are designed to make it easier for humans to write a particular, common, type of application – such as a web-page. The framework implements "the stuff that every such application is going to need to be able to do," and does it in one, well-tested way, "precisely so that you (the application author) don't have to." Instead of redundantly writing "the same old thing, one more time, and fretting over whether you did it correctly," you simply leverage what the framework has already done for you.
After all...
Actum Ne Agas: Do Not Do A Thing Already Done.

Anyone know the Click Framework?

I've been recommended the Click framework from Apache. But I can't find any forums talking about benchmark, reviews, advantages, disavantages, usefulness, ease of implementation, etc.
I've been asked to use it to develop a web site, but I'm completly in the dark about its strengths and weaknesses.
And its damn name isn't helping !! Click ? Hey Apache ! Call your next framework "the" just for fun. I dare you.
So can anyone comment on his experience with Click ?
What I personally like about the Click framework is that it is fairly close to HTML/HTTP and the Servlet API. There is no huge abstraction to get familiar with. You have a Page class, a Form class, ... If you need to preserve state across invocations you put it in the session or you pass it through the URL... This makes it easy to start using it. It is also straightforward to control the HTML pages being generated. It may sound like it is a very basic framework but the simplicity is actually one of it greatest strengths.
Other frameworks (e.g. Seam) are more suitedr to create a very large web application with lots of reusable components and complicated pageflows but the learning curve is much steeper. So for me Click works well for small to medium sized websites.
It's an apache incubator project but that does not mean the project is not stable, rather it reflects that it is in transition to the Apache project model.
Click is Apache's version of a component based web framework equivalent to JSF (other component base Java Frameworks are Tapestry and Wicket)
Click is rated at Ohloh
There is an official blog and some Wikipedia references: Framework Comparision and info page