Archive for May 2012
A lot of experienced PHP programmers see frameworks as tools for “weak” programmers that don’t understand how to write good, clean code. Whether this is true or not is up for debate, but the fact of the matter is that PHP frameworks are a tool that can be used to save time and tighten up one’s coding.
Zend is the leader among other frameworks. It is natural: it has been created by the developers of PHP language themselves and supports enterprise-solutions. Nevertheless, in the category “Breakthrough of the year” a young, but very ambitious framework Yii has won. I’ve decided to take a deeper look at this breakthrough, basing on our developers’ experience.
Yii is a framework for web programming of general purpose, that can be used for development of almost any kind of web-applications. Due to the presence of the advanced caching means, Yii is especially good for development of applications with a big traffic flow, such as portals, forums, content management systems (CMS), E-commerce systems etc.
Yii isespecially good for being flexible, practic and fast.
True, there is a simpler CodeIgniter. It is very fast and handy tool, for the beginners, in particular (there is plenty of documentation). But our experience has shown a very interesting pattern – solution of many tasks in CodeIgniter takes much more time, than solution of the same tasks in Yii. There was no task, that has been solved faster in CodeIgniter.
True, there is a more famous Zend framework. It has lots of various modules (almost for all cases), very elaborate architecture. But it is essentially slower, bigger, “heavier” than Yii. It suffers from some kind of “verbiage” – long class names, for example. What I mean is that it looks “heavy” even visually.
But if you need, you can use modules from Zend Framework, working in Yii.
Yii is a very fast, modern and flexible framework. It has many pluses:
- high speed of development
- high speed of work
- module, components and widgets support
- comfortable work with database: it can be used either as Data Access Objects, or as Active Record
- convenient and flexible caching system and system of cache validating, memcached/xCache support
- handy built-in code generator Gii
Nowadays, there are many various PHP frameworks, and every developer decides for himself, which framework to use or not to use at all. Our programmers have marked out Yii pluses, though at the same time it doesn’t mean, that other frameworks are not useful at all.
Which framework do you use and why? I would love to see your comments here.
I’ve been wondering, why lots of PHP-programmers invent their own wheels (CMS, CMF, ORM etc.?), when there are a number of ready practices, ready PHP classes. Almost all typical tasks, that you can face to in web-development, have been already realized in the frameworks.
Let’s draw a simplified parallel. Just imagine that you need to build a house.
If you build it without any framework using plain PHP, you will get a formless hut, shaped of natural clay. Probably it turned out to be lasting, but once you need to make some changes into the construction, it will cause you much headache, and even small changes in one part of the house will entail negative consequences in the other part.
If you build it with clay, though with the help of previously developed special clay frames (your functions library), you will build the house faster. But don’t forget that, firstly, you will have to develop these frames, and it will take you not one year of hard work.
In this case the best option seems to build the house using store-bought bricks or even the whole slabs. PHP frameworks are associated either with ready bricks, or with slabs. In case of using slabs the house construction takes less time, though every so often you have to file them by sizes. There are some moments in case with bricks as well, but it is much easier to reconstruct the house, built from typical “bricks”. Though, firstly, you will have to study brick types, sizes etc. The same is with PHP frameworks.
There has been held a survey, according to which 40% of PHP developers either write in plain PHP, or do not use typical solutions, such as web development frameworks. Why don’t they? Let’s read, and analyze the comments of the respondents, to understand why so many programmers prefer to discover the continents again.
• “I’m lazy to learn something new”. The most popular answer. Well, I have nothing to say here.
• “I’ll manage everything by myself. I don’t need these frameworks”. Some programmers consider themselves to be genius, who will write a solid source, and debug faster on their own, than the whole community do.
• “I’ve already had my groundwork, which are completed as a framework. I just don’t have enough strength and time to publish them”. By the way, there are lots of such people. At the same time, your own solution will never be standardized, it will never be comparable with any of other products, and it is the programmer who develops it, who can leave his job later, and his solution will become the employer’s headache.
• “Frameworks are too slow, they are humongous”. Here we can say, that literate caching is the solution. Moreover, there is a possibility in smart frameworks, like Yii or Zend to optimize everything you need.
• “A framework doesn’t work with the latest technologies, like PHP 5.3, and I want to”. Well, in this case you can turn your attention to Zend Framework 2 and Symfony 2.
• “Frameworks are not universal”. I can’t understand this comment at all. Frameworks were thought to be universal tools. They are much more universal than CMS. Here is an example: there are 5 components in Symfony, ZF is modular from the very beginning, thus it is possible to change the structure, and even the components of the internal arrangement.
• “Frameworks are too universal, you will have to spend much time to adapt them”. And writing the code grassroots will take you less time? This is true only for small tasks, but once various demands appear, the customer changes the conditions, the design changes, and you have no architecture, then you understand that it would have been better to work in the framework.
• “Frameworks make the structure much more complicated”. That is not true, as framework gives you a carcass, set of tools. Naturally, you will have to spend some time to study how it works, but once you do this, you will see, how your work is simplified.
• “I don’t like exterior frameworks, on the reason I like writing in plain PHP”. Well, in this case, let’s write applications in assembler, why not? In my point of view, by saying this, some programmers just cover their reluctance to learn a new PHP dialect as a framework.
• “Oldclients, oldprojects. There is a need to support them”. If you are not able to persuade the client to pay for the transition (which is more likely to happen), then you have no choice but to support.
• “Frameworks are good to practice at the initial stage, when your experience doesn’t allow you to write more complicated things”. Consequently, they give you superiority in the speed of development that is really important. The understanding, why we need standards comes with experience.
• “Why do I need frameworks, if I have CMS, which is sufficient for me”. Probably, you don’t need a framework in this case. Though if CMS is not enough (new demands, specification changes), you’ll have to think the question over again.
Now, you, please, share your thoughts about PHP frameworks? I’m eager to read about your experience, because, as you know, the truth emerges while arguing :-)
Google is pregnant again?
Perhaps you have heard this statement. Also you could hear that the “baby” has been created to substitute Java… and number of similar statements… But What is NOOP?!
Some people are reporting it to be Google new language, which is not quite technically correct. Noop is being developed by a group of independent developers as a side project, a few of which happen to work at Google.
Noop is built on the Java Virtual Machine and is syntactically similar to Java. What it adds, though, is dependency injection and testability functionality built directly into the language…
What is the status of NOOP?
Development on the language is still at an early phase, but many hope that they release something to the public in the near future. There is no binary to download, although, the source code is available from their online repository.
Why this language?
The experience shows that developers often create code that’s hard to test and maintain, without realizing this. On a large software project, this can create problems later on for the whole team. While analyzing this problem, it was found that the root cause in many cases was language features – like globally visible state, misused subclassing, obligatory and redundant boilerplate, and API’s that are easily misused. The language seeks to apply the wealth of lessons of language development over the past 20 years and optimize on cleanliness, testability, ease-of-modification, and readability.
Also we should consider the following factors why to choose/try this language:
1) Dependency Injection changed the way we write software. Spring overtook EJB’s in thoughtful enterprises, and Guice and PicoContainer are an important part of many well-written applications today.
2) Automated testing, especially Unit Testing, is also a crucial part of building reliable software that you can feel confident about supporting and changing over its lifetime. Any decent software shop should be writing some tests, the best ones are test-driven and have good code coverage.
3) Immutability and minimal variable scope are encouraged by making final/const behavior the default and providing easy access to a functional style. Testability is encouraged by providing Dependency Injection at the language level and a compact constructor injection syntax.
In conclusion I would like to notice that this language experiment attempts to blend the best lessons of languages old and new and syntactically encourages what we believe to be good coding practices. However only time will tell whether it will last or merely be another fad language which the programming world is littered with. In any case this language might be worth taking a look at… ;-)
Thank you for your attention and you are welcome with your comments!
When you hear .NET, the first idea that comes to your mind will probably be internet or networked applications. Although this is absolutely true, there are many more types of applications to create with .NET.
So here is a more or less full list of various types of application that we can develop on .NET.
•ASP.Net Web applications are programs that used to run inside some web server to fulfill the user requests over the http. ASP.NET Web applications can range from simple Web sites that consist of HTML pages to advanced enterprise applications that run on local and remote networks. These enterprise applications also provide components for exchanging data using XML. This type includes dynamic and data driven browser based applications. (Ex: Hotmail and Google).
•Web services are “web callable” functionality available via industry standards like HTTP, XML and SOAP.
•Windows applications are form based standard Windows desktop applications for common day to day tasks. (Ex: Microsoft word). Run only under Windows environment. These applications consume the services provided by the Windows operating system.
•Windows services are long-running executable applications that run on the system as a background process. These applications do not interfere with the working of the other processes that run on the same computer. Windows services execute within separate Windows sessions created specifically for each Windows service. These services do not have a graphic user interface and are ideal for running on the server. Windows services were earlier called NT services.
•Console applications are light weight programs run inside the command prompt (DOS) window. They are commonly used for test applications.
•Mobile applications can run on multiple mobile devices, such as Pocket PCs, mobile phones, or personal digital assistants. These applications provide ubiquitous access to data from mobile devices. The .NET Framework automatically makes changes to these applications to enable them to run on multiple browsers, depending on the mobile device.
•Class libraries are components that you create once and reuse a number of times in multiple applications. Class libraries allow you to define several classes, along with their methods and interfaces, in one file. These libraries compile to .dll files and facilitate rapid development of new applications because of reusability of code. To access the functionality of the classes in a class library from your application, you need to include a reference to that library in your program.
All types of .NET applications use one or more .NET compliant languages for their design and development. The .NET Framework includes various technologies, such as ASP.NET, VB.NET, VC++.NET, and ADO.NET. вставить предложение The .NET Framework includes various technologies, such as ASP.NET, С#.NET, VB.NET, VC++.NET, and ADO.NET. You use ASP.NET to build Web applications and services, VB.NET and VC++.NET to create Windows applications, and ADO.NET for flexible access to databases.
Can you add the above mentioned list with more types of applications? What applications do you usually develop using .Net? And why do you prefer .Net to any other technology for a particular type of application?
Thanks for sharing your experience with us!