Relative Content

Tag Archive for class

Why use classes when programming a tkinter gui in python

I program primarily in python and have programmed a couple of GUI’s with Tkinter, every tutorial I have ever seen has recommended defining and using a class for the GUI, but my GUI runs flawlessly using only procedures, without a class.

Create a global product search form to be used by many other forms and multiple users

I am creating a stock and inventory program for a wholesaler in C# windows forms, i have a product search form that allows me to search for a product and returns the productID,Name And price, which i use in many different forms. Currently i am saving the ProductID, Name and Price in static variables in a Utility class which i read the data back from. I use the same Product Search Form in various screen, e.g. Invoicing Screen, Orders Screen, Stock Receiving screen etc. Everything works fine but i now want to make the program multi user and i am not sure how my method will affect a multiuser environment. I have done alot of research but have not found any clear answers. Everyone says global variables are bad but dont say clearly how to achieve what i want clearly.
I want one Product search form that i can call on from different screens and get the data back to the calling screen safely without another user on the network changing the data before i can use it.

What is a component in C#?

Introduction
Components are an important building block of software. In terms of software architecture, there are a lot of principles regarding components that should be adhered to (high cohesion, low coupling, no cycles etc.).

Resolving Dependency Cycles

Class and component dependency cycles
Assume, we have component A with class CA, and component B with class CB, with a cyclic two-way dependency between classes CA <--> CB. Hence, we have a cyclic dependency between components A and B.

Defining functions inside vs outside a class

Say I have a class with a function do_thing that is comprised of multiple steps, which themselves segregate into functions (first_process and second_process). At what point would this be considered bad practice, particularly if you have several composite do_thing functions?