Tuesday, March 17, 2020

Management Styles in the Workplace Essays

Management Styles in the Workplace Essays Management Styles in the Workplace Essay Management Styles in the Workplace Essay Management Styles in the Workplace Purpose Statement: My purpose today is to inform you on four different management styles in the workplace. Thesis Statement: It is important for managers to understand their management style when certain situations arise in the work place, by knowing your management style you will become a better leader. Introduction:Have you ever been told, â€Å"Do it this way or don’t do it at all?† if so do you know what type of leadership or management style this. Well today, I’m going to inform you about four different type of management styles; democratic, autocratic, paternalistic, and laissez-faire. Also, I am going to explain the advantages and disadvantages of each management style.Main Point 1: Democratic Management Style A. What is it? a. According to Building a Management Style, Democratic management builds commitment among employees in order to generate new ideas. It is one that seeks input from all employees and allows the staff to use their own work methods, to get the task done in a timely matter. The Democratic Management Style is similar to the participatory leadership style because it produces moderate task efficiency but high satisfaction, according to the textbook. These two types of management style result in a transformational leadership approach according to the publication by Larry Thompson. This approach results in staff empowerment by making the staff or team feel that they are part of the decision making process, which will motivate your team and generate new ideas. B. What are the Advantages and Disadvantages a. Advantages: i. It is people centered ii. Encourages others to share ideas iii. Tolerating alternative views (understanding at there is more than one way of accomplishing the goal) b. Disadvantages: i. The manager could be taken advantage of due to employees not working to their full potential. ii. Moderate task efficiency iii. Slow down decision making process Main Point 2: Autocratic Management Style A. What is it? a. According to Building a Management Style autocratic managers do a complete 180 has far as treating his/Her staff. The book states this type of manager is single-minded about getting long-term results, and help from others. b. Autocratic management style is very similar to high directive leadership style studied in the textbook, such as; productivity is high, with little concern for people and their satisfaction level. The autocratic management style only offers one-way communication, and that is through the leader. This type of management style falls into the transactional theory according to the publication by Larry Thompson. B. What are the Advantages and the Disadvantages?a. Advantages: i. Although this type of management style seems pretty forceful there are many advantages. According to Managementstyle.org a few of the advantages are: 1. Instructions are forceful,2. can make fast decisions, 3. less unexpected side track situations due to lack of communication. b. Disadvantages: i. With such a Hitler style management approach there will disadvantages to using the autocratic management style, according to Managementstyle.org, such as: 1. The staff may feel useless as they are not consulted 2. Input from the staff is not allowed 3. Staff waiting on instructions (will cause delays) Main Point 3: Paternalistic Management Style A. What is it? a. According to learningmanagement2.com the paternalistic management style is combination of both democratic and autocratic management styles. Paternalistic managers will ask for the staff views and opinions, which allows them to feel involved, but in the end the manager will make the finial decision. b. According to Dr. Daniel Theyagu, who is a corporate trainer and seminar leader, suggest that by using the paternalistic management style approach, the leader will learn to move away from delegation to empowerment. i. Dr. Daniel Theyagu suggests leaders should stay involved with the development of their staff, so that the manager can be aware of his/her staff’s needs. ii. It is important for constant communication, to clear up any uncertainty among the staff and make sure everyone is on the same level for common values and goal of the project or task. iii. Dr. Daniel Theyagu also believes that when people feel involved they are more likely to ‘â€Å"buy in’ the visions and values of the leader.† Main Point 4: Laissez Faire Management Style:A. What is it? a. Laissez Faire Management style is also known as negligent leadership style in the textbook. According to the business dictionary website, laissez-faire management styles is a non-authoritarian approach to management. This type of manager feels that or â€Å"believes that people will excel when they are left alone to respond to their responsibilities and obligations in their own ways. B. What are the advantages and disadvantages?a. Advantages: According to about.com this type of management can be very effect if: i. When leaders are still there for consultation and feedback ii. Members are able to work alone and still be motivated iii. If Members are highly skilled, they do not need to wait on management to tell them how to complete the task. b. Disadvantages: In most cases the disadvantages out way the advantages because i. The lack of guidance may leave the staff feeling neglected. ii. According to the textbook, leader take no part in the decision-making process and offers little advice or direction. Conclusion: We are all managers of your own lives, but one day we will be leaders of others. Democratic management style allows others to take part in the decision-making process. Autocratic management style leaders make decisions without regards to others. Paternalistic allows for others input, but the decision is still up to the leader. Laissez-faire management style is a more hands off approach, and this type of leader style is not recommended for most situations. Knowing what the different types of management styles are, and what they mean, this can be an informative advantage to maybe using certain management styles in certain citations.

Sunday, March 1, 2020

Multithreaded Delphi Database Queries With dbGo (ADO)

Multithreaded Delphi Database Queries With dbGo (ADO) By design, a Delphi application runs in one thread. To speed up some parts of the application you might want to decide to add several simultaneous paths of execution in your Delphi application. Multithreading in Database Applications In most scenarios, database applications you create with Delphi are single threaded- a query you run against the database needs to finish (processing of the query results) before you can fetch another set of data. To speed up data processing, for example, fetching data from the database to create reports, you can add an additional thread to fetch and operate on the result (recordset). Continue reading to learn about the 3 traps in multithreaded ADO database queries: Solve: CoInitialize was not called.Solve: Canvas does not allow drawing.Main TADoConnection cannot be used! Customer Order Scenario In the well-known scenario where a customer places orders containing items, you might need to display all the orders for a particular customer along the total number of items per each order. In a normal single threaded application you would need to run the query to fetch the data then iterate over the recordset to display the data. If you want to run this operation for more than one customer, you need to sequentially run the procedure for each of the selected customers. In a multithreaded scenario you can run the database query for every selected customer in a separate thread- and thus have the code execute several times faster. Multithreading in dbGO (ADO) Lets say you want to display orders for 3 selected customers in a Delphi list box control. type   Ã‚  TCalcThread class(TThread)  Ã‚  private   Ã‚  Ã‚  Ã‚  procedure RefreshCount;  Ã‚  protected   Ã‚  Ã‚  Ã‚  procedure Execute; override;  Ã‚  public   Ã‚  Ã‚  Ã‚  ConnStr : widestring;   Ã‚  Ã‚  Ã‚  SQLString : widestring;   Ã‚  Ã‚  Ã‚  ListBox : TListBox;   Ã‚  Ã‚  Ã‚  Priority: TThreadPriority;   Ã‚  Ã‚  Ã‚  TicksLabel : TLabel;   Ã‚  Ã‚  Ã‚  Ticks : Cardinal;   Ã‚  end; This is the interface part of a custom thread class we are going to use to fetch and operate on all the orders for a selected customer. Every order gets displayed as an item in a list box control (ListBox field). The ConnStr field holds the ADO connection string. The TicksLabel holds a reference to a TLabel control that will be used to display thread executing times in a synchronized procedure. The RunThread procedure creates and runs an instance of the TCalcThread thread class. function TADOThreadedForm.RunThread(SQLString: widestring; LB:TListBox; Priority: TThreadPriority; lbl : TLabel): TCalcThread;var   Ã‚  CalcThread : TCalcThread; begin   Ã‚  CalcThread : TCalcThread.Create(true) ;   Ã‚  CalcThread.FreeOnTerminate : true;   Ã‚  CalcThread.ConnStr : ADOConnection1.ConnectionString;   Ã‚  CalcThread.SQLString : SQLString;   Ã‚  CalcThread.ListBox : LB;   Ã‚  CalcThread.Priority : Priority;   Ã‚  CalcThread.TicksLabel : lbl;   Ã‚  CalcThread.OnTerminate : ThreadTerminated;   Ã‚  CalcThread.Resume;   Ã‚  Result : CalcThread; end; When the 3 customers are selected from the drop down box, we create 3 instances of the CalcThread: var   Ã‚  s, sg: widestring;   Ã‚  c1, c2, c3 : integer; begin   Ã‚  s : SELECT O.SaleDate, MAX(I.ItemNo) AS ItemCount   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   FROM Customer C, Orders O, Items I   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚   WHERE C.CustNo O.CustNo AND I.OrderNo O.OrderNo ;   Ã‚  sg : GROUP BY O.SaleDate ;   Ã‚  c1 : Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]) ;   Ã‚  c2 : Integer(ComboBox2.Items.Objects[ComboBox2.ItemIndex]) ;   Ã‚  c3 : Integer(ComboBox3.Items.Objects[ComboBox3.ItemIndex]) ;   Ã‚  Caption : ;   Ã‚  ct1 : RunThread(Format(%s AND C.CustNo %d %s,[s, c1, sg]), lbCustomer1, tpTimeCritical, lblCustomer1) ;   Ã‚  ct2 : RunThread(Format(%s AND C.CustNo %d %s,[s, c2, sg]), lbCustomer2, tpNormal,lblCustomer2) ;   Ã‚  ct3 : RunThread(Format(%s AND C.CustNo %d %s,[s, c3, sg]), lbCustomer3, tpLowest, lblCustomer3) ; end; Traps and Tricks With Multithreaded ADO Queries The main code goes in the threads Execute method: procedure TCalcThread.Execute;var   Ã‚  Qry : TADOQuery;   Ã‚  k : integer; begin  Ã‚  inherited;  Ã‚  CoInitialize(nil) ; //CoInitialize was not called   Ã‚  Qry : TADOQuery.Create(nil) ;  Ã‚  try// MUST USE OWN CONNECTION // Qry.Connection : Form1.ADOConnection1;   Ã‚  Ã‚  Ã‚  Qry.ConnectionString : ConnStr;   Ã‚  Ã‚  Ã‚  Qry.CursorLocation : clUseServer;   Ã‚  Ã‚  Ã‚  Qry.LockType : ltReadOnly;   Ã‚  Ã‚  Ã‚  Qry.CursorType : ctOpenForwardOnly;   Ã‚  Ã‚  Ã‚  Qry.SQL.Text : SQLString;   Ã‚  Ã‚  Ã‚  Qry.Open;   Ã‚  Ã‚  Ã‚  while NOT Qry.Eof and NOT Terminated do   Ã‚  Ã‚  Ã‚  begin   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  ListBox.Items.Insert(0, Format(%s - %d, [Qry.Fields[0].asString,Qry.Fields[1].AsInteger])) ;   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  //Canvas Does NOT Allow Drawing if not called through Synchronize   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Synchronize(RefreshCount) ;   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Qry.Next;   Ã‚  Ã‚  Ã‚  end;  Ã‚  finally   Ã‚  Ã‚  Ã‚  Qry.Free;   Ã‚  end;   Ã‚  CoUninitialize() ; end; There are 3 traps you need to know how to solve when creating multithreaded Delphi ADO database applications: CoInitialize and CoUninitialize must be called manually before using any of the dbGo objects. Failing to call CoInitialize will result in the CoInitialize was not called exception. The CoInitialize method initializes the COM library on the current thread. ADO is COM.You *cannot* use the TADOConnection object from the main thread (application). Every thread needs to create its own database connection.You must use the Synchronize procedure to talk to the main thread and access any controls on the main form.