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 10 years ago.
By a multi-site system I am referring to a system that has multiple panes of the same version. An example of this is Gamespot, where it shows different release dates and even different games depending on whether you are on uk.gamespot, us.gamespot, etc.
The site selection isn't this issue here. The issue is the process and ease of development and how site specific data is selected or entered. There is also the potential of various system components being not required to be site specific, and in some rare cases it will be required that all data from all sites be visible and selectable for reporting and administrative purposes.
The following techniques have been considered, and although we know they will work, we are unhappy with the cumbersome nature of their implementations:
Table Views -
By creating multiple views for each site on each table we can load data to be queried that is specific to the site. However, inline SQL would have to dynamically call on the correct view, and in the event of a new site being created, a full set of new views would have to be created.
SQL Modification -
By creating an SQL intermediary function, SQL can be modified to change the where clauses and joins to target columns that select only the data specific to a site. However, we believe that to run all of our queries through such a device could have serious problems down the road, and could limit our queries flexibility.
Inline site clauses -
Despite this being the most cumbersome and irritating to implement, it would prove to be the most reliable providing we are able to enforce standards on the way we code. Although this is potentially the most reliable, it is also the least appealing to our developers, it would mean writing site clauses for almost every single query.
So, rather than finding the best means to implement this system on the higher levels of the system, we are trying to find a methodology that will allow a fairly simple implementation of site specific data selection at a base level.
Please let me know if this question is too broad in any respect and I will try to narrow it down further.
First Edit:
The type of data across the sites is identical in respect to the tables. A users table will be shared across all sites and each user may only have access to one, some or all sites.
Lets take the Gamespot example a bit further. One user is given the responsibility of managing the UK version.
The information about games and their reviews are drawn from records accessibly to all sites, because this is globally relevant information
However, lets say the release dates come from another table which is site specific.
The information about the game is retrieved in a typical manner, however getting the release date takes a little extra code to get the correct one for the correct site.
Regarding the user, whichever site that user is currently managing, should be the site that the selection and insertions target.
As you can imagine, the release date is not a core table, and each date cannot simply be mapped against it's respective game directly.
(I do not imply to have any knowledge of the workings of Gamespot, the example is hypothetical)
I don't think there is a general answer here, because we don't know enough about the actual sites you are building. Here are a few examples of questions that will have a major bearing on the best design:
Does the content mostly overlap between the sites, or is it mostly different?
Is there a simple division between "common" content and "specific" content? (i.e. content is either common to all sites, or specific to one site only). Or does it need to be more flexible?
How much do you expect the requirements to evolve over time?
My advice is to focus your energy on the correct table structure to store your data. If you get that right, a good software design should flow naturally from it.
And of course, feel free to ask any specific questions you have along the way!
Edit: after your question update, I still think there is a lot of ambiguity, which can only be resolved as you work out your specific design. But if you want a quick answer, I think inline site clauses are the best of the three options you have suggested. The others add unnecessary layers of complexity.
I don't see why inline site clauses are "cumbersome" and "irritating". They won't introduce repetition in a good design, because you can handle them programmatically in PHP.
Related
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 9 years ago.
I am currently working on a project for which I haven't found a solution yet, although i've been searching the web (stackoverflow included, obviously) for nearly 2 days.
The company i am working for has the need of gerating several kinds of pdfs: machine/product labels (small ones with info), product trial/test reports (typically A4 size, several values), and any other kind that shows up. All the company's data is the cloud in SQL-Server and the application needs to be web based as well, so that it can be used by anyone around the world (Suppliers, clients, colaborators).
Basically, some years ago a php script was done using TCPDF so the IT guys could create report templates programatically, that could be used anywhere. Nowadays, they use the same script but they create the templates in a web application done in VB.NET but it is not the perfect solution because it is full of bugs and limitations.
What is expected is an application that anyone (from the receptionist to the administrator) can use, that allows the generation of a custom template that will later be used to generate pdfs with the desired data fetched from their database.
As far as I see, there are 3 options:
1 - Use some kind of commercial or free tool which is already done and being used by other companies. Although it seems odd, i couldn't find a tool for this. How come there isn't one, considering that basically any big company needs to generate several types of pdfs everyday?
2 - Correct the existing VB.net application and php script, extending its functionality and reliability;
3 - Come up with a completely new approach for this. I've been thinking in creating a web app that allows people to drag and drop elements so that they can build the desired template (vb.net?c#?). Export this template to xml/json. Use this template and the set of fetched vars from the database to generate the pdf using any of the available tools (FPDF, TCPDF, or any other kind of php tool [php is desired to maintain the usability of the current working templates]).
I would really appreciate any kind of input, brainstorm or wild ideas.
One idea would be to look at JasperReports. It can output templates to PDF. I believe it can also run as an applet.
For a more modern look, you could write an ajax client that talked to a java server to call Jasper there.
This is certainly a common requirement - customisable templates for reports/documents. Web-editing facilities are one way of approaching the problem, but it seems very hard to get the web-ui to marry well to an output PDF (pagination alone is a significant roadblock).
Docmosis (a commercial document generation engine) seems like a pretty good fit here for providing the customisable-template capability and output to PDF etc. Because the "templates" are basic word or openoffice writer documents anyone can edit them (though some templates become complex enough you would avoid this for some customer/user groups).
A common implementation (which sounds like a solution to one of your key requirements) using Docmosis is to provide a set of templates in the application and allow the users to download, modify then upload back into the system. The templates take immediate effect and Docmosis has some interesting features to assist users detect and find errors in their template (such as writing errors into the produced PDF/doc as footnotes to describe what is wrong).
Please note I work for the company that created Docmosis.
I hope that helps.
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 10 years ago.
I've been a PHP/MySQL developer for a number of years now, but unfortunately have only worked with small projects up until now. I'm starting a new website now that is very complex and I'm starting to get confused with the workflow. I'm not sure which parts to take care of first, as they're all fairly intertwined.
I'd love to know how some of you manage your workflow for a new website. I'm working independently, so it'd be easier to explain without multiple developers involved. Also, I'll be using the CodeIgniter framework, so it'd be great to have the workflow involve the MVC model, which should actually make the workflow easier.
After some searching, I came across this helpful diagram:
However, I'm not too sure what falls into each category. Here is a general rundown of what I understand so far. Please feel free to correct me when I'm wrong or when there is a better option.
Planning
Make sure you have clear goals for the project: What do you offer, and for whom? How will it be helpful for others? Etc
Sitemap
List all the pages and sub-pages that are going to be on the site.
Wireframes
Go through your whole sitemap and make a rough sketch of every single page. (How detailed should you get?) You can use pencil and paper, or programs like Axure or Mockingbird.
The next major category in the workflow chart is content, but I'm not sure what this involves. Is it all the text on the website? Database structure? Something else?
Artwork
The actual design/template of the website. Is this really the right place for this, though? I would think that the coding and functionality is more important, and make the design after that.
Coding
This step seems to all-encompassing, and I'd think it needs to be broken down. Is the database structure made first (or was that done in content, after the wireframes?) Do I make the outline for all the functions for each page in the sitemap? Do I just create all the necessary controllers and make comments of which functions I'm going to put and where? Do the models go after the controller outlines, or vice versa? When do I start filling in all the controllers and models?
Constant testing is involved to make sure your code works properly.
Content Population
Would this include the view files in the MVC framework? In other words, all the data that the controllers and models provided?
Final Testing
Make sure everything works in all browsers. Making tweaks and changes here and there. Go all out with numerous "what if" cases.
Production
Site goes live.
Conclusion
The above is what I understand to be an organized flowchart of the steps in developing a complex website, but my understanding could be greatly improved. What should be changed? I could use all the suggestions possible. Thank you.
EDIT: Someone here mentioned "agile development"--from what I'm reading thus far, it doesn't actually have a structure. Correct me if I'm wrong. As I commented on that answer, is it really possible to develop in such a way for complex sites, such as Amazon or Ebay? The workflow process, in my un-knowledgable opinion, should have a clear plan, or else there would be no focus in the project.
FINAL EDIT: Although this question was closed, I'd like to add some info for those that may find this later. I found the following workflow useful: http://www.webassist.com/free-downloads/tutorials-and-training/web-dev-workflow.php. A PDF of the general workflow: http://assets.webassist.com/how-tos/Short-Dev-Checklist.pdf. Agile development can also be used of course, but this could be a good starting point for those that don't know where to start. I may add additional workflows and examples here as I find them.
The R&D world is moving towards agile development, where you don't do so much planning and write everything down from start to finish, but rather do small iterations and make small changes so that you always have one clear goal in front of you, and you can adjust your direction as your understanding of the requirements improves (real ones, based on user feedback, not estimated guess work based on what you think the customers will want/use)
I suggest you research Agile development, and Lean startup methodologies, it changed the way I build online services, and will make you much more efficient and productive.
I can tell you that my online service went live about 2 days after I started coding. That does not mean that you open it to real users right from the beginning, but you can get immediate feedback from the real world instead of keeping it all on your dev machine until you're "ready to go live".
Agile development is definitely a good idea for websites (as, typically, the coding is both relatively easy and independent). The main point about agile is that it allows for changes, and it also allows for adjusting for "it took longer than expected to do Feature B, so C and D will be delivered in another iteration". As you are probably aware, planning larger projects can take a lot of effort, and is almost always longer than you'd expect. With agile, you do each bit as a "vertical slice" - meaning anything done should contribute something useful to the product, all the way from adding a ling on the front-page [or wherever it belongs] to adding the code to handle it and the database model to store/retrieve relevant data.
I'm pretty sure that you still need to do a fair bit of planning for a large site with lots of pages, and lots of database tables, etc. But as long as you have a reasonable grounding in general website/database design, Agile methods will let you design "walking skeleton" (somethig that works in the basic concept, but need more meat on the bones to be a working product). Then you flesh out the sketch with more features, each feature is "complete" in itself, and adds something the customer needs. That way, you always have something you can deliver to the customer after each workitem is finished.
I'm also convinced that Amazon or Ebay has A LOT more than 20-30 tables. I work with a site called www.planetcatfish.com, and it is MUCH smaller and simpler than Amazon or Ebay, and it has 25 tables (besides the phpbb tables for the forum, which is also used for the site specific user functionality). And that was written over many years, using mainly php, a little javascript and a fair bit of mysql inside the php code.
TheZuck's answer is good and very helpfull so I'll just add some of my own experiences, which doesn't necessarilly mean that you'll go through the same thing, and probably won't if you have half a mind for business (which is what I'm lacking. :S).
Content has always been a problem with my clients, so I'd say get them working on that early! If you're working with a copywriter I guess thats not a problem. But there should be some sort of penalty for not delivering the content to you in time.
It is also worth noting that your clients will only really start thinking about their website once they start thinking about the content. Expect to hear about them wanting some changes when they've started working on it.
If you're clients are small businesses, then they tend to not understand what it is that actually takes time. Even though agile development is really nice I believe that this will be hard to implement towards small businesses since they don't have very much money to work with and will probably want a fixed priced for a finished product. And if it's fixed they'll just get pissed if they've used up all their time or whatever it is that they've paid for without giving them a finished product (working deliverable, is not the same as a finished product!).
Clients tend to be IT-illiterate, sometimes to the extreme. Count on you having to put some or quite a lot of time into explaining "obvious" things to them.
Don't overestimate yourself and your abilities, since this will probably mean that you'll charge less than what is actually reasonable. A quality website should cost money, but I for one will understand if you charge to little, you know just to get a few clients.
I realise that this isn't really an answer to your question but I hope it will help somewhat.
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 10 years ago.
I've always had a thing for dynamic code. Code that's really easy to add cool new features to, without doing much work. For that reason, I build lots of dynamic frameworks and use them in my projects. Some are small, some are big.
As an example, I built a small custom error reporting framework that I still use in almost all of my projects today.
Here's a quick example of how it works:
error_reportLibrary.php - This is where all the magic happens. The class and all the methods sits here. This is the file included when the framework is needed.
error_reportConfig.php - This is where my configuration goes (error types, ect). Here's an example of this file, which shall give you a pretty good explanation of how the small framework works:
(the comments in the code should explain what each element does as a setting)
# ------ Main Settings ---------
$error_handlingSettings['errorStat']=true;//set this to false, and I wont display any errors. I don't care what the other errorTypes have to say.
$error_handlingSettings['default_highlight_color']="red";//this is the default highlight color that will be used if no color is defined for a specific errorType
# ------ Open API -------
$error_handlingSettings['open_api']['status']=true;//set this to true and I'll show errors for the Open API
$error_handlingSettings['open_api']['highlight_color']="#0ff";//shall I highlight any errors that occur for this specific type? if so, set this to a color.
$error_handlingSettings['open_api']['onRemoteAddr']=true;//shall I display errors to specific IP addresses?
$error_handlingSettings['open_api']['remote_addr'][]="86.8.168.228";//so I will show to this IP
$error_handlingSettings['open_api']['remote_addr'][]="127.0.0.1";//and this IP
# ------ SQL Core -------
$error_handlingSettings['sql_core']['status']=true;//set this to true and I'll show errors for the SQL Core
$error_handlingSettings['sql_core']['highlight_color']="orange";//shall I highlight any errors that occur for this specific type? if so, set this to a color.
$error_handlingSettings['sql_core']['onRemoteAddr']=true;//shall I display errors to specific IP addresses?
$error_handlingSettings['sql_core']['remote_addr'][]="86.8.168.228";//so I will show to this IP
$error_handlingSettings['sql_core']['remote_addr'][]="127.0.0.1";//and this IP
So as you can probably tell, each error type is simply a different part of the project I'm using the framework on (for example, SQL Core is the database framework I use. So if any db query issues occur, this errorType will be looked at when printing errors).
So for printing errors, this is the syntax:
errorModule::doError("errorType","error messege");
As you can see, there are some extra little things I can do. Like display to certain IP addresses and highlight the error text, which I can confidently say: will not affect the scalability of the framework.
Remember, the above is just an example of the dynamic frameworks I create/use in my projects.
Now, to the question(almost): I've been told by a few of my colleges that dynamic frameworks like the above are terrible when it comes to scalability. Regardless of the fact that they are very maintainable. So if I used the above framework on a web app that got 1M+ requests a day, it would totally screw up...
Now I'm not apposing against their opinion (actually....) but I would like to know why this is? Why is a dynamic framework like the above considered bad for scalability?
I think you're missing the point when creating a 'dynamic framework.'
A lot of my earlier PHP code functioned sort of like this; a class with a bunch of methods and maybe a construct method that set up a state, using globals to track configuration in arrays. These all used a lot of memory compared to a wholly OOP approach; and while yes less memory and faster than an 'off the shelf' solution; nothing compared to the way I design frameworks now.
It doesn't appear you are taking advantage of things like interfaces, abstract classes, both class and interface inheritance and so forth. These types of frameworks do scale because the original code base is so small and take advantage of specific OOP functionality (like PHP 5.x's magic methods.)
Multiply a script that you felt was fast enough running on server that's not taxed very much by say 100 and, you've got problems; and you're running out of memory, hitting pages outs; and things will crawl to the point you're forced to reboot/throw more resources at the server.
Why? Poorly written procedural code that tries to act OOP, even tries to look like it, is just wrapping up old habits in a new package.
PHP is slow and clunky in general. It's high-level, which means each line carries "baggage". It's common that a single line of PHP code will convert to a slew of low-level instructions.
You can still scale 'dynamic' frameworks that rely heavily upon PHP's underlying system, and don't waste a lot of time or memory with high-level abstractions.
In my opinion, large, "convenient" frameworks often cause more problems than they solve once shit hits the fan in a production environment. My favorite teachers always reminded me to K.I.S.S. -- Keep It Simple Stupid.
Of course, If you want truly scalable performance you may want to compile your php with hiphop or write your application in a compiled language like C++ or D.
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 am working on this website that catalogues products with their basic information and all. I checked and all the different input features required were possible using a combination of fields(cck) and some related modules, features like multi image upload, multiple field values, dependent fields, node reference. My only fear is this would result in a good number of tables that would effect performance. How serious would that performance hit be is what I am curious about? The website is for a niche segment and wont be expecting thousands of users at the same time, maybe a couple hundred simultaneous users during some promotional event, thats it.
I can code everything from scratch but the last time I tried it in drupal 6, there were a lot many hurdles, specially for ajax based dynamic forms and we are a bit tight on schedule. So i just need some help figuring out if the extra effort would be really worth it.
Thanks.
(ALSO: Why did field/cck have to take a table for each field route instead of a table for a content type? Wouldn't that have been more efficient?)
There is alot of ajax functionality out of the box, multi image upload etc ... so that depends on what you need, and if the functionality is allready available.
I have drupal websites with 1000+ visitors a day, with the right caching this is no problem.
The content type fields have their own table now, because they restructured everything to entitys. This makes everything more generic and abstract, so that functionality is now not specific to cck, or one module, but for every module at the same time. Sure this propabely affect the performance, but again, with the right caching enabled this shouldn't be a problem.
Conclussion: Is it worth the effort ? That totaly depends on what you need to create exactly, and how much you can use from existing modules. Also on how often you will have to change things, how large your catalogue ...
You should also check out the Media module suite. While it's not seen a final release as yet and its sub-modules are in a worse state, it's quite usable albeit with rough edges.
Fields use their own tables for efficiency and reusability. This allows a field to be reused in multiple node types. Besides, how would you handle multi-value fields if they were all dumped into a single table per node type?
Performance depends entirely on the type of your audience - anonymous vs. authenticated. If it's anonymous, then you should be fine. If it's authenticated then you will need to pay a little more attention :) Performance for your traffic estimate should not be a problem in a decently capable server.
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 mainly use PHP and I have been coding using it for a while. My main problem with PHP is that I think as your program gets bigger, it gets harder to maintain your code (probably applies for other things). I want to reduce this complexity in maintaining/modifying my codes. I want to make things modular and have rules when to start a new class or just append to an existing class (for example). I know that there are frameworks out there (CakePHP, Symfony, Rails) but what if I just want to use my PHP and use a hybrid of my own style and an existing style for good code management?
This is not just pertaining to php, this applies to coding in general. Frameworks will only help you organize your mess but if you are new to programming a framework will only organize your messy code.
Some basic ideas to keep in mind aside from undertaking a undergraduate in computer science (which i recommend if you are serious about coding) is to make your code modular.
For example, and this is a simply example to demonstrate the point. If you have a site that generates an html table containing financial data.
(Here are a few scenarios of how to go about coding this ...)
You open up a new screen, financialdata.php, you code from line 1 to line N the code needed to get the financial data from a data source (database perhaps) and then iterate over the financial
data to construct an html table.
You open up a new screen, financialData2.php, you code a function at the top which pulls data from yuor data source and returns an object (array maybe) containing the items. You take this return value and generate your table on this financialData2.php page.
You open up yet another new screen, financialData3.php, you take your database function from financialData2.php and use it to get your financial Data from yoru source. You code another function to generate an html table based on some arguments passed in as parameters. And lastly in your financialData3.php page you display do the following and your page now has a table containing financial data from your data source.
The lesson here: the more modular your code is the better in a lot of ways. You now have a data base function that can get data, and you have a function that will render a table based on a list of items passed in.
You can now create another page and use these functions in different ways, perhaps your data source function has parameters like table and selection criteria. This way you can use the same data function to get data from different tables based on criteria. You now have a VERY basic data abstraction. (Dont let abstraction scare you aware). An abstraction is nothing more then a simplification of something. In this case we have abstracted away the details of how we get data and let our function getData take care of those details.
Please comment/ask questions and we can discuss further but honestly, I do not think one book or web site can teach programming practice like a BS in CSE can through classroom discussion and hands on practice.
Learn Design Patterns:
http://sourcemaking.com/design_patterns (covers the GOF patterns)
http://martinfowler.com/eaaCatalog/index.html (covers POEAA obviously)
Also helpful to increase code quality:
http://phpqatools.org/
A sidenote on frameworks:
while frameworks often do tell you how you should layout your code and folders and stuff, they rarely tell you how to code properly. A framework offers solutions to common problems and that's cool, but if you try to step outside of what the framework already offers in terms of functionality, you are on your own again. That is because frameworks are concrete implementations, while you want to learn about design principles.
This is about code in general (it uses Java/C/.Net for the examples if I remember correctly), but Code Complete's the best book I've read on general code structure. It covers everything, from the nuts & bolts of how to write and organise variables and methods up to program structure. I'm not sure how applicable the examples are to PHP but probably worth a look.
http://www.nettuts.com
everything you'll want to know about PHP and web development.
I like this one: http://www.wrox.com/WileyCDA/WroxTitle/Professional-PHP5.productCd-0764572822,descCd-tableOfContents.html
http://www.amazon.ca/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612
Lots of design patterns explained. But not in PHP. Good for understanding useful design patterns. Support the author by purchasing it.