1
$\begingroup$

I am a programmer in a small department creating some new tools and applications with ASPX and SQL, and explaining the methodology to co-workers, and writing documentation (so the question here qualifies as 'teaching'). Having programmed for 30 years and many times created particular systems of multiple connected parts, I think that OOP is probably not the big deal we make of it, but I would like to know how I could have designed the system described below in a more Object Oriented way - to recast it if needed and move forward with more explainable projects in the future.

In brief, the "File Cabinet" system I created recently is to facilitate recreating the intranet used by hundreds of people where I work. The intranet consists of many thousands of files and links to internal and external pages, programs and tools. The File Cabinet idea says that there are two basic ways to show links on the intranet and allow authorized users to make changes, instead of asking the web maintainer to make every single change for them. The two ways are:

  1. Present a folder in the OS as a set of links to files and folders. Users make changes by placing new files in the appropriate place in the filesystem. This display method duplicates some Windows Explorer functionality in a web page.

  2. Provide a method where authorized users can maintain sets of 'Sections' on a Page containing a list of links in each section. The entire page would render just by reading an SQL table listing the sections, and an SQL table listing the links in each section. Users can add and change links and upload files if necessary.

I have it working. The appearance can be customized using a CSS file. The two methods of seeing the content look the same to normal users. Users who can maintain the site already know how to move files around, and can be shown how to use the Editable Links method. These two methods should dramatically reduce the effort of recreating the department's intranet.

I used ASPX to define data sources (SQL or the OS filesystem) and ListViews to generate an HTML table or a set of nesting HTML div's to render the content. The code-behind is VB.Net and most of it is just responding to clicks, manipulating the data before presentation and so on.

Could this project have been built in an Object Oriented manner? I think that most of the applications I create, particularly for our department's intranet, are not really amenable to OO, because they basically consist of only a data source and rendering method. The complexity has to do with manipulating data as it passes between the source and screen.

Is this "too simple" for OO? Or just a different kind of situation? Are web applications usually designed with objects?

$\endgroup$
  • 1
    $\begingroup$ First, why do you want to do this? $\endgroup$ – Buffy Aug 8 at 13:37
  • $\begingroup$ @Buffy I would like to follow industry standards and create something that would be a good example for future projects. Because this system is mostly read-only, perhaps it is a better fit for Functional programming? $\endgroup$ – Scott Rowe Aug 9 at 0:09
2
$\begingroup$

The object-oriented and procedural, or imperative, paradigms, and the functional, logical and mathematical, or declarative, paradigms are just that "paradigms." They are the embodiment of thought patterns and methods for modeling solutions. So long as the end result of a paradigm, the language used to implement it, is Turing complete, and the associated hardware can handle the needed elements, a solution that can be developed in one paradigm can usually be reproduced in another.

The issue shifts from "can it be done this way?" to "is this a satisfactory way to do it?" Some problems are better suited to one method while other are easier to solve using a different method. Using any paradigm to solve a problem, or implement a system, requires the ability to "think" within the model which the paradigm embodies.

I don't think it is fair to classify any practical solution as too simple, or too complex, for any given paradigm. Especially within the education arena, where the goal is learning how to employ the paradigm, and most "problems" are structured to meet educational objectives more than "real-world" problems.

As an "example" for future projects, the described system might even be too large for the students to apprehend while also trying to learn the basics it employs. If it had a smaller scale to it, the project could model several different paradigms in concert. Web applications are commonly developed using the MVC architectural pattern. The handling of the data (model of MVC) could be accomplished using a functional language, the HTML/JavaScript/CSS (the view of MVC) can be implemented well with procedural, non OO programming. The OO programming can be done in the system which gathers the data, and adjusts it according to the directives from the user.

However it's done, the hardest part will likely be converting something you know well, done in the paradigm you are most comfortable with, into something you don't have as much practice with, using a paradigm which is, for all practical purposes, a foreign concept. Having a bad example is likely worse than having no example. If you cannot "think" in OO style, you're unlikely to produce good OO code. Similarly, if you know VB.Net very well and don't know PHP very much, you can probably produce excellent examples of solutions in ASPX/VB.Net, and very poor examples in PHP. If you still want to reproduce your system using OO, or functional, programming, find a colleague who is proficient in the paradigm of choice to implement it for you.

$\endgroup$
  • $\begingroup$ Nice. I just think that we have gotten carried away with the whole idea of paradigms, approaches, methods, concepts and what-all. It is over-investment in ideas. I first sat down at a teletype 40 years ago, and learned several languages as wildly different as Basic and APL within a few years. As I wrote programs and some of them got used in my workplace, I developed approaches for different areas that worked for me. Some of it was pretty 'Functional'. Some was 'Object Oriented'. Some was definitely event-driven. DSLs are my favorite. I did what made sense. So I am bemused by the Paradigms. $\endgroup$ – Scott Rowe Aug 10 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.