Results 1 to 5 of 5

Thread: why Vb6 can implement the invocation of an event class in 5 lines.javaVb6 can impleme

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,042

    why Vb6 can implement the invocation of an event class in 5 lines.javaVb6 can impleme

    C , Python, Java, 50 lines of code.
    Why can't Microsoft and Oracle make it simpler, but high-level languages are as hard to understand as assembly?

    Implement similar event class functionality. What other programming language has a smaller amount of code, closer to the simplicity of VB6? Programmers are just like consumers, just like VB6. By adding byval and byref to the parameters, they can know whether the data can be modified and returned or read-only. In one sentence, but Java uses 30 lines of code. The VB6 language was already the most convenient in the world 30 years ago, and it should be called the most advanced and simplest programming language.

    Python demo
    Code:
    1. class WebSendEventArgs:
    2.     def __init__(self, data):
    3.         self.data = data
    
    5. class WebSender:
    6.     def __init__(self):
    7.         self.listeners = []
    
    9.     def add_listener(self, listener):
    10.         self.listeners.append(listener)
    
    12.     def remove_listener(self, listener):
    13.         self.listeners.remove(listener)
    
    15.     def send_data(self, initial_data):
    16.         event_args = WebSendEventArgs(initial_data)
    17.         for listener in self.listeners:
    18.             listener(event_args)
    19.         print(f"Modified data: {event_args.data}")
    
    21. # Simulate event handling function
    22. def handle_web_send(event_args):
    23.     event_args.data = f"Modified {event_args.data}"
    
    25. if __name__ == "__main__":
    26.     sender = WebSender()
    27.     sender.add_listener(handle_web_send)
    28.     sender.send_data("Initial data")
     
     
    The total number of non - blank lines of code is 24.
    Last edited by xiaoyao; Jan 11th, 2025 at 04:38 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width