Quick one line question about Plugin interface

Talk to other Pedia users about the programs, share tricks and tips or ask questions about existing features.

Quick one line question about Plugin interface

Postby LibertyTrooper » Fri Nov 10, 2017 4:32 pm

Is there a reason that resultURLs is not scoped the same as resultTitles and that neither of them are accessible via properties?
LibertyTrooper
Captain
Captain
 
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am

Re: Quick one line question about Plugin interface

Postby Conor » Sat Nov 11, 2017 3:45 pm

Properties did not exist at the time of writing. They are new and exciting, as of like 8 years ago. :D

resultTitles gets used by the drawer to display all the results available, while the other is only ever used inside the class.
User avatar
Conor
Top Dog
 
Posts: 5212
Joined: Sat Jul 03, 2004 12:58 pm

Re: Quick one line question about Plugin interface

Postby LibertyTrooper » Sat Nov 11, 2017 7:24 pm

Hi,

I saw that. Is there some reason that its more appropriate in that class rather than being part of interface declaration in Sample.h? I have to say, while I"m able to write Objective-C, by no means am I an expert.
LibertyTrooper
Captain
Captain
 
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am

Re: Quick one line question about Plugin interface

Postby Conor » Sun Nov 12, 2017 2:36 pm

MyPediaPlugin class does a lot of the boiler plate loading and does access both variables in a few places for clean up. For example if the HTTP connection fails it sets them both to empty arrays, it also initializes them for you as mutable arrays. But you could move that work in to Sample plugin and not rely on what the superclass does.

This is actually something that needs to get refactored, as in Swift the conventions are different and even the initializing of a class is more strict and in a specific order. For example in Swift you have to initialize all your variables before you even call super.init on the super class and then initialize variables that are inherited, plus make sure to always call the designated initializer (you can't go through a convenience method). It's all a bit stricter, but intros sense it's better. As it's clear what is going on to someone debugging and issues.
User avatar
Conor
Top Dog
 
Posts: 5212
Joined: Sat Jul 03, 2004 12:58 pm

Re: Quick one line question about Plugin interface

Postby LibertyTrooper » Mon Nov 13, 2017 7:30 am

Well, the methods are being called so thats a very good start. I think where the problems are in my code are in the delegate accessors. The source level debugger sucks so I've not figured out *why* the errors are occurring yet. Swift really cannot make up its mind about setDelegate.

I took a break yesterday and played a bit more with the Python version. I've come to love that language except for list comprehensions and the dain bramaged lambda. But as Guido says, Python isn't a functional language.

By the way, I came across an excellent tool for munging data. I'm kicking myself since its been around since 2011 yet I was completely unaware. Its called OpenRefine and its by Google. Not sure how often you run into a need to munge data, but it could be useful if you ever want to do change to data, for example, in doghouse. Though, maybe it doesn't apply in that case. What I mean to say is that it allows for making data consistent and it does it in a very methodical way.
LibertyTrooper
Captain
Captain
 
Posts: 21
Joined: Tue Nov 07, 2017 11:22 am


Return to PediaTalk

cron