• 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

How to structure a program

 
Ranch Hand
Posts: 63
IntelliJ IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys.

I am in the process of writing a program that will basically do the following.

1) Check a sport website for my footballs teams� next fixture. (Done)
2) Sleep until this fixture has been completed.
3) Get the result from the website.
4) Send me a text message with the result by using Selenium to send the text. (Done)
5) Keep doing this until the end of the season.

What would be the best way to lay out this program class wise?
I have come up with the following.
One overall class to run the program.
Another class to look up the fixture and get the result.
A third class to send the text message.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What technology are you writing this all in? Is it a Web app, a Swing app?

How do you know when a fixture has been completed? Are you just guessing 90min + breaks + extra time?

In terms of the 'business tier' you'll also need to think about:

* A class to deal with the calendaring/scheduling (quartz might be a nice solution here).

You seem to have the other major 3 units of work separated
 
Timmy Ryan
Ranch Hand
Posts: 63
IntelliJ IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Martijn,

It�s a command line program.
When the program starts up or a match result has been just posted on the sports website I will tell the program to sleep until just before the next game is over.
It will then check back every minute until the new result has been posted.
I will have a look at the quartz class to see if it can help with the scheduling.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quartz is not so much a class as an entire API, but it will be perfect for your needs as you'll be able to schedule in all of the times of the games, it will also be able to deal with the inevitable situation of your program dying for some reason (cat eats power cord ). I'm curious though, there are several services out there that can do this (I'm a football fan myself..), is this just for fun/practice? In that case it's one of the best reasons to write code
 
Timmy Ryan
Ranch Hand
Posts: 63
IntelliJ IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.
I had to learn about Selenium for work. So what better way than to do something useful. Ya there probably are services out there but you may have to pay for them. With this I can send the text messages for free from my mobile phone company�s website.
 
reply
    Bookmark Topic Watch Topic
  • New Topic