• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Debugging Recursive and Pattern Matching

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you guys actually debug your methods written in eclipse using pattern matching and recursions. I do not understand the flow of my debug statements. They simply jump from one case block to another. I think getting recursion correctly without the help of a debugger is to think about the solution and re think if the test case fails. This to me looks inefficient. What is your opinion?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. I've just been using unit tests. Starting really simple and building up. I haven't needed the debugger. Also for simple ones, I've been using a scala command line to explore intermediate expressions like whether foldLeft does what I think it does.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That holds good for the assignments that we currently do. But thinking about real time applications that we write? I have many times used the debugger to understand the source code written by other developers. I have also noticed that with some of my implementations of the assignment problems, the code is not any more readable and understandable although it works. This coupled with no debugging possibility is definitely a nightmare.
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't been using the debugger, partly because I'm not all that familiar with Eclipse and partly because I suspected it would work the way you say with all those recursive calls anyway. I've been using Scala worksheets a fair bit for building up the elements of my solutions, and of course using the unit tests to see if things are working. I've noticed we need to implement extra tests to check the various edge cases these days.

I wonder how far people are really using this kind of recursion in real-world projects, especially where people are still in the process of learning FP e.g. moving from a standard Java platform. So you might start out with a fairly imperative solution to get the inputs/outputs working right, then re-factor that into a more elegant recursive approach where appropriate. And some of the recursive solutions we've been working on here are not especially efficient, so recursion isn't always the best approach anyway. Even if it feels really cool to get something like this working recursively!
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chris webster wrote:I And some of the recursive solutions we've been working on here are not especially efficient, so recursion isn't always the best approach anyway. Even if it feels really cool to get something like this working recursively!


Agreed/ Suppressing that urge and doing it recursively since it is a functional programming class.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic