in reply to Re^2: Ordering of parameters - Re^9: Converting Unicode
in thread Converting Unicode

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^3: Ordering of parameters - Re^9: Converting Unicode

Replies are listed 'Best First'.
Re^4: Ordering of parameters - Re^9: Converting Unicode
by Jenda (Abbot) on Dec 25, 2023 at 15:53 UTC

    I do not care about your personal details, I was asking about your programming background, so that we'd know where you are coming from and what topics to use when trying to help you. Pascal is not really what I would have expected, but truth be told I've seen a (to my great surprise functional) program in pascal that started with a declaration of labels and variables and the it went from BEGIN to END. You are not a programmer by trade, OK, that's perfectly fine. What are you by trade? We do not want to know to belittle you, we want to know so that we can help. To be able to choose similes and examples that would make sense to you.

    The solution is not Raku and as you convert more and more code you'll encounter the very same problems you are facing now. I can see use for a package sharing constants, but if you have a package for sharing global variables, you are doing it all wrong.

    Maybe instead of trying to understand OOP, you ought to try using it. I don't mean using an OOP module made by someone else. I mean designing a tiny little module of your own. You'll likely go through several designs before things start to make sense, but that's to be expected. Back when I was starting with OOP I designed and redesigned and reredesigned a little text-mode menu and dialog library in Pascal and while I never used it in anything that anyone else would ever use, it was a great learning experience.

    Perhaps you need to ignore all that inheritance and encapsulation talk and just start stuffing some data and subroutines changing that data into a separate package and eventually go from

    my $results1 = doTheSearch(p1,p2,p3,p4,p5,p6,p7,...p55); my $results2 = doTheSearch(p1,p2,p3,otherp4,p5,differentp6,p7,...p55);
    to
    my $search = new Search(p1,p2,p3); $search->setLocalizationOptions(p21,p22,p23,p24); $search->enableThis(); $search->disableThat(); $search->setFulltextEngine('server', $username, $password); ... my $results1 = $search->searchFor(p4, p5, p6); my $results2 = $search->searchFor(otherp4, p5, differentp6);

    In reality most classes never get subclassed and never import any traits or participate in any other OO stuff, so don't worry about those and don't worry that it all doesn't make sense. An object is not some esoteric concept, it's just a bunch of variables and methods. Something you can feed parameters to in chunks and have it keep the state. If you tend to call your search subroutine with 50+ parameters severa times and most parameters stay the same, then it should have been an object instead. And object that first receives (most of) the stuff that stays same and then each time gets called to do the work with just the stuff that changes passed at that particular place.

    Jenda
    1984 was supposed to be a warning,
    not a manual!

      What are you by trade? ... we want to know so that we can help. To be able to choose similes and examples that would make sense to you.

      Based on posts here, I'd go with teacher, with a keen interest in TEFL, especially Thai.

      Update: in this node he sounds like an English teacher. :) Moreover, Polyglot means "a person who knows and is able to use several languages".

      👁️🍾👍🦟
        Christian missionary. I just googled and found that out and it explains this entire thread.
Re^4: Ordering of parameters - Re^9: Converting Unicode
by SankoR (Prior) on Dec 25, 2023 at 03:16 UTC
    people seem to want to pry into more personal details
    Not really. Jenda wasn't asking for a biography and your eyes glazed over the important part of their comment: You do not need Raku, you need a beginner's programming book or a decent beginner's course.

    Raku appears to be that solution.
    How have you found a solution when you aren't even seeing what the problem is?
    For what it is worth, "taint" was so quintessential to good code that Raku has dropped it completely.
    No one mentioned taint but taint has a purpose. As does strict. You not understanding the role taint plays, why strict isn't on by default, or when you'd use either of them hardly takes the shine off them. Perl's feature-set is still not the problem and hardly the topic at hand.
    named variables I think it should be easier.
    Perl can do that but named variables is just treating a symptom. The glut of incoming data is a symptom. Non-technical code that confuses the original dev while it's still being designed and written is a symptom. That beginner's course Jenda mentioned would introduce you to basic design principals which you are overlooking or unaware of which is allowing you to write poorly organized, write-only style code. Like I've said, if you're too hasty, you'll just take these same bad decisions into your rewrite. Software design is more than just syntax and getting it to spit out what you expect.
    Nor is it related to my IQ--which is high. It is simply a disability.
    There it is again... haughtiness passed off as humility. No one is questioning your intelligence. Well..., not being able to accept correction or proper guidance would play into emotional intelligence but we're not here to diagnose. You do not need to be exceptionally bright to write software. You don't even need to be especially smart to write very good code. You're bad at software design right now but that doesn't mean you're a moron or incapable of improving because it's a skill not a talent. You develop it with experience and listening to people who have experience.

    We're offering our experience here and you're not just ignoring it, you decided to be offended by it. That's kinda frustrating.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^4: Ordering of parameters - Re^9: Converting Unicode
by eyepopslikeamosquito (Archbishop) on Dec 26, 2023 at 02:51 UTC

    > Part of refactoring my code with Raku involves trying to put my code into packages.
    > Folk here seem not to believe me, and think me just a lazy programmer unwilling to learn OOP, but try as I might I cannot understand it.

    A few famous quotes:

    Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.

    -- Rob Pike

    Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures, and I won't usually need your code; it'll be obvious.

    -- Eric S. Raymond

    I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.

    -- Linus Torvalds

    To break our current impasse, how about having a go at describing your data structures instead of your code?

    Updated: minor changes to wording.

    👁️🍾👍🦟