In my project, there is a lot of conversation going on.
[users] – database web1
[links] – database Xojo
[links] – database web2
intUserID – >> the ID taken from web 1 database
Trust me. It looks easy in this simple sketch but in IRL there is more data, ID’s and posts to keep track of!! Of different kind. Back and forth.
There are also loads of different properties inside the Xojo project, of-course.
I’m sure you also have experiences of confusing projects… How do you do to keep track of all!?
Or, do I just simply need to work more, to develop the more simple manner myself!? What would you do!?
I draw lots of diagrams like you did, usually pen and paper. What Kem said, encapsulation, goes a long way in not having to draw it out but it’s taken years of experience to make modular parts that plug together cleanly. Still, if it gets complex or I have any hesitation in picturing the communication and relationships I sketch it out in a notebook that’s always with my computer.
Thank you for these links! I watched the first part of the first video. I’ll save the URL.
I enclose the new photo, I think we speak about different things.
I do a lot of MonkeyBusiness, so that part is fairly easy.
But, what is Area51.mUpdateDataUI referring to!? It’s in a thread somewhere, but there are many threads and what user interface is that!?
Same with JOLT.intUserID and Area51.intUserID. What database is that referring to? To the Xojo database, the web1 or web2 database…?
OK, I know the answer but at least, you get the point. There are so many Windows, Methods and Properties and as the project develops, these will not increase (decrease!?? I mean, not becomes less.)
I really try to make things easy, but I think I fail… I shall try pen and paper. Also, I don’t see how Classes will solve all these interactions, these names and all updates and all there is…
I tried with the Notes, as you can see, but for me these notes are not very useful. “They’re not there when you need them”, so to speak.
I forgot to write, in earlier versions of Xojo, or in RealBasic, the user interface could be updated within the thread. For some reason, the great reason I assume, this feature was removed! For me, such improvement added to the confusion…! I must admit.
I know, the naming is confusing.
But still, in the example, OOP1 video above, the man updated information about a vehicle. It is fine.
But for me, there would be about 50 such issues in the moment and the software is far from finish!!!
What if the man in OOP1 also added 49 more things to update, such as buses, trucks, spaceships, and more… and also, to databases locally and in Internet, back and forth. The web pages in my project also respond with information back to the project, that need to be saved and stored. Not only in an array, as in the example, also in threads and saved in the database.
Maybe I just need to make my own mistakes and learn from that!?
A few ideas which might be of no value to you, but anyway:
In a growing project, I try to add an object hierarchy that gives me clues where what belongs. This means different folders for UI elements like images so they don’t clutter up the navigator, and maybe different folders for sub-“frameworks” I create to keep things that belong together visibly together too.
Whereever I create conversion methods, I name them Xojo framework style, meaning I often have a .toWhatever and a .FromWhatever method. So I never need to remember their name or function.
When something is working but I know I must return to it for refinement or more intensive checks and I don’t want to keep separate notes, I attach an attribute to it in Inspector, like “incomplete”. This way I have a visible mark in Navigator.
And, as stated above, make your objects as descriptive as possible. If I opened your project I wouldn’t have any clue what MonkeyBusiness does, let alone BananaLeft.
And, btw, with the move from Carbon to Cocoa Apple made it impossible to manipulate the UI from a background thread. I don’t know about the other platforms but wouldn’t be very surprised if their design patterns are similar.
I use this and I’ve used it for years and it sucks but I’m not complaining since it’s changed for a reason and if I complain the reason will not be changed!
You, or any other person in this forum. I don’t know what kind of software you do. People rarely write. I get the impression most, or much sw, is made on consultant basis. To use within a company, for various different reasons… Of-course if varies.
The software as I make will be used by the people with the knowledge that is the equivalent of an MBA in Black Hat Philosophy. These people break any rules that you can think of, break any common sense and in general, really use creative manners to get the sw to go outside the border of imagination… so to speak!
So! Since these people will look inside the code, as described earlier in a different thread, I’ve also made difficult names on purpose. Maybe too difficult!? So, I look for inspiration! Both to use confusing names but at the same time some kind of logic sense.
If we ever meet, I’ll tell you about MonkeyBusiness and all the bananas! It’s really clever!
I looked and I can’'t find the thread now. Maybe it wasn’t started by me or maybe it was a different topic. In the thread, were discussed how to look into a compiled file of any software. In this example, all code was written in clear text… Very easy to look at and to use. Little too easy, in my view!
The reason is not Xojo, but the underlying operating systems. All UI code must run in one and only one thread, and this is usually the main thread. So if you would code an application in Objective C on OS X or C# on .NET, you would have to deal with single threaded UI too.
Xojo has this neat little thing called a note. I like to add a “readme” note to my classes that explains what’s going on. I also add comments to properties to explain how they are used. It’s not much overhead & really helps later.
Another thing to embrace is ORM or to quote [quote=205082:@Kem Tekinay]Classes. Classes, classes, classes.[/quote] In working with database tables/views & 3rd party API’s I always create a class to encapsulate and document the process.
The observer pattern is another way to control what’s going on. When Xojo introduced WEB apps I found I was reinventing the wheel with my business logic so I embraced the observer pattern.
[quote=205631:@Jakob Krabbe]Black Hat Philosophy. These people break any rules that you can think of,
So! Since these people will look inside the code, as described earlier in a different thread, I’ve also made difficult names on purpose.[/quote]
What are you trying to do?
Are difficult names supposed to make them have to think harder and more carefully about what they do? But then that makes it harder for you too. It’s a weird kind of obfuscation.
If you don’t want them to break the rules use encapsulation. That’s where you clearly establish the bounds of something, what it can do, and validate all of it’s inputs and uses so it can’t be mishandled.
If you’re trying to let them break the rules but in a way that’s… pragmatic, I’d still use sensible names and a large portion of encapsulation, just make it flexible. It comes down to overall design, not so much which method is talking to which method. A bigger organization groups things so they plug together easier. You mentioned you don’t use classes. This sounds very flat, hundreds of things laid out on a table with spaghetti connections criss-crossing. With classes and interfaces you can build structures that snap together and group. Possibly understanding classes will solve your problem better. The more organized a design is the more effective it can be used, whether the design is very strict and can’t be broken or very flexible and open to creative binds.
The problem of what method is talking to what method implies to me a poor design. When I’m coding I’m working in a group, a little microcosm of the program. It might be a class or window but I only care about it and the ‘types’ it talks to. What’s behind those types doesn’t matter too much, I just need to know what their interface is. As long the contract of that interface is upheld I only have to look in the class to know what’s going on.
You can make a mess with classes too, a whole other axis of spaghetti. The difference is it’s easier to add new little compartmentalized objects into a complex system because you’re not trying to patch into globals spread all over. Things are linked up in trees, graphs, lists, callbacks, inheritance, and that’s where the mess comes in.
It’s difficult to know how my tone is coming across; I really am curious what you’re doing. I like the phrase ‘black hat philosophy’.
Are you ironic or honest!?
Well, let’s not dive into the issue…
I think the purpose of this thread was little unclear.
However, now I understand all better.
I wasn’t expecting you, developers, to tell me how to do in my project. Rather, I find the solution on my own, but the postings in the thread.
Now, I was thinking of a working pattern.
I shall give each window and each view an ID and then use this ID as the part of the name in the different Methods and other names that I have.
A1, A2, A3
Then, I know where all the action is.
The names Web1 och Web2, as above, was really not that bad, after all!
intW1UserID – user ID taken from the web page database.
intSWUserID – user ID from the software.
intSWCountryID, intW1CountryID and intW2CountryID will be quite clear where they all origin from!
So! It was also the purpose of the thread! To make such improvement, that will help me keep track of all. Maybe also to inspirer others!? I shall also consider the uses of Classes.