• 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

When to use classes

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys,

I have been an IBMi RPG programmer for around 10 years and finally getting a chance to write some java production level stuff.

I can figure out what a code is doing by looking at it and chatgpt is always there to help. But feeling confused when writing new stuff.

For ex, please see the below class:



This is a class which executes a junit test for a bunch of hardcoded values. I want to replace the hardcoded values to be dynamic by reading from an excel file. I figured out how to do this, but the question is should I use a new class for this example, TestData with a provideTestData method and modify the annotation as OR could I just write it in the same method?

I am often having difficulties designing such stuff as RPG is mostly about modularising logic based on functionality which is straight forward to me. However in java in cases like this, not really sure if I should could just write a new method for this or an entirely new class. I guess what I am lacking is OOAD knowledge.
 
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When do you use classes? Very simply, all the time.
That looks more like a JUnit question so I shall move you to a more appropriate forum.
reply
    Bookmark Topic Watch Topic
  • New Topic