Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a sample Cuba app #8

Open
agis opened this issue Aug 4, 2012 · 12 comments
Open

Building a sample Cuba app #8

agis opened this issue Aug 4, 2012 · 12 comments

Comments

@agis
Copy link

agis commented Aug 4, 2012

Hey @codereading/readers, just an idea:

How about we decide a sample app to build (using Cuba), everyone starts on their own and when a date comes we compare them and discuss about the approaches we've took?

I understand this may be time-consuming for some of us but I also believe it's a great way to experiment with the framework.

@kathgironpe
Copy link
Member

@Agis- +1 It's a good idea. I haven't started anything with Cuba but I use Sinatra a lot. Would be good to share some notes too.

@agis
Copy link
Author

agis commented Aug 4, 2012

Or we could even make a Google Hangout to do the discuss/compare part.

@ericgj
Copy link
Member

ericgj commented Aug 4, 2012

It's a great idea. I've been doing a side project using cuba since we started looking at it, and there's a number of things I've come across it would be great to discuss.

What about taking a page from TodoMVC and everyone try implementing a todo list app with cuba?

@theldoria
Copy link

@ericgj +1 implementing a todo list app is great idea.

@adamakhtar
Copy link
Member

I'm up for all of the above.

Adam Akhtar
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On 2012年8月4日Saturday at 23:02, theldoria wrote:

@ericgj +1


Reply to this email directly or view it on GitHub:
#8 (comment)

@agis
Copy link
Author

agis commented Aug 6, 2012

Since I'm a beginner, how would you approach this? I mean, how would you define your routes, would you use SQL or NoSQL? Would you break this down into sub-apps?

Also, we should have a User model too, right?

@theldoria
Copy link

It would be greate to have a minimal spec to define the features of the app, possibly using cucumber, so everyone can test it's application against the spec.

@agis
Copy link
Author

agis commented Aug 6, 2012

@theldoria 👍

@ericgj
Copy link
Member

ericgj commented Aug 6, 2012

@theldoria, not sure we need something so formal given the purpose of the exercise is exploratory (trying out cuba). I can see it if we wanted to do something like implement the same app in different frameworks. The main thing here I think is just to have some motivation for a 'real-ish' project, and since what makes a good todo app is highly dependent on your workflow and situations... I kind of hesitate to put down specs everyone must implement, for fear of squashing motivation.

That said, I think it's definitely worthwhile to think about what kind of functionality would give us some useful exercise. For instance, here's a start of a list:

  • I think like Agis is suggesting, we want to look at doing authentication & authorization, so the app should be multi-user. Let's say for simplicity's sake (and to match the citrusbyte skeleton app) there are three authorization levels - Guest (non-logged in user), normal User, and Admin user. It's up to you what these mean for your app, but there should be distinct functionality for each, as well as authentication.
  • You should implement all the Rails-standard CRUD routes for a model, including dealing with form and/or JSON input (depending on how you want the front end to work). The most obvious model in this case would be Task.
  • There should be some relational logic to the models (not to say you have to use a relational database backend). So to keep it simple: a user has many tasks, and a user can assign themselves an un-assigned task.
  • You should distinguish between development, test, and production environments, and load the backends appropriately.

I realize this list is a bit backwards from where you would start for a real project. Personally I would start with the front end before I think about any of this, but since we're talking about cuba, this is a very sketchy outline of what I'd want to try out on the server side -- not necessarily on the first iteration. Leaving all details undecided about what the backend should be, what the templating should be, how the client communicates with the server, etc.

Does this help?

@agis
Copy link
Author

agis commented Aug 6, 2012

@ericgj That's exactly what I was asking for, a general direction for us newbies :)

I found all your points very reasonable, although I'm not sure on how to approach the last one. As for the authentication system, would you roll out your own or use an already existing plugin?

@ericgj
Copy link
Member

ericgj commented Aug 6, 2012

@agis I generally reach for OmniAuth, given it makes it easy to add/change auth strategies down the line and you can just basically drop in the dummy 'developer' provider to begin with.

But, I do like the simplicity of cyx/shield, and it could definitely use some documentation, so that is kinda motivating me to try it.

The typical case for my job would involve authenticating vs ActiveDirectory via OpenSSO, for which I use a custom OmniAuth provider. So my idea is to use the shield interface, e.g. authenticated(User), but implement it via OmniAuth instead of shield. But I haven't looked at the feasibility of that too closely yet.

PS. regarding app environments, one place to start is with the convention that Rack uses (and Sinatra on top of Rack) - the environment variable RACK_ENV .

@agis
Copy link
Author

agis commented Aug 9, 2012

OK guys I'm just starting, I'm using Mote (the template engine from the Cuba folks), Ohm (their hash-mapping library for Redis) and Bootstrap (twitter). I've implemented the basic Create & Read functionality (list all tasks, view a task, create a task) till now, it's pretty basic but I got an idea of how rendering, routing and redis works. Awesome: https://github.com/Agis-/cuba-todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants