SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #21  
Old 12-14-2009, 04:12 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Sean, Plucky,

Thanks to both of you. I've been getting a little more comfortable with the Sun java docs but as always when learning something new the first few steps take a while.

I am getting ready to delve into java programming.

I'll try the _parseInt method to solve this particular problem. Plucky, If you do get around to making your methods accept integers I'd appreciate the jar.

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #22  
Old 12-14-2009, 05:46 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by stuckless View Post
Depending on your java version you could still end up with a method not found.
But again, if we're talking about Studio code, the method lookup is done by Sage using Sage rules, not by Java using Java rules.

Quote:
Originally Posted by stuckless View Post
In phoenix, I will sometimes create the method signatures that accept an Object, then I determine the type inside the method. This is not ideal programming behaviour, but it saves me from creating a bunch of overloaded methods for each type, int, long, float, string, etc.
In the case of int, long, float, and double, automatic widening applies so one method can cover them all (unless you specifically want to distinguish those cases in order to implement different behaviors).

Plus there are other reasons besides clarity to prefer overloads to generic Object methods. In general you want the compiler to do as much type checking and method resolution as possible, both to avoid runtime overhead and to catch type errors as early as possible. Pass the wrong type to an overloaded method and you find out right away. Pass the wrong type to a method that takes Object and you might not find out until after your code ships.
__________________
-- Greg
Reply With Quote
  #23  
Old 12-15-2009, 07:42 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Plucky,

I have my STV working using your current api's and the conversion methods you all pointed out to me. No need to create any special api's for integers (unless you need them for something else.) Please put all of your efforts into Ortus and SMM

Tom
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #24  
Old 12-15-2009, 08:27 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by tmiranda View Post
Plucky,

I have my STV working using your current api's and the conversion methods you all pointed out to me. No need to create any special api's for integers (unless you need them for something else.) Please put all of your efforts into Ortus and SMM

Tom
Tom,

Glad to hear I did send you a new jar last night If you want to use it.
Reply With Quote
  #25  
Old 12-15-2009, 10:01 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by GKusnick View Post
But again, if we're talking about Studio code, the method lookup is done by Sage using Sage rules, not by Java using Java rules.



In the case of int, long, float, and double, automatic widening applies so one method can cover them all (unless you specifically want to distinguish those cases in order to implement different behaviors).

Plus there are other reasons besides clarity to prefer overloads to generic Object methods. In general you want the compiler to do as much type checking and method resolution as possible, both to avoid runtime overhead and to catch type errors as early as possible. Pass the wrong type to an overloaded method and you find out right away. Pass the wrong type to a method that takes Object and you might not find out until after your code ships.
I can't really disagree with anything... and no one appreciates the importance of the compiler doing the work more than I... (I especially love the addition of generics in java5).

My point was really about simplify the consumability of the api. While, I would never encourage writing method signatures that accept an object in normal java practice... it can be quite useful when dealing with the STV, and core sage does it as well

By manually handling the type conversion, you can also provide better messages back to the user, which could improve the usability of the api, while adding in some overhead. ie, if my method accepts an Object but requires an int, then I can inform the user that they passed an invalid parameter type, and even dump the type in the message... as apposed to "unknown method", which even to a seasoned developer, you are left wondering if it's a typo in the method name or a signature issue.

I find that writing APIs that are consumed by the stv, my approach changes. Users of the STV do not have benefit of the ide telling them that they are misspelled a method, or missing an arg, etc. To ensure the best of both worlds... I tend to write very specific typesafe apis (using generics and overloading, etc), but then I create an "API" that is published and meant to be directly consumed by the STV developers. Because I'm lazy, I also, tend to auto-generate those STV facing apis, and in some cases, using annotations, I allow for "Object" parameters that are manually converted to a specific type, for no other reason as to make it easier on the STV developers to use the API. The other advantage of this layered approach, is that I can also refactor the underlying apis while having minimal impact on the STV.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording Errors - Unknown Cause jillsy SageTV Software 0 03-06-2009 12:44 AM
HDPVR showing up as unknown device after replugging in. personalt Hardware Support 9 11-02-2008 09:35 AM
Error:Unknown Internal Screen on MC Main Menu McBainWRX SageMC Custom Interface 2 08-01-2008 05:39 AM
Fix for unknown wma "bug" perry59 SageTV Software 1 10-31-2007 10:29 AM
HD channel tuning and guide data for an 'unknown' channel snoopy SageTV EPG Service 5 05-04-2007 11:24 AM


All times are GMT -6. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.