Http://my.oschina.net/justjavac/blog/68536
Translated from Steve yegge's masterpiece execution in the kingdom of nouns
Here
In addition, the first translation is inaccurate in many places or cannot be translated at all. Sorry ~
Translated Text
Hello, world! Today, I will tell you a story about the Java Devil King and his drive out of verbs nationwide.
Note: There is no such success story. If your mind is weak or nitpicking, this story is not for you. If you are angry or want to comment on others' blogs, stop reading them immediately.
Before starting this story, let's familiarize ourselves with the background:
Spam Overflow
All Java users like "Use Cases", so let's start with a use case: Garbage removal. Like this: "Johnny, go to spam, and he will soon overflow !"
How does one express Spam? If you are a normal English speaker, you can roughly describe it with the following words:
Take the garbage bag out of the pool and take the garbage bag to the garage and throw it in the garbage bin. Come back, wash your hands, sit back on the sofa, continue to play your TV game (or do other things)
Even if you don't need to think in English, you can imagine a series of similar actions. Regardless of the language you choose, or the specific steps you take, depending on the action you take. Spam is a series of actions that terminate the spam outside and you return to the room.
Our thoughts are filled with various brave, violent, or passionate actions. We live, we breathe, we walk, we talk, we laugh, we cry, we hope, we fear, we eat, we drink, we go, we listen, we spam. We can "do" and "action" freely ". If we are just stones, life may be good, but we are not free. Because we can "do" things, we will be free.
Our life is also filled with various "terms ". We eat "Terms" (food), we buy "Terms" (commodities) from the store, and we sit on "Terms" (stools. "Term" (Stone) may suddenly hit your head and create a "term" (big bag) on your "term" (head ). A term is a thing. Think about what we will do without something? But they are just things. For example, they mean ending or ending themselves, or some valuables, or the names of things we often see around us. This is a building, and it is a stone. A child can point out a noun. The "change" that happens to nouns is the most interesting thing.
Changes require action. Action is the seasoning of life. Action even gives spices! After all, unless you "eat" it, you will not feel fragrant. Nouns may be everywhere, but life is always changing and interesting because of verbs,
Of course, in addition to nouns and verbs, we also have adjectives, prepositions, pronouns, articles, hyphens, Modal words, and many other words that let us construct interesting languages. They all play their own roles in the language, and each of them is very important. If either of them does not exist, it would be a pity.
So if one day we no longer use verbs, are you surprised?
In the story I want to tell you, this really happened ......
Glossary
In the Java Kingdom, King Java ruled his country with an ironclad hand, and his people were not thinking the same way as you and me. Here, you can see that nouns are very important and directly obey the commands of the king. Nouns are the most important residents. They look elegant and elegant in their gorgeous costumes, which are provided by adjectives. The adjectives are also satisfied with their lives. Of course, they cannot be as noble as nouns, but they are much luckier than verbs.
Because the days of verbs in the Java Kingdom are quite bad.
According to the King's Java law, verbs are subordinate to nouns, but they are not just pets. Or even pets are not. In the country, the verb bears all the labor. In fact, they are slaves of the Kingdom, at least agricultural slaves or contractual slaves. The residents of the Java Community are satisfied with their lives, and they never thought of any changes.
The verb is responsible for all the work in the kingdom, but still does not have any respect, or even cannot be alone. If a noun is found in public, it is immediately arrested.
Of course, "arrest" is also a verb, and he is never allowed to act independently. You must create a "verb to arrest" to assist in the arrest. But what are "creation" and "assistance? In this way, "creators" and "collaborators" also play an important role in this work along with "creation" and "assistance.
King Java, under the guidance of his god Sun (now oracle... [Translator's note]), threatens to evict all verbs out of the kingdom from time to time. If that day comes, of course they need at least one verb to do all kinds of work, and from the cruel sense of humor of the King, the verb is likely to be "executed ".
The verb "execute" and its relatives "run", "Start", "Walk you", "do ", "Just do it" or similar words can replace any other verb by finding the appropriate "performer. Want to wait (wait? Waiter.exe cute (). Brush (Brush) tooth (teeth )? Toothbrusher (myteeth). Go (). Take out (garbage )? Trashdisposalplanexecutor. doit (). No verb is safe, and all verbs are replaced by executed nouns.
In the corner where this spirit is more prevalent, nouns have evicted verbs. If you don't take a closer look, you will feel that there are still verbs, such as farming or pouring down the teapot. But once you take a closer look, the truth will pop up: nouns can be named immediately after them by the verb "execution" without changing their roles. Therefore, when you see that the "cultivated land" is in the "cultivated land", the "Inverted teapot" is in the "Inverted" or "registered Managers" are "registered ", what you really see is the "executor" Army of the devil's King Java, but they are wearing the owner's coat.
Verbs in other kingdoms
In other programming languages, spam is straightforward and similar to what we express in English. In the Java Kingdom, data entities are nouns and functions are verbs, but in other kingdoms, they are not: the residents of the kingdoms are mixed together, and on the premise that they can successfully complete the work, they can be nouns or verbs as long as they like.
For example, in the nearby C field, the Javascript field, the Perl field, and the ruby field, they may break down the garbage dumping into a series of actions (or called verbs or functions ). If they apply these actions in the appropriate order to the appropriate items (take the garbage, take it out, and throw it into the garbage can, etc.), the task of garbage removal is successful. In this process, there is no need for executors or other followers.
In these kingdoms, there is really no need to create so many wrappers to enclose verbs. They don't have terms like "spam dumping strategy", or "spam location locating", just the path to your spam, there is no "callback after the garbage is dumped" to ensure that you will return to your sofa after the garbage is dumped. They only write some verbs to operate nouns and create a main term. For example, they propose garbage (take_out_garbage () and put some sub-actions to be done in it.
In these kingdoms, when demand increases, there is usually a mechanism to generate more important terms. If these savvy creators create a brand new term, such as a house, a carriage, or a machine that is more advanced than humans, they will be given a unified concept: class. People will give the Class A name, a description, some States and some operation suggestions.
The difference between these kingdoms and Java is that verbs are allowed to appear independently and you do not need to create new terms to constrain them.
Java Kingdom people look at their neighbors with a contemptuous attitude, which is also the status quo of the various kingdom of the program.
If you dig a hole deep enough...
On the other side of the world, there is a poor place of residence. There, verb residents are in a very high position. This is a functional realm, including haskellia, ocamlica, schemeria, and some other countries. Because there are few nearby countries, they have almost no contact with countries near the Java Kingdom. It is also because of this that functional countries despise each other and fight for loneliness when something is okay.
In the functional realm, nouns and verbs are generally considered residents of the same level. However, a noun is a noun and basically has nothing to do all day. It doesn't make much sense when they appear to do things or execute tasks, because active verbs basically do what they can do. There is no strange law here that it is necessary to create various "helpers" to help verbs, so in these kingdoms, the number of nouns is the same as the number of actually existent things.
The result is that the verb does what it wants on this land (forgive me for using the word ). If you are an outsider, you can easily create nouns (functions) as the most important resident impressions. By the way, this is also the reason why functional countries are not anything.
In the most distant places, far from functional countries, there is a piece of the legendary land, "Lamda the ultimate" (the ultimate Lamda? Domineering ~ [Translator's note]). In the legend, there are no nouns and only verbs. There are things, but things are composed of verbs. The most popular currency, even numbers, is also a verb! The number 0 is represented as Lamda (), the number 1 is Lamda (), the number 2 is Lamda (), and so on.
In this magical land, everything, regardless of whether you are a noun, verb, or anything else, is made up of the most basic verb Lamda.
To be honest, the residents of lucky life in the Java Kingdom are not aware of the existence of another world. Can you imagine the cultural shock after learning about this? They may invent a new term (such as "hate") to express their new feelings.
Are the residents of Java really happy?
You may think that life in the Java realm is a bit strange. If it is bad, it will become very inefficient. However, you can see their degree of happiness from a local nursery rhyme, while Java's nursery rhymes are a group of odd poems. For example, the children here often recite the fable: (this won't be translated into [Translator's note])
For the lack of a nail, throw new HorseshoeNailNotFoundException("no nails!");For the lack of a horseshoe, EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();For the lack of a horse, RidersGuild.getRiderNotificationSubscriberList().getBroadcaster().run( new BroadcastMessage(StableFactory.getNullHorseInstance()));For the lack of a rider, MessageDeliverySubsystem.getLogger().logDeliveryFailure( MessageFactory.getAbstractMessageInstance( new MessageMedium(MessageType.VERBAL), new MessageTransport(MessageTransportType.MOUNTED_RIDER), new MessageSessionDestination(BattleManager.getRoutingInfo( BattleLocation.NEAREST))), MessageFailureReasonCode.UNKNOWN_RIDER_FAILURE);For the lack of a message, ((BattleNotificationSender) BattleResourceMediator.getMediatorInstance().getResource( BattleParticipant.PROXY_PARTICIPANT, BattleResource.BATTLE_NOTIFICATION_SENDER)).sendNotification( ((BattleNotificationBuilder) (BattleResourceMediator.getMediatorInstance().getResource( BattleOrganizer.getBattleParticipant(Battle.Participant.GOOD_GUYS), BattleResource.BATTLE_NOTIFICATION_BUILDER))).buildNotification( BattleOrganizer.getBattleState(BattleResult.BATTLE_LOST), BattleManager.getChainOfCommand().getCommandChainNotifier()));For the lack of a battle, try { synchronized(BattleInformationRouterLock.getLockInstance()) { BattleInformationRouterLock.getLockInstance().wait(); } } catch (InterruptedException ix) { if (BattleSessionManager.getBattleStatus( BattleResource.getLocalizedBattleResource(Locale.getDefault()), BattleContext.createContext( Kingdom.getMasterBattleCoordinatorInstance( new TweedleBeetlePuddlePaddleBattle()).populate( RegionManager.getArmpitProvince(Armpit.LEFTMOST)))) == BattleStatus.LOST) { if (LOGGER.isLoggable(Level.TOTALLY_SCREWED)) { LOGGER.logScrewage(BattleLogger.createBattleLogMessage( BattleStatusFormatter.format(BattleStatus.LOST_WAR, Locale.getDefault()))); } } }For the lack of a war, new ServiceExecutionJoinPoint( DistributedQueryAnalyzer.forwardQueryResult( NotificationSchemaManager.getAbstractSchemaMapper( new PublishSubscribeNotificationSchema()).getSchemaProxy(). executePublishSubscribeQueryPlan( NotificationSchema.ALERT, new NotificationSchemaPriority(SchemaPriority.MAX_PRIORITY), new PublisherMessage(MessageFactory.getAbstractMessage( MessageType.WRITTEN, new MessageTransport(MessageTransportType.WOUNDED_SURVIVOR), new MessageSessionDestination( DestinationManager.getNullDestinationForQueryPlan()))), DistributedWarMachine.getPartyRoleManager().getRegisteredParties( PartyRoleManager.PARTY_KING || PartyRoleManager.PARTY_GENERAL || PartyRoleManager.PARTY_AMBASSADOR)).getQueryResult(), PriorityMessageDispatcher.getPriorityDispatchInstance())). waitForService();All for the lack of a horseshoe nail.
Today, this is still a good suggestion.
Although the narration in the Java Kingdom is quite different from that in the original. Franklin, the residents here feel that their re-arrangement still has a different charm in it.
The biggest charm lies in the "architecture", which everyone can see. The architecture was granted the supreme status by King Java, because the architecture is all composed of nouns. As we know, in the Java Kingdom, a noun is a verb in which the glory of a thing is higher than that of everything. The architecture consists of countless things: things that you can watch or touch, things that give you a spectacular impression, and things that make a wonderful sound with a stick. King Java is very fond of the noise of scratches. Whenever he changes his car, the sound of kicking the wheel makes him very satisfied. No matter what flaws the story above has, "things" are always indispensable.
As humans, our first instinct is always to seek shelter from various objects. The stronger the shelter, the safer we feel. In the Java realm, there are solid things that make residents feel at ease. They felt the magic of such a huge architecture and thought it was the "most robust design ". And whenever the structure changes, the more confident they are. Then, the power of the architecture becomes so daunting that no one thinks it can destroy him.
In addition to the robust architecture, everything in the Java Kingdom is well organized: you will find that any term will stay where appropriate. Here, each story has a fixed pattern: instance construction occupies a major part in the story expression, because each abstraction has a manager ), each manager has a run () method. Java residents think they can use this model to express everything. This is a kind of "term calculation". As long as you want, it can satisfy any abstraction or computing. All you need is enough nouns, the constructor of nouns, The accesser method, and the important execute () function to implement your plan.
The residents of the Java Kingdom are not only happy, but also have a strong sense of pride.
Object-oriented
Statemanager. getconsiderationsetter ("noun oriented thinking", state. Harmful). Run () or, as the outside world says, "noun-oriented thinking is harmful"
Object-Oriented Programming puts nouns in the first place, but why do we have to put nouns on the altar so that statements become so wordy? Why is the low level of one statement component higher than the other? This is not like object-oriented programming that suddenly lowers the verb's low position, as we think. This is a strange twist of understanding. As my friend Jacob Gabriel elso once said, advocating object-oriented programming is like promoting trousers-oriented dressing.
Java's static type system has common problems like any other similar language. However, over-emphasizing the concept of Noun-Oriented Programming brings great troubles to people. Any type of system requires you to repeat your ideas to work with it, but it seems unreasonable to clear independent verbs.
C ++ does not have this problem. Because c ++, as a superset of C language, allows you to define separate functions. In addition, C ++ provides an independent namespace concept. Java classes carry too much content: namespaces, user-defined types, syntax delegation mechanisms, visibility and scope mechanisms, and so on.
Do not misunderstand what I mean. I didn't say C ++ "good", but I just praised it for its flexible type system at least compared to Java. When a problem occurs in C ++, the audience will be mad and want to kill you (for example, unexpected segment errors and other hidden risks ). In addition, in C ++, it is difficult for you to find a spell that can describe your thoughts. However, its flexible and expressive thinking is far beyond the scope of Java. Because c ++ provides you with a verb, who wants to speak in a language without a verb?
Class is the only modeling tool provided in Java. So when a new idea appears in your mind, You have to reinvent it, wrap it, or even break it until it becomes a noun, even if it begins to be an action, process, or any other concept that is not "things.
I seem to have returned to a group of Perl guys 8 or 9 years ago and said to me, "dude, not all things are objects ."
It is strange that Java seems to be the only language in mainstream object-oriented languages that fully centers on nouns. In Python or Ruby, you won't find abstractproxymediator, icationicationstrategyfactory, or something similar. Why are they full in Java? I bet this is because of the verb. Python, Ruby, JavaScript, Perl, of course, and all functional programming languages allow you to declare and pass functions without using classes to wrap them.
Obviously, Dynamic Language is easier to use. You can pass only one reference to a function, and the function can get it by name, the function caller can only call the function with appropriate parameters and use the returned values correctly.
However, many static languages also have the first class of functions. This includes fixed types of languages such as C and C ++, and types of languages such as Haskell and ML for Automatic Inference. These languages only need some syntax to establish and pass and call the function content.
Java has no reason not to simply add the first class of functions and ultimately implement a mature world. without distortion, You can freely use verbs to implement their ideas. In fact, there is a language based on JVM called the nice programming language that implements a very similar Java syntax, and contains a very expressive implementation using the verb method: independent function. Java forces you to Use callback, ruunable, or other anonymous interfaces to encapsulate it as a class for ease of calling.
Sun has not even broken the creed that all their functions must be possessed by classes. Any anonymous function will have an implicit this pointer pointing to the class that defines it; the problem is solved.
I don't know why Sun insists that Java stands in the noun kingdom. I suspect this is an underestimating of their people; they have added generics, a more complex concept, so they no longer care about how to keep their syntaxes concise. Adding a verb is not a bad thing because Java has established today to provide a tool for a Java programmer to make programming more meaningful based on their own ideas.
I really hope Java can fix this defect so that I can take the garbage out and come back to play games or everything I was doing.