Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking.
Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it for frameworks such as Rails so that Rails idioms are adhered to.
I've recently started looking for something like this for Ruby. What I've run across so far:
Saikuro
Roodi
Flog
These might be places to start. Unfortunately I haven't used any of the three enough yet to offer a good opinion.
Saikuro and Flog can be good for getting a basic idea of code complexity. You can also use a tool like rcov to look at your test coverage.
There is a plugin for Rails projects that combine all those metrics into a single rake task. It is called metric_fu.
Projects I've found and tested recently:
https://github.com/railsbp/rails_best_practices
Seems to work, and gives sensible warnings
https://github.com/simplabs/excellent
Works, but quite a few false positives
https://github.com/troessner/reek
I disagree with most of the warnings from this tool, but it works
http://www.cs.umd.edu/projects/PL/druby/
This requires ocaml; I haven't tried it, but it looks like it might be good
http://roodi.rubyforge.org/
does not appear to be Ruby 1.9 compatible
https://github.com/gdb/ruby-static-checker
Is broken for me, and only catches name errors, so unit tests should cover that.
https://github.com/michaeledgar/laser
Doesn't compile for me
You might want to try out RuboCop. It is a Ruby code style checker based on the Ruby Style Guide. It's maintained pretty actively and it's based on standard Ruby tooling (like the ripper library). It works well with Ruby 1.9 and 2.0 and has great Emacs integration. I hope you'll find it useful!
Dust looks like it can help you find unused and useless code, which seems like it sort-of fits what you're after.
I'm not aware of any other such tools.
This problem is vastly harder to address in ruby than it is in java - you'll note that all those java tools brand themselves as using 'static analysis' of the code.
Static analysis of ruby code often isn't possible, because there isn't anything static that you can analyze (methods often get created at runtime and so on)
At any rate, some of these things are unneeded in ruby because the language builds them in.
For example, you don't need a coding standard to enforce that your classes are all NamedLikeThis because the code won't work if they aren't.
P.S. I have to add the standard disclaimer that those kind of tools can often be a bit of a red herring. You can spend all day making your code adhere to what the tool thinks it should be, and end up with more bugs than you started with.
IMHO the best solution is to write your code fluently so you can read it more easily. No amount of static analysis is going to be as good as a human reading code which clearly states what it is meant to do. Being able to do this is where ruby is light-years ahead of many other languages. I personally would recommend you aim your efforts at learning how to write more fluently, and educating your team about such things, than spending time on static analysis.
Another nice tool, although in early stages according to the author is reek:
http://reek.rubyforge.org/
reek currently includes very naive checks for the following code smells:
Long Method
Large Class
Feature Envy
Uncommunicative Name
Long Parameter List
Utility Function
Nested Iterators
Control Couple
Duplication
List item
Personally I think it still has too much false positives, but just looking at the output in some of my code helped me rethink some decisions about code style and architecture.
Code Climate is a SaaS tool that integrates through git and automatically "grades" your code. It notifies you via various channels if there a sudden drop in quality. Nice UI as well.
I didn't see this questions when asked, but a blog post I did might help as well. In it I cover a bunch of Ruby tools and specifically cover 4 code quality tools...
Roodi
Dust
Flog
Saikuro
It might also be worth checking out Towelie and Flay
http://devver.wordpress.com/2008/10/03/ruby-tools-roundup/
Now we have combined a lot of tools into an only Ruby code quality and metrics monitoring tool called Caliper. This might fit your needs well. It tracks various quality metrics over the life of a project.
Caliper - improve your Ruby code
There is also excellent. I haven't tried it yet, but it too looks promising.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
We are transitioning across to BDD. Currently using specflow and visual studio to run our automated tests via Jenkins and have over 1000 tests in Quality Centre written in a more traditional fashion of which, the regression tests will be converted to BDD in time.
I'm looking for a repository (similar to test plan in Quality Centre) to house all our test cases/feature files. It must be compatible with Specflow and Jira. What do people use as a manageable test case repository for their tests?
Cheers.
I'm not 100% sure I understand your issue, not being familiar with some of the tools you talk about, but when you have executable specifications your test cases are in the feature files which are stored in the code base. This is part of the point, that your test cases are the things that get executed, so they are always up to date.
What #Sam-Holder said is good; adding to that because I'm familiar with the issue and the tools you're talking about.
You're probably used to the idea that Quality Centre contains a bunch of test scripts, some of which pass and some of which don't (yet).
When you're doing BDD with automated scenarios, they pretty much always pass, all the time. Half the things that QC does simply aren't needed with modern Agile processes.
A pretty common practice is to put the scenarios into the Jira story until they're automated. They're transient. Nobody ever looks at Jira once the story's done. The codebase is the single repository of truth, and anything that lives in Jira gets ignored.
The automated scenarios are checked into the same codebase as the code. If the scenarios go red (fail), the team makes them green ASAP. They provide living documentation for the code. See if you can find someone to show you what Jenkins looks like in action and you'll get a better picture. Commonly the Jira number is added to the check-in comment to provide some level of traceability.
I think it's good practice to keep any manual test cases checked in alongside the automated ones (though please do question why they're not automated; if you automated them in QC you can usually do it with SpecFlow). This helps the test cases (scenarios) to provide living documentation for the code. In fact, getting rid of the word "test" was part of the reason why BDD came about, because BDD's really about analysis and exploration through conversation. It provides tests as a nice by-product.
To answer the question, the most commonly used tool at the moment is Git (at least for newcomers). It's version control that the devs are using. SVN / Mercurial are also OK flavours of version control. Get the devs to help you.
If you're still working in a silo and not talking to the devs, don't use BDD tools like SpecFlow - you'll find them harder to keep up-to-date, because your steps will probably be too detailed and English is trickier to refactor than code.
Better still, use the BDD tools and go talk to the devs and the BAs / SMEs / Product Owner who understands the problem. Get them to help you write the scenarios. When you start having the conversations, even over legacy code, you'll start understanding why BDD works.
Here's a blog post I wrote on using BDD with legacy systems that might also be helpful to you. Here's a blog post on the BDD lifecycle: exploration, specification and test by example. And here's one to get you started on how to derive that "Given, When, Then" syntax using real conversations.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
tl;dr: I want a high-level introduction to Rails, which covers what I need to get started with proper reference materials. I don't need basic concepts explained.
--
Ruby and rails both seem nice, but the documentation, although voluminous, seems to be all tutorials targeted at people who aren't that experienced as programmers or web developers, or be super-terse snippets on how to use various libraries for people who already know all about rails and ruby.
The material I'm seeing seems to be very task-oriented, which is alright if you want to follow it through without much understanding, and are able to memorise a bunch of things. I, by contrast, do not have a great memory, so I want something concise, which explains the concepts and conventions, and how they fit together. I don't need anything that "introduces" any programming concepts - I'm familiar with functional programming, late-binding, object-orientation. I'm familiar with web technologies (or at least, sufficiently so that I can learn about them). I can read code and api documentation, but I'd rather have something that lets me see the big picture first. I can look at the various resources about the language (or even better, I'd love to also look at documentation for ruby in the same vein as what I'm asking for in relation to rails).
The closest to thing I have seen to what I want is the ruby guides, but they are still very much written in a fragmented and task oriented style.
I'm not a fan of programming books (generally either too linear, becomes out of date more quickly than suites of docs maintained online), but if the best material is published in that form, so be it.
I don't think I'm that unusual in any of these respects - plenty of people know a huge bunch of stuff (a lot more than I do), don't need their hand held, but want to start exploring with a minimum of fuss.
Any suggestions?
You might be interested in Agile Development with Rails by Sam Ruby, Dave Thomas.
You could skip the "Building Application" part and go straight to Rails in Depth part.
I quote the introduction to this last part:
For the rest of the book, we’ll go through Rails topic by topic (which
pretty much means module by module). You have seen most of these modules
in action before. We will cover not only what each module does but also how
to extend or even replace the module and why you might want to do so.
The chapters in Part III cover all the major subsystems of Rails: Active Record,
Active Resource, Action Pack (including both Action Controller and Action
View), and Active Support. This is followed by an in-depth look at migrations.
Then we are going to delve into the interior of Rails and show how the com-
ponents are put together, how they start up, and how they can be replaced.
Having shown how the parts of Rails can be put together, we’ll complete this
book with a survey of a number of popular replacement parts, many of which
can be used outside of Rails.
But first, we need to set the scene. This chapter covers all the high-level stuff
you need to know to understand the rest: directory structures, configuration,
and environments.
I don't know if I have right to paste this but if that can make you buy this book, I'm sure the author would agree!
To become good at Rails in my opinion you should first be sure that you understand Ruby well. I would suggest browsing through (careful reading is not necessary if you're already an established programmer) some of the basic ruby books like: Why's Poignant Guide to Ruby
and Programming Ruby.
After this, you should become familiar with the Rails API's and DSL's, I would suggest beginning with reading Ruby on Rails Guides. When you understand the Rails basics the ultimate Rails reference is Ryan Bates' excellent Railscasts. If you don't like watching videos the site has an ascii mirror. Even if you don't have a specific task in mind, go watch a few of these to really understand the way problems are tackled in Rails.
Ofcourse when it comes to actually gaining skill in developing Rails skills, it is imperative that you try your hand at actually making a few Rails applications. Rails has a notoriously steep learning curve, so it's best when you have tried a few simple unimportant applications before you try to build your life's work with Rails.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Please, share your favorite links on this language where one can learn the best of it.
And also, please describe in few words the most important features of this language differing it form others languages like Lua.
I just cannot understand why to reinvent another Lua/Python/etc. Maybe I just missed something...
But I like the idea of performance+scripting, so I have to understand it!
The best (and almost only) resource about the Squirrel language is it's official web site and forums: http://squirrel-lang.org
Compare to other well developed languages, Squirrel is still in it's early stage with a very small community, but it is very promising in certain ways among other modern scripting languages:
Inspired from Lua, with the usual concepts of tables, Lua stack etc, but with a MUCH cleaner syntax and C API.
Reference counting with supplementary garbage collector. The design of the run-time encourage the user to remove cyclic reference rather than totally rely on garbage collection (which can be slow or non-deterministic). The user can even re-compile the run-time with garbage collector disabled.
It's a language with C/C++ like syntax. It's kind of taste but it's the main reason of why I will favour Squirrel over Lua.
Build-in support of class, where in Lua you need to do some magic to simulate it.
Supporting C# like attribute, therefore you can supply meta-data to your class and properties. I use this feature to expose my script objects to .net property grid.
Undefined variables result in exceptions instead of silently creating a new null value like Lua.
Other features like lambda function, generator and co-routines are all built-in in this little but powerful scripting language which just made from ~6000 line of C++ code.
To conclude, the Squirrel language is suitable for interfacing with low level modules in a performance critical application (ie. a game engine), it absolutely can serve as a better Lua. Where as language like python is more towards a general purpose, day to day handy problem solving language.
emo framework, a free, open source game development framework for iOS and Android, is based on Squirrel. Its source code contains a few example programs/demos, as well as some library code written in Squirrel. Reading the source of them can be educational, I reckon.
I sincerely recommend having a look at emo for anybody wishing to learn the Squirrel language while having fun developing games or other apps for iOS and Android.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I have been using Grails for the past few months and I really like it, specially GORM. However, I am getting interested into Scala's Lift. Therefore, I would like to know your opinion about which kind of web apps are better suited for which of those two frameworks or it is just a matter of taste, which framework to use?
Finally, which of those frameworks do you think will be more used in the future?
I have the feeling that Grails is far from reaching a critical mass and it still remains very obscure (in the past few months I had the opportunity to work with middle size companies and IT startups working mostly with the JVM stack and only one person knew and used Grails) and I am not even sure if it can become the "RoR" of the Java world (Indeed reports a drop of growth in the last few months even if other frameworks have a positive growing rate). And I love Groovy, it is really easy to learn but I have noticed how slow it can be for some tasks.
On the other hand, Scala seems to be more popular (Tiobe Index) and the fact that Twitter is using it now gave it even more presence in the blogosphere with lots of lovers and haters making buzz. It is famous for being fast and scalable. However, the language seems somewhat hard to understand and learn for lots of developers (so maybe it will never gain mainstream status). Lift is little known and I have read some reports that it is better suited for small apps (less than 20 domain classes).
By seeing the number of books published Groovy-Grails dominate right now, but many publishers have Scala books on the works, so I think this advantage will not last long.
Finally, we have the problem that both languages and frameworks still have poor IDE support (it is getting better by the day but far away from what Java shops expect to be productive).
I do not want to start a flame wars, but I would be very interested to hear other users' opinions.
The accepted answer here takes a really ignorant view on Groovy - it is a modern, dynamic language (dynamic vs. static is a huge debate in and of itself, and not particularly relevant here). This is by design, and therefore not a disadvantage, just a difference. It has a lot of modern language features that Java does not have such as closures, native regexp, polymorphic iteration, some optional static typing (matter of debate, but also look at groovy++), native syntax for lists and maps, etc.- you can see a comparison here http://groovy.codehaus.org/Differences+from+Java
To address the actual question of Grails vs. Lift, I'd say Grails hands-down. It has the SpringSource behind it, and just look at the plugins page http://www.grails.org/plugin/category/all - I can't even find what plugins or equivalent are available for Lift. Grails is also on top of the latest cloud-friendly technologies, with features like native RabbitMQ messaging support, and turnkey GORM support for MongoDB and Redis.
Grails is a nice idea(but only "stolen" from rails) but the fact that the groovy guys are not interested in getting proper Eclipse support is hindering it's success a lot. I've even seen Eclipse questions not being answered at all on the grails lists.
I agree with Tim that Netbeans 6.7 finally delivers the first half way usable Open Source IDE support for groovy/grails - and eventually, SpringIDE will also feature better groovy/grails support.
The reason many Java folks love Java is the static typing, which enables tools to help you a lot with many things. This is lost with a language as groovy.
Yes, I could write every really important piece of Code in Java and still use Grails - but then, why should I, just to save a bunch of lines of glue code, do that instead of learning to use a Java framework highly effectively?
To come to an end: I did not yet look at scala, but built some simple apps with grails - and I tend to go back to java, even reimplementing every app that needs further development in a plain Java framework - I think wicket and Seam.
I'll also look at Scala/Lift, I heard many good things about it!
BTW: I'd compare communities and look at mailing lists - how many peope are there, do they get good answers on their important questions?
Grails seems to have a non-answered rate from nearly 50%, which I feel is bad.
Grails support in netbeans 6.7 is really good, as well as the idea intellij support in Maia.
Eclipse is still pretty sucky.
I looked at lift, but was concerned about the resources available now; this will change in the future, but my projects can't wait.
I would like to specifically answer the question "for which kind of applications". The main difference between the philosophies of Grails and Lift seems to be that Grails enforces MVC whereas Lift seems to be more liberal i.e. it doesn't enforce MVC but provides enough avenues to use MVC if you want to.
Also Lift seems to be excellent for 'Single-Page Applications', especially if you need to implement a server-push functionality using technology like Comet (which obviously doesn't imply it's not good for other types of applications). On the other hand, Grails seems to be better for the 'Enterprisy' applications, especially if you are already familiar with Spring and Hibernate but want your app to be much more concise (using Convention over Configuration) than what a non-Grails app would be using these technologies.
References:
Simply Lift, chapter 13
Single-Page Application
Disclaimer:
I have just started exploring Lift and built some simple apps using Grails.
With all the performance improvements and advancements of Grails2.0, with great support provided by IntelliJ 11 for the framework, an ability to plugin pretty much any advanced web technology into your grails app., and yes - VMware weight behind it - I really don't see how Lift could be an advantage or a good choice. Just think of using two different languages in the same application, need for double expertise in the team, etc.
The original question has been posted like 2+ years ago and I think time showed on which side is the choice of the dev community ;)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?
Though it's certainly not a direct answer, in the past I've found I prefer to use RedCloth (or a Markdown parser if you don't enjoy Textile) and use a simple textarea with an AJAXy preview. Generally speaking, WYSIWYG editors have a long history of creating redundant tags and similar, leading to potentially broken pieces of HTML.
While I know this has been answered I wanted to add regarding the use of textile... I completely agree, but I'd recommend processing it in a before_save filter. Let's say you have a database field called "details" - just add one called "details_html". Then do something like this...
before_save :convert_details
def convert_details
return if self.details.nil?
self.details_html = RedCloth.new(self.details).to_html
end
RedCloth can get a little process heavy and if you are constantly processing the stuff on each render you're going to run into some memory issues... this will just help lower some of your needed resources.
Update for 2010. I just implemented TinyMCE in a Rails app using the tinyMCE gem.
You can find it here: http://github.com/kete/tiny_mce
It took less than 5 minutes and in my basic testing, it's working perfectly. There was a commit in June 2010, so it looks like this is an actively developed gem.
Hope that helps some googlers.
I'm not sure about a Ruby Gem, but TinyMCE is a customizable, generally stable WYSIWYG editor that is fairly simple to integrate w/ any project. I've used it a number of times.
A similar question: What is the best WYSIWYG for Rails - Ruby on Rails Blog
I just pasted my same solution here too.
I strongly suggest you give WYSIHAT a try. The biggest problem with the editors mentioned above is its bulky size and "hard-to-customize"(ability). The bad code in most of these editors is a big turn-off. WYSIHAT is more like a framework for a WYSIWYG editor. Extremely easy to customize. Easy to configure. And what more.. Its backed by 37signals. What i would appreiciate about TinyMCE is its paste from word feature which preserves the layout. But if not for that one feature i find the rest really bulky.
Please do read this article: http://37signals.com/svn/posts/1330-introducing-wysihat-an-eventually-better-open-source-wysiwyg-editor
Tutorial on using WYSIHAT: Part 1: http://jrmehle.com/2009/01/25/wysiwhat-wysihat-part-1/
Part 2: http://jrmehle.com/2009/02/13/wysiwhat-wysihat-part-2/
And to make your life even easier theres an awesome rails-engine developed by Jeff Kreeftmeijer (80beans.com) for the 37signals WYSIHAT editor: http://github.com/80beans/wysihat-engine
And heres an article by Jeff Kreeftmeijer: http://www.80beans.com/2009/10/01/wysihat-engine/
I use FCKEditorOnRails plugin: http://github.com/UnderpantsGnome/fckeditor_on_rails/tree/master
Note that you can generally drop in the latest version of FCKEditor without much tweaking if you're running into bugs in the older version.
Have a look at http://livepipe.net/control/textarea
for a WYSIWYG markdown editor with the AJAXY preview mentioned in the chosen answer.
There is a plugin to use TinyMCE with rails, lots of information on the rails wiki.
+1 for FCKEditor - there is a great Rails plugin that includes helpers. However it is often overkill as it features everything. In many cases something a little simpler such as jQuery's WYSIWYG editor is great for wrapping a text area input.
I'm really loving CKeditor gem. It's much, much more elegant than TinyMCE, especially if you deal with raw HTML. CKeditor displays on page--TinyMCE gives a popup. CKeditor allows access to things like all headings right out of the box, too. TinyMCE requires hacking.
RedCloth's inability to support ALL HTML was a dealbreaker for me. (Among other things, you can't support giving an image a description OR a caption!!!!) I didn't mind the markup so much as the complete lack of flexibility. Plus, it was like learning a new language--a lot of the markup was the opposite of intuitive (like image alignment), and I couldn't possibly imagine asking contributors to learn all that.
For comments, I will use something much lighter weight, though.
I had bad experiences with CKEditor (gem "ckeditor") .. I managed to get it to work on local maschine but had a lot problems when trying to deploy it to Heroku .. It seems like code is too heavy to automatically precompile the code on Heroku ... That means it is quite useless ...
EDIT:
Solution: make sure that you precompile javascript before deploying it on Heroku.
I would use Tiny MCE it is a Java Script solution I have integrated with Web Applications to edit HTML.
http://www.tinymce.com/