Modularity in OOP vs Procedural? - oop

As part of a course, I've been asked to give a definition of Modularity in two cases. The Object-oriented programming and the Procedural one. After reading up on this concept I still do not understand how Modularity differs in those two. Could someone please highlight the major differences?
I've added the screenshot of the specific task to give you an idea of what I'm presented with.
Thank you in advance for your time and help.

Wikipedia has an article about "Procedural programming" where the two (procedural and object-oriented) are compared quite well. See the "Comparison with other programming paradigms" section of the article.
Link of the article: https://en.wikipedia.org/wiki/Procedural_programming
You can also read up on modularity there to understand the concept better.

Related

Where can I find good explanations of Computability and Complexity?

I have a repeat coming up in Computability and Complexity and I was wondering if anybody has good resources for this sort of study.
Things like regular languages, context free and context sensitive languages and all that sort of stuff.
For example:
As you can see, it is a horribly phrased question. The notes our lecturer gave us are equally as bad. I really need to pass this module so if anybody has a good resource for studying these topics it would be much appreciated.
I think the problem you're having is not the fault of the phrasing, but the fact that you're not yet comfortable dealing with the mathematical notation involved.
Wikipedia has a lot of articles on automata and other computer science theory topics. Also, a google search on 'NFA to DFA' turns up many helpful results. Automata are used heavily in compilers, so you might find a more "practical" explanation of things in material from a compilers course.
Your class is going to be heavily mathematical, though, so you would do best for yourself by putting aside the attitude that the material you've been given is poor and spend the time learning to understand it. Mathematical formulations give you precise and concise descriptions without as much room for misinterpretation as informal language has.
You may want to look at the class notes made available by Avi Kak at
https://engineering.purdue.edu/kak/courses-i-teach/ECE664/Index.html
See the handwritten notes on Lecture 17 that explain the notation in your question.

Short intruduction to OOP basics

Can somebody point me to good intruductions into OOP main paradigms, like inheritance, polymorphism, encapsulation? I am looking for short article, about 2-3 pages, for very quick reading.
Thank you very much.
Just google for it http://en.wikipedia.org/wiki/Object-oriented_programming
The definitions from Alan Kay (he invented the term) on c2.com:
http://c2.com/cgi/wiki?AlanKaysDefinitionOfObjectOriented
http://c2.com/cgi/wiki?AlanKayOnMessaging
Which might not be the object-oriented you're looking for.
The big idea is "messaging" - that is what the kernel ...
is all about ... The Japanese have a small word - ma - for "that which
is in between" - perhaps the nearest English equivalent is "interstitial".
The key in making great and growable systems is much more to design how its
modules communicate rather than what their internal properties and
behaviors should be.
A very quickly reading cannot introduce you to the OOP paradigm. It's a very large topic and it's better that you study it with attention because it can determine how your code is structured.
I also suggest you to improve your knowledge of design patterns, when you'll correctly understand OOP.
This is hardly a niche topic. For a C#-angle on it take a look at MSDN's documentation: http://msdn.microsoft.com/en-us/library/ms173109%28v=VS.80%29.aspx
Take a look a the Simple English wiki article on OOP.

Correct Approach for mastering SAP R3 and ABAP

I have been working on SAP technology for the last 2.5 years.
As there were so many technical concepts, I couldn't get a single source where I can learn about everything related to it. I didn't get the confidence of mastering all the technical concepts.
Please help me out if you have faced such an experience and how you overcame it.
Suggest some books or a methodology you followed which may be helpful.
Note: I have already worked in Java/J2EE. I am confident enough in mastering the concepts.
Obviously the (or rather a) correct approach would be one that works for you, the conclusion being that you don't know whether the approach was correct until you've tried it. :-)
Enough philosophy - my suggestions would be:
Learn how to read the SAP Online documentation. That's a bit different from reading other documentation - the SAP docs are littered with information about legacy techniques that you don't really need. Learn to identify and skip these parts - you can always come back later.
Develop a knowledge of the data dictionary. It's really at the heart of all things, and if you can't navigate there and read the structures, you're lost. Start reading the chapter in the online docs at http://help.sap.com/saphelp_webas620/helpdata/en/cf/21ea0b446011d189700000e8322d00/frameset.htm.
Read http://help.sap.com/saphelp_webas620/helpdata/EN/fc/eb3138358411d1829f0000e829fbfe/frameset.htm. I know that's a lot of stuff, but it's available for free, and almost everything is in there. Again, do a "fast indexing run" first to get a feeling of what's inside there, then dig into the basic concepts. ABAP at its lowest level isn't fundamentally different from other imperative / procedural languages.
Follow the example programs (transaction code ABAPDOCU). Learn how to use the debugger (vital!) and understand what's going on in the demo programs.
Once you've got a mental model of the basic language, take a look at ABAP Objects. If you already know Java, there should be no problem with the basic concepts, but there are a few specialties.
Feel free to ask if you run into something you don't understand.
There is no single source of information that will provide you with everything you have to know, especially since some of the knowledge is very specific to the context (FI, MM, IS-H, ...).

Learning/Implementing Design Patterns (For Newbies) [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm a confused newbie and hobbyist programmer trying to get a grip on this, so forgive me if my question is a little off or doesn't make much sense.
I see a lot of questions on SO revolving around the use of design patterns, and I'm wondering if anyone has a good resources for learning about, and implementing design patterns? I understand the general idea, and know how/when to use a couple of them(Singletons, Factory methods) but I know I'm missing out.
(Just in case it matters, my language of preference is C# but I could learn from examples in other languages)
Head First Design Patterns
and the Design Pattern Wikipedia page are the best resources for beginners. FluffyCat is another good, free online resource for design patterns in both Java and PHP.
The Gang of Four book is where to go afterward, but it's fairly advanced, so I'd wait until you have a pretty firm grasp from the other resources.
Design patterns are great for various reasons:
gives you a starting for solving common problems.
gives developers a vocabulary to talk about certain ways of solving problems in a very compact manner.
when working with developers who know design patterns and you use design patterns in your solutions they will understand the solutions a lot faster.
But when your goal is just to learn design patterns I think you are missing the fundamentals. All design patterns are based on more common principles. High Cohesion, Low Coupling Open Closed Principle, DRY, Liskov Substitution Principle etc. For these fundamentals I would read the following books in this order:
Head First Object-Oriented Analysis and Design (Head First) [ILLUSTRATED] (Paperback)
Applying UML and Patterns (Hardcover)
Agile Principles, Patterns, and Practices in C# (Robert C. Martin Series) (Hardcover)
After that you are ready for the basic gang of four design patterns
Head First Design Patterns (Head First) [ILLUSTRATED] (Paperback)
The BIBLE
A nice website (don't buy anything, it is not worth it) http://dofactory.com/Patterns/Patterns.aspx (some implementations of this site are worth a discussion
The next step:
Patterns of Enterprise Application Architecture (Addison-Wesley Signature Series) (Hardcover)
The POSA books
And always remember : the pattern is not the goal !
I'd add that Design Patterns book from the "Gang of four" is a bible for anyone who is seriously interested in design patterns.
My tip:
Read a lot about the patterns from different sources.
Trying to force as many patterns as possible into all the code you're writing as this point is not going to give good results. Instead, let the information rest inside your brain for a while (read: months).
Suddenly you'll find yourself stumbling upon a problem or piece of code and you'll vaguely remember that you've seen something that might work as a solution to this particular problem. Now is the time to look up the details on the pattern you are thinking of and try to apply it.
That's what has worked for me, anyway.
Design Patterns
This tutorial site contains following sub-sections
Intent of each design pattern
Real World Structure for the design pattern
A Problem statement
Detailed discussion on the problem
Checklist on how to arrive at a pattern
Rules of thumb while arriving at pattern.
Code snippets for the design pattern which includes C#, C++, Delphi, Java and PHP
This site also contains guide on Anti Patterns, UML and Refactoring.
Bruce Eckel has a book on design patterns, although it's Java, it's like all of his books amazing. And the best thing is, they are free!
C# 3.0 Design Patterns for a C# perspective on design patterns.
(source: oreilly.com)
An introductory book that I found useful and well written is
Design Patterns Explained by Alan Shalloway and James Trott (Addison Wesley).
Do not start from the Gang of Four book, for it is not an introductory book by any means.
I would recommend taking a look at Jean Paul Boodhoo's quintology (?) on Demystifying Design Patterns on DNRtv, urls supplied below. The videocasts touches on Singleton, Abstract Factory among others- the difference being that you can watch him code as he discusses the theory. Good to watch over lunch on a rainy weekday.
http://www.dnrtv.com/default.aspx?showNum=63
http://www.dnrtv.com/default.aspx?showNum=65
http://www.dnrtv.com/default.aspx?showNum=68
http://www.dnrtv.com/default.aspx?showNum=71
http://www.dnrtv.com/default.aspx?showNum=92
An annotation to the above comments.
A Quick Reference For GOF Patterns
Here is a good place you can start dofactory.com/patterns/patterns.aspx - You can find link to each pattern, along with corresponding implementations.
How ever, remember that these are GOF patterns. You might need to read and understand advanced patterns as well, once you gain enough expertise in OOAD. Head First Design Patterns is a good start, and after making some progress, go with Martin Fowler's Enterprise Application Architecture Patterns.
Applying Design Patterns - The Thought Process
Another main aspect - Applying Design patterns is as important as just knowing them. Reading these articles might help you as well.
Applying Design Patterns Part I
Applying Design Patterns Part II
Hope this helps
Head First Design Patterns is a good one like others already noted. Besides this, of course the original book and C# Design Patterns. Also there are good websites already mentioned.
Besides self-learning, I seriously recommend starting or attending a pattern study group in your area. See A Learning Guide To Design Patterns for explanation and great order to study the patterns in. We did this and I can honestly say that I would not understand as much as I do now. A weekly meeting with other interested people keeps you surprisingly disciplined when learning something abstract like design patterns.
Happy studies!
Before spending money on books I would recommend Wikipedia's excellent design patterns page. Also for something different Google for "design pattern screencasts" or search for "design patterns" on YouTube. Getting the same information presented differently often helps the penny drop.
The Gang of Four book is the definitive text on the most well known patterns but is not that easy to read and with C++ examples not everyone's favourite.
The Head First Design Patterns text is far more accessible but only contains a subset of the Gang of Four patterns.
The most important thing is to understand where and why a particular pattern is useful. Afterwards search the web for implementation examples in the language of your choice and experiment until you "get it". Understand one pattern before moving on to the next. Everyone understands some patterns better than others (and there are hundreds of lesser known ones).
Just keep plugging away.
(source: Amazon)
Patterns of Enterprise Application Architecture (Hardcover) by Martin Fowler
Refactoring to Patterns (Hardcover) by Joshua Kerievsky
Continuous Integration: Improving Software Quality and Reducing Risk (Paperback) by Paul Duval et.al.
Beyond Software Architecture: Creating and Sustaining Winning Solutions (Paperback) by Luke Hohmann
Design patterns are like any library function, read about them, then when a problem comes up, the design pattern will be in your "Toolchest". There are many design patterns books all patterned after the original "Gang of four" design patters.
For any programmers, I think that and the Refactoring book by Fowler are the absolute minimal requirements.
For websites, a very good site is http://ajaxpatterns.org, from one of the developers of the ajaxian website
The original Design Patterns book is a must-read for all programmers.
It is an excellent book on every level: layout, clarity, insight, depth. It's one of those great books that you first read cover-to-cover, and then use as a reference until you literally know it inside out.
You could start by the Wikipedia page, but treat yourself with the great book too.
Applying UML and Patterns by Craig Larman. Start from the basic of analysis, design and uses a simple Case scenario. Introduces most of the basic patterns in a simple way.
If you read about design patterns you'll notice that Java seems to have a few of them implemented.
Look at the source for any framework and you can glean info about design patterns. Personally I don't see them fitting in perfectly to any of my code, sometimes the examples in books and tutorials seem a little idealized, especially for the lone coder.
Design patterns aren't for lazy coders.
For me and my colleagues study Design Pattern that following on Pattern Study Group. They prepare a list of each pattern that we should learn in order and also have the opening questions that make more discussion in group.
I also suggest having a shufty at Refactoring to Patterns once you've read Head First Design Patterns.
Note: The code examples are in Java, but should be very similar to C# examples...
It does not make too much sense to me for someone with very little experience to delve too far deeply into design patterns. It is great to know they exist, but at this point you should focus more on other things rather than just learning about design patterns.
They are useful in context of a problem - as a concept for a new/beginner developer they are really not too much practical value aside form knowing that you should make use of them when and where you can.
EDIT
To clarify - many design patterns are a result of problems found in some domains. A new programmer can hardly be expected (IMO) to know the design pattern(s) to use for some set of problems. Just as we get a smattering of algorithms in CS studies, we need an understanding of the things we can do with patterns and their benefits, but when a person is still building hello world or discovering stl there is not much practical need for design patterns. Patterns are great. But they are not the silver bullet.
(Neither was CASE (tools), neither is/was UML, neither is SCRUM, neither is TDD, nor STL, nor Java, nor XML, etc. ) These are all just aspects of our profession and to treat these topics as the second coming is naive.
Patterns comprise the high level vocabulary programmers use to talk about abstract design. If you are reusing an abstract solution, it is helpful to refer to it by name. If you invent a pattern, it is professional to do a little checking to make sure it hasn't already been given a name. If it has been named, then the description may be useful.
After you code even a tiny bit, you will notice yourself writing something similar to what you coded before. This is a pattern. Even if it is a tiny pattern, it is worth noticing. Is there a better pattern? Do you see certain tiny patterns cooperating together to solve a larger problem? Well next time, when you want to solve larger problem, the entire pattern comes into your mind as a single chunk. Fleshing out the detailed lines of code becomes mechanical.
The more you notice patterns, the easier programming becomes, and the more you will appreciate some of the biggest and best patterns worked out by other programmers.
Try mastering the MVC pattern. One way or another, variations show up all over the place, even in tiny design decisions.
Once you understand the concept, go through the Eclipse source code or design, lots of really good examples of these patterns (no surprise, Gamma was one of the designers).
I have found Design Pattern articles on this website really easy to understand
Design Patterns in C#

How to develop *real life* oop skills?

I've been studying OOP for quite a while now and I have a good grasp of the theory. I read the Head First book on OOP and, while it reinforced a lot of the theory, I found the case studies to be somewhat trivial.
I find that I'm applying OOP principles to my code each day, but I'm not sure if I'm applying them correctly. I need to get to the point where I am able to look at my code and know whether I'm using inheritance appropriately, whether my object is cohesive enough, etc.
Does anyone have any good recommendations (books, online guides, blogs, walk-throughs, etc.) for taking the next step in developing solid OOP skills?
I am working primarily in .NET (visual basic), but I welcome suggestions that incorporate various platforms.
Read Refactoring by Martin Fowler, and apply it to your own work.
It will take you through a litany of malodorous characteristics of software code that describe how to detect improperly constructed classes, and even more importantly, how to fix them.
Consider looking into Design Patterns. Although it seems like they aren't commonly used in enterprise applications (I've seen them more commonly used in API's and Frameworks than embedded into enterprise code), they could be applied to make software simpler or more robust in a lot of situations if only developers knew how to apply them.
The key is to understand the design patterns first, then with experience you'll learn how to apply them.
There is a Head First book on design patterns that teaches the concept pretty simply, although if you want a book that really covers design patterns in detail, check out the Gang of Four design patterns book, which is basically what made design patterns mainstream and is referred to almost every time the topic is brought up.
Design patterns can be applied in pretty much any object-oriented language to some degree or another, although some patterns can be overkill or over engineering in some cases.
EDIT:
I also want to add, you should check out the book Code Complete 2. It's a very influential book in the world of software development. It covers a lot of different concepts and theories. I learn something new every time I read it. It's such a good book that if I read it every 6 months to a year, I look at it from a different perspective that makes me a better programmer just by re-reading it. No matter how much you might think you know, this book will make you realize just how little you really know. It's really a great book. I can't stress how much you should own this book.
If you already have the basics, I believe only experience will get you further. You say you are not sure if you are applying the principles correctly, but there is no one correct way. Code you write today, you'll look at in 6 months time, and wonder why you wrote it that way, and probably know of a better, cleaner way of doing it. I also guarantee that after 10 years, you'll still be learning new techniques and tricks. Don't worry too much about it, it will come, just read as much as you can, and try and apply what you read in small chunks.
I am currently half-way through the following book:
http://www.amazon.com/Applying-UML-Patterns-Introduction-Object-Oriented/dp/0131489062
I cannot recommend this book strongly enough in terms of learning a real-life, professional-grade, practical approach to drafting and applying a well-formed and iterative design strategy before diving into code.
I, too, read the "Head First" book and felt that I was much better off for having read it.
After having a few years of working-world experience, I now view the Craig Larman book that I am recommending to be a perfect "next step" for me.
About the Presence of "UML" in this Book Title:
Whether you have positive feelings or negative feelings about UML notation, please do not let that influence your decision to buy the book (ISBN 0131489062) in either direction.
The prominence of "UML" in the title is misleading. While the author does use and explain UML notation, these explanations are extremely well-woven into relevant design discussions, and at no time does this book read like a boring UML spec.
In fact, here is a quote taken directly from the book:
What's important is knowing how to think and design in objects, which is a very different and much more valuable skill than knowing UML notation. While drawing a diagram, we need to answer key questions: What are the responsibilities of the object? Who does it collaborate with? What design patterns should be applied? Far more important than knowing the difference between UML 1.4 and 2.0 !
This book at times seems like it is "speaking to" a lead architect or a project manager. What I mean to say by that is that it assumes that the reader has significant control over the planning and direction of a software project.
Nonetheless, even if you are only responsible for some very small piece of your company's projects and products, I would still recommend this book and encourage you to apply some "scaled down" modifications of the book's advice to your piece of the project.
My OOP epiphany came from Grady Booch's book, way long time ago. Suddenly I realized why objects were good.
While polymorphism is cool, encapsulation is 75% of why objects are cool. It is sort of like an interface: you see the buttons but not the wiring. Before objects, only the most disciplined coders kept their grubby fingers off the internal bits of other people's procedures (it was called "structured programming").
Object make it easy to Do the Right Thing. Inheritance and polymorphism are little bonuses.
One way to learn about objects is to read other peoples' code. I learned a lot by reading the source code for the Delphi VCL framework. Even just looking at the documentation for Java will help you see what a single object class should do and how it is designed to be used by other objects.
Start a project of your own and pay attention when you want to sub-class your own classes and find that you have to go back and break up some protected methods so you can override just one piece of a process instead of replacing all of it. See how ancestors talk to descendants by calling abstract functions. In other words, go make a lot of mistakes and learn from them.
Enjoy!
Frankly, re-reading old David Parnas papers on information hiding helps me get in the right state of mind. The case studies may not be directly applicable but you should be able to get some useful generalizations out of them.
My epiphany happened when I tried to implement a very OO problem (dynamically and recursively building SQL statements) in VB6. The best way to understand polymorphism or inheritance is to need it and not be able to use it.
One thing that will definitely help you is working on a well-known, respected open source project. Either dig through the source code and see how things are done or try to make some additions / modifications. You'll find that there isn't one style or one right answer for most problems, but by looking at several projects, you'll be able to get a wide view of how things can be done. From there, you'll begin to develop your own style and will hopefully make some contributions to open source in the process.
I think you have to attempt and fail at implementing OO solutions. That's how I did it anyway. What I mean by fail is that you end up writing smelly code while successfully delivering a working solution. After it's written you'll get a feel for where things didn't quite feel right. You may have some epiphanies, and/or you may go and hunt for a slicker solution from other programmers. Undoubtedly you'll implement some variation of standard design patterns by accident. In hindsight, a light will click on (oh! so that's what a visitor is for), and then understanding will accelerate.
As others have said, I think tooling through some good OO open source code is a good idea. So is working with more experienced programmers who would be willing to critique your work. However understanding comes through doing.
You might want to try to read (and write) some Smalltalk for a while. Squeak is a free implementation that can show you the power of a fully object-oriented environment (unlike java or .net). All library code source is included. The language itself is incredibly simple. You'll find that java and c# are slowly adding the features well-known to Smalltalk since 1980.
Tortoise HG is extrodanarily well designed piece of OO open source software (written in Python).
If you already understand the basics, building something from scratch in a fully object oriented language will be a good step in fully understanding OOP software architecture. If you don't know Python, Python Essential Reference will take you through the language in full in a few days to a week.
After you understand the language take a look through the software above and you'll have all sorts of epiphanies.
To understand basically anything thoroughly, you need to have a decent knowledge of at least one abstraction level above and one level below it. In the case of OO, others have mentioned design patterns as the layer above OO. This helps a lot to illustrate why OO is useful.
As far as the layer below OO, try to play around with higher-order functions/late binding for a while and get a feel for how these relatively simple constructs are used. Also, try to understand how OO is implemented under the hood (vtables, etc.) and how it can be done in pure C. Once you grok the value of using higher order functions and late binding, you'll quickly realize that OO is just a convenient syntax for passing around a set of related functions and the data they operate on.