DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Developing (a.k.a. Testing) in Python - Part 1: Python and Java

Developing (a.k.a. Testing) in Python - Part 1: Python and Java

Daniel Gottlieb user avatar by
Daniel Gottlieb
·
Nov. 14, 11 · Java Zone · Interview
Like (0)
Save
Tweet
6.61K Views

Join the DZone community and get the full member experience.

Join For Free

Before coming to Fiesta I had worked with Java almost exclusive for the past six years. The codebase at my previous company was about 2,000 files and 300,000 LOC. I’m fairly fluent in Java, but I’ve also been a longtime Python advocate; I was excited to jump into a larger, more collaborative Python project than what I’ve put together over the years.

I’d like to take some time to talk about how the experience has gone so far. In this post, I’ll share my thoughts on testing in Python:

Running test cases is Python’s version of compile-time checking.

Running our collection of tests (using nose) on a bunch of symbol changes (e.g. changing variable names or method signatures) often leads to a bunch of errors and failures. At the same time, refactoring some code in a large Java project could easily produce hundreds of compile errors. Comparing the time spent getting tests to pass versus getting Java code to compile, it feels like a push. However, when comparing my confidence that things are working, Python comes out ahead.

This confidence through testing is only possible because of Fiesta’s extensive set of test cases; there are more LOC in the test files than in the application itself. Our testing goal isn’t to test every method, but rather to cover all of the actions a user can take. In that vein, almost all tests are end to end.

I find it more natural to write tests in Python than in Java. With Java and other compiled languages, I typically feel that once I get something to compile, it will work. That’s rarely the case, but that feeling subtly influences me to not write testing code alongside the logic code. When writing for Python, I’m often using the interpreter and generally find myself wanting to save my progress. It just makes sense to piece things together in a test function and place asserts when I want to pin logic into place.

Given my experiences so far, I’m not sure if developing in Python is any faster or slower than doing so in Java, but the time is definitely spent on different things. I’d like to do some more posts on this topic in the future, so let me know your thoughts/questions in the comments.

Party On.

Dan

 

source: http://blog.fiesta.cc/post/11060794329/developing-a-k-a-testing-in-python

Python (language) Java (programming language)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Why Performance Projects Fail
  • Take Control of Your Application Security
  • How to Utilize Python Machine Learning Models
  • Use Lambda Function URL To Write a Serverless App Backed by DynamoDB

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo