?
Solved

Any good books on OOP Event-Driven thinking for old fashioned Procedural Programmers?

Posted on 2011-10-15
1
Medium Priority
?
313 Views
Last Modified: 2012-05-12
I'm looking at my latest program, taking a step back, and it looks like I'm still thinking old fashioned procedural programming which I've been doing for decades instead of new Event-Driven OOP design.

All my methods are in Form1 (except for a msg class I made). The method names look like procedural programming methods that "do things"

// FORM1 - STARTUP,END
Form1_Load
RequestFormClose
Form1_FormClosing

// FORM1 - UPDATE FIELDS
SetTextControl
AppendTextBox
UpdateNumericUpDown

// FORM1 - BUTTONS
buttonExit_Click
button..._Click
button..._Click
...(lots of buttons)
EnableButton

// FORM1 - TIMERS/CLOCK
UpdateClock

// LOG
OpenLogs
CloseLogs
LogMsg

// SERIAL PORT DEVICE
FindSerialPort
PortOpen
PortClose
PortSend
PortReadReply
serialPort1_DataReceived
serialPort1_ErrorReceived

// MSG
ParseReply
SendThisMessage
SendThatMessage
...

// MISC
ClearDirectory
SendMsg
fileSystemWatcher1_Changed
Test
The one thing I think I did half right is create a new instance of a msg class every time I want to send a message
Msg m = new Msg(themsg);
PortSend(m.msg);

Open in new window

But even then I'm calling PortSend to send the message, instead of something like m.Send (Well how can a message send itself? It needs to go to the port.)

I have an entire bookshelf of books on C# and Java and I've read them all, but it appears I still think Procedure Programming. I've tried searching Amazon for more books but all I find is more of the same.

So any good books on getting me to think OOP & Event Driven instead of old fashioned Procedural Programming? Something like "Event-Driven OOP Programming for Old Fashioned Procedure Programmers"

Or maybe I need to see some big example programs that show how the pieces work together, because all I ever see is code snippets showing how to "do specific things", which I then end up using in the old fashioned procedure way of "do this, then do that".
0
Comment
Question by:deleyd
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 36974909
I don't have any OO-specific books to speak of, but in looking at your example I'd say think of it like this:  sure you want an OO approach, but some of your code will still procedural-esque.

When you're working inside of a class, you can certainly call functions defined within that class like ordinary functions. If it makes you feel more object-oriented, you can always prefix the function call with "this." so that you can see that the function being called is an instance method, and the instance being referenced just happens to be the class you are working in.

You may want to look into design patterns as well as they will help you avoid common pitfalls in program design as well as give you a jumping off point for common design problems. One book that I have particularly enjoyed on the subject is Head First Design Patterns. The code is in Java, but it is easy to follow. The concepts are applicable to most any OO language.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question